PDA

View Full Version : Setting texture as background...



guzba
03-19-2003, 02:29 PM
I am using a texture on a square for my background and im wondering how i can make sure everythign else i draw goes on top?

Pops
03-19-2003, 02:52 PM
Can you just make sure its z value is greater (or less, not sure which) than the rest of the objects?

nexusone
03-19-2003, 02:53 PM
Depends on your view setup and settings.

One is to draw things based on the Z axis as far and near. Where +Z is near and -Z is farm draw your background at -Z max based on how it is set in your world.
This reqaires you have depth checking in enabled.

without depth checking you draw from back to front. background then other objects.


Originally posted by guzba:
I am using a texture on a square for my background and im wondering how i can make sure everythign else i draw goes on top?

oliii
03-19-2003, 05:44 PM
you draw it first without enabling depth checking nor depth writing.


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);

drawbackground();

glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

drawscene();