PDA

View Full Version : how to display 2d scene on top of 3d scene???



immy
03-24-2002, 05:39 AM
Hi
I wanna display some lines & text(2d graphics) on top of 3d opengl scene. I wanna see the 3d scene at the back so the lines(or 2d graphics i wanna draw) must have transparent background. If u need some more info let me know.
Thanks in advance take care http://www.opengl.org/discussion_boards/ubb/smile.gif

stryx
03-24-2002, 05:46 AM
What about trying this one ?
Masking:
http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg2.htm

or this: http://nehe.gamedev.net/tutorials/lesson20.asp

Masking is a way to put HeadUpDisplay in your OpenGL app/game.

To draw in 2D use the Ortho Mode
described at NeHe in Lesson 21

Well with some other things too.

Hope this helps,

StryX

[This message has been edited by stryx (edited 03-24-2002).]

harryx
03-24-2002, 02:47 PM
Set your camera up for 3d, draw 3d scene
glDisable(GL_DEPTH_TEST)
glDepthMask(0)
Set your camera up for 2d, draw 2d scene
glEnable(GL_DEPTH_TEST)
glDepthMask(1)

and repeat...

nisar
03-26-2002, 03:55 AM
Hello
Pls write to me the full info abt drawing 2d graphics on top of 3d scene as an overlay. I wanna makre an air craft hud view.
Thanks very much http://www.opengl.org/discussion_boards/ubb/smile.gif

harryx
03-26-2002, 04:13 AM
What dont you understand?

If you know how to setup and draw a 3d view, and you know how to setup and draw a 2d view, then all you have to do is draw the 2d stuff after the 3d stuff (with depth test disabled).

There is nothing to it, just use the code above.