PDA

View Full Version : 3D on top of 2D ??



SBSlayer
09-15-2002, 06:36 AM
Hello!

Please help me, can somebody explain/show how to render a 3D objects(persp) ON TOP of 2D stuff(ortho) ?

any help appreciated

tinak
09-15-2002, 11:24 AM
Theoretically you can set up different viewports and set them up as different views - 1 ortho and the other perspective. I've done this with separate views but not on top of each other.

I used the glScissor command but you may be able to get the same effect without it from what I have read on some forums.

Tina

nexusone
09-15-2002, 02:48 PM
You can render first in ortho mode then switch to perspective mode and render again.

example:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D( -5.0, 5.0, 5.0, -5.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

draw_2D_stuff();


glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, 1, 1.0, 50.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

draw_3D_stuff();


Originally posted by SBSlayer:
Hello!

Please help me, can somebody explain/show how to render a 3D objects(persp) ON TOP of 2D stuff(ortho) ?

any help appreciated



[This message has been edited by nexusone (edited 09-15-2002).]

SBSlayer
09-15-2002, 09:43 PM
Thanks alot!

xenovore
09-19-2002, 11:36 AM
Keep in mind that while orthographic projection is great for 2D stuff, it's still a *3D* projection. Everything that you can do in a perspective projection you can do in an orthographic projection. This includes use of the Z-buffer. I'd make sure you turn it off before doing any 2D stuff, since any 3D afterwards may not render because it's behind the 2D stuff you just did.

Hope that made sense! =)

jubei_GL
09-19-2002, 02:58 PM
well I did 2D on top of 3D ... First I rendered the 3D stuff, than I seved the 3D view, did some 2D drawing, and Popped 3D again ..