PDA

View Full Version : Double Buffer doubt



marcelogsouza
08-08-2003, 08:30 AM
Is it possible to draw on the buffer that is being shown, or do I need always to swap the buffers to show the image?

I want to use it to make selection windows (using xor).

thanks and best regards,

Marcelo

Obli
08-08-2003, 08:41 AM
No, I am quite sure there's a GL call that is something like

glDrawBuffer(GL_FRONT);

If I am right this will make GL render to front buffer directly, giving you a thing like single-buffered windows.

I have not understood how do you plan to use it however, I guess it was just a curiosity.

EDIT: whoops, wrong enum.

[This message has been edited by Obli (edited 08-08-2003).]

nexusone
08-08-2003, 10:59 AM
It is posible, it would be treated like a bitmapped image.

The only problem is that the image must be static, you could not have any animation going on.

But if you want a 3D selection then you have to redraw the scene with the selected object
highlighted. So swap buffers is needed to make it look smooth.

I am think that you will need to keep swaping buffers and stuff.


Originally posted by marcelogsouza:
Is it possible to draw on the buffer that is being shown, or do I need always to swap the buffers to show the image?

I want to use it to make selection windows (using xor).

thanks and best regards,

Marcelo

Orzech
08-09-2003, 03:30 AM
Recently I was also doing some kind of selection. Unfortunately I've encountered some problems. I am not sure but it also sounds like some double buffer thing. This is what I wanted to do :
1) Draw "selection" scene. Each qube has its own color.
2) Check which color is under mouse pointer (glReadPixels)
3) Draw "real" scene
4) SwapBuffers()
I suppose that this method is incorrect since I get some crazy results! The whole scene is static but even in a point where a screen is black glReadPixels tells that there is some color and everything is wrong. Is it also something about buffers?

PS. Sorry for interrupting the post... http://www.opengl.org/discussion_boards/ubb/smile.gif

nexusone
08-09-2003, 04:06 AM
Nehe has a good tutor on picking(selecting) 3D objects, lesson 32 or 33 if I remember correctly.


Originally posted by Orzech:
Recently I was also doing some kind of selection. Unfortunately I've encountered some problems. I am not sure but it also sounds like some double buffer thing. This is what I wanted to do :
1) Draw "selection" scene. Each qube has its own color.
2) Check which color is under mouse pointer (glReadPixels)
3) Draw "real" scene
4) SwapBuffers()
I suppose that this method is incorrect since I get some crazy results! The whole scene is static but even in a point where a screen is black glReadPixels tells that there is some color and everything is wrong. Is it also something about buffers?

PS. Sorry for interrupting the post... http://www.opengl.org/discussion_boards/ubb/smile.gif

Orzech
08-09-2003, 10:17 AM
Originally posted by nexusone:
Nehe has a good tutor on picking(selecting) 3D objects, lesson 32 or 33 if I remember correctly.

Yeah I know. Thanks but I didn't ask about it.