I’ve created four windows using OpenGLUT, and each window will have unique contents, so I need 4 buffers. My system doesn’t have enough framebuffers (no AUX buffers) so I’ve got to create my own buffers, which I’ve done:
char* BufferA[ WIDTH ][ HEIGHT ][ 3 ];
char* BufferB[ WIDTH ][ HEIGHT ][ 3 ];
char* BufferC[ WIDTH ][ HEIGHT ][ 3 ];
char* BufferD[ WIDTH ][ HEIGHT ][ 3 ];
my display routines look like:
glDrawBuffer(GL_FRONT_LEFT);
glRasterPos3i( 0, 0, 0 );
glDrawPixels( WIDTH, HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, BufferA );
glFlush();
But I can tell I’m writing to BufferA in a clumsy fashion:
glDrawBuffer(GL_BACK_LEFT);
glDrawPixels( 640, 480, GL_RGB, GL_UNSIGNED_BYTE, BufferA );
// some glBegin - glEnd stuff
glReadBuffer(GL_BACK_LEFT);
glReadPixels( 0, 0, WIDTH, HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, BufferA );
When I draw to the buffer I’m:
- putting the current contents of the memory buffer into the framebuffer
- drawing to the framebuffer
- reading the framebuffer back into the memory buffer.
I need to draw directly into the memory buffer. How is that done?
NOTE: Was able to use the above clumsy method with 4 different windows quite successfully (seems simultaneous) using a NVIDIA Quadro4 750 XGL/AGP/SSE2 video card with Windows 2000. But when I run the same thing on a Windows 200 workstation with a GDI Generic video card, I get abysmall performance, totally unacceptable. However, our code is targeted for the slower, less capable machine, so I’ve got to deal with it.
-bBrain