View Full Version : Back right buffer problem?
05-01-2007, 09:50 AM
I'm trying to draw something to the GL_BACK_RIGHT buffer, but for some reason it keeps going to my GL_BACK buffer instead - is this right?
I'm drawing a black square to GL_BACK_RIGHT, and an orange one to GL_BACK, but when I call SwapBuffers(), I see *both* of my squares on the screen. I thought the back right one would still be hidden as it has been drawn to a different buffer...?
Here's my code:
// use GL_BACK_RIGHT buffer
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// draw a black square
// now switch to GL_BACK buffer
// draw an orange square
// swap back buffer to front
Many thanks for any help in advance.
Are you sure you have a stereoscopic rendering context? If not, only the left buffer exists, and activating the right one is an error. Since it's an error, the command is ignored and the active buffer is not changed. That would explain why they both end up in the same buffer.
05-01-2007, 10:43 AM
I'm not sure. But I've tried rendering to the following buffers: GL_FRONT_LEFT,
GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT, GL_FRONT,
GL_BACK, GL_LEFT, GL_RIGHT
And I get the same results, no matter which buffer I draw to. I always get both squares showing. Even if I render to GL_NONE!! o_0
Seems like it always defaults to GL_BACK, and nothing else...
05-01-2007, 10:57 AM
BTW I'm using NeHe's Tutorial 2 to test this.
All I did was replace the DrawGLScene function with my code above, and I always get both squares showing. :-/
Many thanks for your help.
05-01-2007, 11:59 AM
if (!isStereo) printf("Your pixel format wasn't created with stereo attributes, or your hardware doesn't support stereo.");
05-02-2007, 03:14 AM
Thanks for that. It seems that neither my laptop nor my pc at work have either stereo or auxilliary buffer support!! Which is real disappointing since I can't do what I want to do now.
I take it these buffers are very rarely used, if they are not supported that well?? Neither of my machines is more than 2 years old. :-(
What is it you want to do then? Asking for a specific solution it not always the best idea. By doing so, you assume that solution is the best solution for the problem you have.
If you instead tell us what your ultimate goal really is, maybe we can provide a solution you never thought about, which is even better than using the stereoscopic rendering mechanism.
But then again, for stereoscopic rendering, there aren't many option. However, I do get the impression you don't really know what stereoscopic rendering is about, and you try to get it to do something it can't do.
05-02-2007, 04:38 AM
OK, after a bit more research, it seems the problem's because I'm using the 'generic' implementation of OpenGL on Windows - which does not support either stereo or auxiliary buffers.
So I'm wondering, how do I go about using a hardware implementation instead - and is this a wise thing to do?
05-02-2007, 04:50 AM
Bob, thanks for your reply. I didn't see it until after I posted my last message.
I'm using the 'color picking' method. All I want to do is draw a scene to some back buffer that I can read the pixels from using glReadPixels. Every time the user moves the mouse I want it to find out what object the mouse is over.
Now I could simply draw the scene to GL_BACK every time the use moves the mouse, read the values, then clear the buffer and draw my main scene over it. But that would be very costly and probably halve my frame rate.
I just want my color picking scene to be stored in a separate buffer so I only need to redraw it when one of the objects in it actually changes position. This is why I was looking at using one of the stereo or auxiliary buffers to store my scene.
Thanks for your help.
05-02-2007, 06:03 AM
The fast way would be to use FBO for your offscreen rendering :
I don't really know if AUX buffers are actually available nowadays ?
05-02-2007, 09:43 AM
OK, thanks for that. I think it might be the way to go. I'll give it a shot!!
05-02-2007, 08:17 PM
Stereo buffers are supported on pro level cards like the nVidia Quadro.
Now I could simply draw the scene to GL_BACK every time the use moves the mouse, read the values, then clear the buffer and draw my main scene over it. But that would be very costly and probably halve my frame rate. Nah.
You lose some performance but it's not that big.
WITH 2 BUFFERS
With only back buffer
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.