[SOLVED] HUD overlay

Hey guys

I have a 3D scene that displays the movements of some logged camera. Works fine, I like what I see. Now I want to make an overlay (200x150) in the top left corner of my screen (600x600) that actually shows what the camera sees in the scene.

How do I do this? I’m guessing I need to use GL_Projection instead of GL_ModelView, but I can’t get it to work. The code I have now removes the 3D scene and replaces it with my overlay, which is not what I want, obv.

Thx

Hi,
The thing you want to do is simple to do. If the camera uses the same projection matrix, you can simply render the scene from the camera’s point of view into an FBO. Then simply render the FBO rendering on a quad on screen by using orthographic projection. You will push and pop the modelview and projection matrices. Refer to this tutorial which renders text on screen. You can replace the text rendering by a textured quad displaying your FBO result.
http://www.lighthouse3d.com/tutorials/glut-tutorial/bitmap-fonts-and-orthogonal-projections/

Figured it out, I’ll post my code here so others can learn from my troubles :slight_smile:


mGL.glMatrixMode(GL.GL_PROJECTION);
		mGL.glPushMatrix();
		mGL.glLoadIdentity();
		
		mGL.glOrtho(0, 1, 0, 1, -1.0f, 1.0f);
		
		mGL.glMatrixMode(GL.GL_MODELVIEW);
		mGL.glPushMatrix();
		mGL.glLoadIdentity();

		mGL.glPushAttrib(GL.GL_DEPTH_TEST);
		mGL.glDisable(GL.GL_DEPTH_TEST);
		mGL.glRasterPos2d(10,10);
		
		// DRAWING CODE GOES HERE, REPLACE WITH YOUR OWN

		mGL.glScaled(0.0005, 0.0005, 0.0005 );
		mGL.glPushMatrix();
		{
			mGL.glTranslated( 975, 1250, 0 );
			mGL.glPushMatrix();
			{
				drawWall();
				drawLEDs();
			}
			mGL.glPopMatrix();
		}
		mGL.glPopMatrix();
		
		// END OF DRAWING CODE -----------------------
		
		mGL.glPopAttrib();

		mGL.glMatrixMode(GL.GL_MODELVIEW);
		mGL.glPopMatrix();

		mGL.glMatrixMode(GL.GL_PROJECTION);
		mGL.glPopMatrix();

Thx for helping out!