3D+2D

What is the best way to overlay a 2D picture over a 3D graphics world. ie only the 3D world changes when the camera is moved?

Thanks in advance.

the easyest way to do this would be to have ur 2d art as a texture and place that over a quad or any shape needed.

now u could either place code to draw this at the toc of ur display method in which case it will not be affected by any transformation calls later or u can place it anywhere in the display method if u use the glPopMatrix() and glPushMatrix() calls and place your quad in between these 2 calls this will stop any previouse transformations to effect the quad.

or u could draw your 3d world first the use glLoadIdentity() and then draw the quad

Zee

How efficient would that be? This 2D art is pretty trivial so the less time the machine spends on the 2D… Although I’m have some fairly decent experience with 3D engines I’m new to Open GL which leads me to another question. How does this viewport thing work (not transformations) I hear it is possible to have multiple in the same window. How is this possible and what are the limitations of this? The 2D art is seperate from the 3D. Would it be possible to put the 2D stuff on one viewport and have the 3D occupy the other viewport?

Thanks for your time…

Hello,

er, overlay planes, you mean? That’d work, but only if your window manager supports overlays. There is nothing stopping you from changing projection matricies, btw. You don’t HAVE to commit to a single projection matrix:

glMatrixMode(GL_PROJECTION);
glLoadIdenity();
gluPerpsective(…);
glMatrixMode(GL_MODELVIEW);

/* 3d stuff */
glutSolidTeapot(…);

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(…);
glMatrixMode(GL_MODELVIEW);

/* 2d stuff */
glRasterPos2i(…);
glDrawPixels(…);

glMatrixMode(GL_PROJECTION_MATRIX);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);

/* back to 3D */

and so on.

cheers,
John

Holy dumb question Batman…

A little trip to the library and some books goes a long way eh?

Thanks for the info.

regards