Buffer? cpu-intensive rendering

I have to visualize a “chess-board” but with more than 160.000 sqaures each colored according to some measurment-values.

I’m usging wxWidgets with a wxGLCanvas-object.
Now i set up a glOrtho (only 2D is needed) and paint the squares.
I’m using multiple windows so more “measurement-objects” could be viewn.
Now i had the problem with scroll, size, overlapping,…, everything that calls a PaintEvent. There are too many float-values to render it every-time.

So i tried following trick:


OnPaint(..)
{
 if(first)
 {
   glDrawBuffer(GL_FRONT);
   Render(); 

   glDrawBuffer(GL_BACK);
   Render();
  first = false;
 }
 SwapBuffers();
}

But this code makes errors on some systems, picture is getting blurred and black, a total mass.

Now i’m seraching for some kind of buffer-object or anything like this!?
instead of rendering it everytime (it’s not animated + not texture!).

Any suggestions?

There is a kind of buffer that works really well under these conditions, it’s called a texture.
If filtered properly you will get the look your after, with the speed to redraw it all the time.

Also you could render it to a FBO which would allow it to be used multiple times.

Also never draw to the front buffer, it may cause intense flickering, and vista certainly does not like it.

I never worked with textures before.
With glCopyTexImage2D i tried to copy actual rendering to a texture and want to draw a quad with this texture. But the quad remains black. Here my code:


glEnable(GL_TEXTURE_2D);
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 500, 500, 0);


glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
 glTexCoord2f(0.0f, 0.0f); glVertex3f(-500.0f, -500.0f, -0.1f);	
 glTexCoord2f(1.0f, 0.0f); glVertex3f(-100.0f, -500.0f, -0.1f);	
 glTexCoord2f(1.0f, 1.0f); glVertex3f(-100.0f, -100.0f, -0.1f);	
 glTexCoord2f(0.0f, 1.0f); glVertex3f(-500.0f, -100.0f, -0.1f);
glEnd();
glDisable(GL_TEXTURE_2D);

I have a negative Ortho: glOrtho(-900, 0, -900, 0, -1, 1);
Must i consider it @ glCopyTexImage2D for the left-bottom-corner?

maybe your quad is lit by a light source you did setup earlier. plenty of reasons why it could be black. make sure that at least the texture has proper values = that the backbuffer was copied properly to the texture, then continue on the quad.

Define texture storage calling glTexImage2D and follow instructions in the wiki page:

http://www.opengl.org/wiki/index.php/Texture_Mapping

Then you can call glCopyTexImage2D