PDA

View Full Version : Calculate lower left corner



Stonator
05-08-2001, 10:03 PM
Hi,
How could I calculate the lower left corner of the screen so that i could use it with glRasterPos3i(x, y, any depth);
I want to draw a fullscreen Bitmap, so i must put the RasterPos on the lower left corner, at any depth.

ffish
05-08-2001, 11:39 PM
Are you trying to do something like this?:




Draw3DStuffWithOldModelviewMatrix();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(0.0f, (GLfloat)screen_width, 0.0f, (GLfloat)screen_height, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
DrawBitmapAndOther2DStuff();


or do you want to draw your bitmap with a specific 3D orientation? If so, keep track of your current matrix as you go so you know where (0, 0) is. Alternatively (bad idea coming up), use glGet to give you the current GL_MODELVIEW_MATRIX but my advice is only do that for a last resort (very slow). It's best to keep track of your matrix yourself if possible.

The best solution would be to draw the bitmap as a textured quad that fills the screen. Can you do that with your bitmap? That will be much faster than glRasterPos and glDrawPixels or glBitmap (I think, anyway - don't know much about glBitmap). That's what I'd do.

Hope that helps

[This message has been edited by ffish (edited 05-09-2001).]