PDA

View Full Version : using multiple backbuffers...



jdaniel
03-10-2004, 12:41 PM
Hello,

I am wanting to draw to more than one backbuffer. The problem I am having is that if I try to use the auxillary buffers (i.e. GL_AUX0, GL_AUX1, etc..) they seem to draw directly to the screen. In fact, the only buffer I can seem to use that doesn't draw to the screen is the GL_BACK buffer.

I would like to use some sort of offscreen auxillary buffers to I could still swap the buffers out to prevent flickering.

Any advice?

Thanks!

dorbie
03-10-2004, 08:49 PM
How about rendering to a texture.

Relic
03-10-2004, 10:23 PM
Before you try to use AUX buffers you need to query how many are supported. I your case I expect zero, which means the glDrawBuffer command should have raised an GL_INVALID_OPERATION error (check glGetError).
There are multiple methods to store buffers or to draw to different buffers.
P-buffers are the most common method to have more offscreen buffers.
Or you could use a buffer region extension to save and restore contents quickly.

Extensions are described here http://oss.sgi.com/projects/ogl-sample/registry/

If you have none of them, you could use glReadPixels and glDrawPixels to save and restore buffers (warning, this is the slowest method).

jdaniel
03-11-2004, 09:47 AM
The texture suggestion was nice. Thank you. So I am attempting to use the glCopyTexSubImage2D() command. I do so as follows:

glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 8, 6, 522, 394 );

Now the pixels are moved from the back buffer to my texture. The only problem is that the aspect ratio is not preserved, so while the entire image of the 522x394 section of the back buffer is copied to the texture, it is displaying in about a 250x150 section of the texture.

In other words, it is squished onto a small section of my texture.

Do I need to set a glPixelTransfer value?

Thanks!

jdaniel
03-11-2004, 11:07 AM
Ok, I solved the issue. The problem was that I was usign a png lib to load in my textures and I was not aware that it was actually making the texture in powers of 2. So when I would bind the texture to the quad I was using (0,1) etc.. After doing the division it worked fine.

Anyway, I love this forum and thanks again for the help!