OpenGL GUI

  • Follow


I'm creating a OpenGL library that should be able to handle complex 2D
GUI's. The GUI will be rendered on top of a 3D scene, which obviously
would be repainted each frame. It would be nice if the GUI could be
alpha transparent. I want to minimize the number of OpenGL calls
performed each frame, so optimally only the parts that changed in the
GUI should be repainted. This is a common optimization in all GUI
libraries. How can I do this with OpenGL? Would using a pixel buffer
solve the problem? Is there a way clear only the 3D scene each frame
(for example clear everything where z > 1)?

Thanks in advance!

/Jesper Nordenberg
0
Reply megagurka 12/16/2004 8:02:48 PM

 As allways in life, you can choose different approaches.
using the stencil buffer to keep some part of the screen untouched
(space-ship cockpit, or you GUI) is a common practice.
 OpenGL supports different viewports. Assuming you have a menu at the top
(or left, or right, or bottom), you can use two viewports, one for the GUI
and the other for the 3d-scenery (glViewport).
 But keep in mind, when using glClearBuffer the whole buffer is cleared
regardless of you viewport settings.

 If you want a transparent GUI menu on top of a 3d scenery (common speaking:
a HUD - head up display), then you can't take advantage of viewports or
stencil buffers. But rendering the GUI into a texture and use glSubTexture
to replace only parts of your GUI is the best practice.

 google for the mention topics, if you have any further questions, don't
hesitate to ask again.

 regards,
   godfired

Jesper Nordenberg wrote:

> I'm creating a OpenGL library that should be able to handle complex 2D
> GUI's. The GUI will be rendered on top of a 3D scene, which obviously
> would be repainted each frame. It would be nice if the GUI could be
> alpha transparent. I want to minimize the number of OpenGL calls
> performed each frame, so optimally only the parts that changed in the
> GUI should be repainted. This is a common optimization in all GUI
> libraries. How can I do this with OpenGL? Would using a pixel buffer
> solve the problem? Is there a way clear only the 3D scene each frame
> (for example clear everything where z > 1)?
> 
> Thanks in advance!
> 
> /Jesper Nordenberg

_______________________________
remove the _ for reply.
0
Reply Gottfried 12/17/2004 3:04:18 PM


1 Replies
187 Views

(page loaded in 0.041 seconds)

Similiar Articles:













7/10/2012 7:22:45 AM


Reply: