title: Loop through all pixels and get/set individual pixel color in OpenGL?
body: <p>I wrote a little thingy with Processing that I now would like to make a Mac OS X Screen Saver of. However, diving in to OpenGL was not as easy as I thought it would be.</p>
  
  <p>Basically I want to loop through all pixels on screen and based on that pixels color set another pixels color. </p>
  
  <p>The Processing code looks like this:</p>
  
  <pre><code>void setup(){
    size(500,500, P2D);
    frameRate(30);
    background(255);
  }
  
  void draw(){
   for(int x = 0; x&lt;width; x++){
    for(int y = 0; y&lt;height; y++){
       float xRand2 = x+random(2);
       float yRand2 = y+random(2);
  
       int xRand = int(xRand2);
       int yRand = int(yRand2);
  
       if(get(x,y) == -16777216){
       set(x+xRand, y+yRand, #FFFFFF);
       }
       else if(get(x,y) == -1){
       set(x+xRand, y+yRand, #000000);
       }
     }
   }
  }
  </code></pre>
  
  <p>It's not very pretty and nor is it very effective. However, I'd like to find out how to do something similiar with OpenGL. I don't even know where to start.</p>