BG texture in ortho perspectives

umm, maybe im not looking in the right spots for information, but is it possible to have a backround texture in an ortho perspective, or rather to make it appear as a backround?

Sure.

Just draw the background (textured) quad near the far clipping plane first. Then draw everything else after it.

You can even disable depth testing while drawing the background (which will make things faster) b/c you know it’s supposed to be behind everything else.

Lemme know if you want an example …

/ec

Would you mind posting that sample, just to
make sure I’m doing it right?? I’m getting
some funky results…

thanks,
Wazoo

For a background, you can also disable depthwrites, and not only depthtest. This way you save even more speed, and then you can draw the quad wherever you like

Some code would probably look something like this.

glMatrixMode(GL_PROJECTION);
glLoadIdentity()
glOrtho(0, 1, 0, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
glBegin(GL_QUAD);
glTexCoord2f(0,0);
glVertex2f(0,0);
glTexCoord2f(1,0);
glVertex2f(1,0);
glTexCoord2f(1,1);
glVertex2f(1,1);
glTexCoord2f(0,1);
glVertex2f(0,1);
glEnd();
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

Maybe you have to tweak the coordinates to get the texture right…

[This message has been edited by Bob (edited 10-19-2000).]

To make it even more faster: You must only clear the depth buffer:

glClear(GL_DEPTH_BUFFER_BIT).

The color buffer is overwritten completely with every frame when you got a background texture.

Kilam.

To speed things up even more draw the background with Z-testing disabled.
glDisable(GL_DEPTH_TEST);