PDA

View Full Version : Picture in background



fortikur
11-30-2002, 06:18 AM
I want to display a moving, rotating world in front of a non-moving bitmap background.
I tried glDrawPixels(), but it is extremely slow. It has made of a 20 fps scene a 0.5-1 fps one. I can't use glBitmap() because I use a 24 bit .bmp file for the background. As far as I know, glBitmap() is only for b/w bitmaps.
I can't use a textured 'QUADS' as a background, because gluLookat() always changes.
If You don't understand this question, just think of ResidentEvil like games...

Does anyone know a fast way to display a non-moving background?

Bob
11-30-2002, 06:41 AM
I can't use a textured 'QUADS' as a background, because gluLookat() always changes.

True, but what stops you from drawing the quad before you use gluLookAt?

Actually, a textured quad is THE way to do it. At the point where you need to draw the background, preferably instead of glClear, do something like this.



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

glBindTexture(...);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f(-1, -1, 1);
glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
glTexCoord2f(1, 0); glVertex3f( 1, -1, 1);
glEnd();

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

ashaman
11-30-2002, 08:54 AM
I have a similar question about background images.

I want to draw a background that will rotate freely around the Z-axis. I assume this would be best done with a textured quad as well, but how do I know what size to make it, and how far back do I translate the quad?