View Full Version : [SOLVED] HUD overlay
12-21-2011, 05:39 AM
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.
12-21-2011, 05:51 AM
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.
12-21-2011, 06:37 AM
Figured it out, I'll post my code here so others can learn from my troubles :-)
mGL.glOrtho(0, 1, 0, 1, -1.0f, 1.0f);
// DRAWING CODE GOES HERE, REPLACE WITH YOUR OWN
mGL.glScaled(0.0005, 0.0005, 0.0005 );
mGL.glTranslated( 975, 1250, 0 );
// END OF DRAWING CODE -----------------------
Thx for helping out!
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.