3D on top of 2D ??

Hello!

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

any help appreciated

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

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:
[b]Hello!

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

any help appreciated[/b]

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

Thanks alot!

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! =)

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 …