HUD help

This question could either be really insanely simple or require some serious OpenGL experience. I am hoping for the former.

I am rendering an object in OpenGL in a similar manner to the 3d model loader example included in the framework. It’s not a model (it’s actually alot simpler) but it still utilizes opengl to get the job done. On top of this rendered object I want to use Open Frameworks to draw a 2d layer of rectangles in order to create an overlay UI. However, when I try to do this, the objects I have rendered in openGL appear above the openframeworks objects. I’ve tried having the code draw the rectangles after the openGL objects, but the 3d stuff is still sitting out in front.

Is there a way I can classify the two groups of objects so that the overlay is always on the top layer?

Thanks for reading,
DC

The way I would create a HUD is as follows:

  • Draw your 3D objects
  • Disable depth testing:
  
glDisable(GL_DEPTH_TEST);  

  • Call ofSetupScreen() if necessary
  • Draw your HUD using the OF 2D graphics functions
  • Enable depth testing:
  
glEnable(GL_DEPTH_TEST);  

Thanks man! It worked perfectly.

DC