Advertisement

Textures Display Order

Started by January 13, 2004 12:18 PM
1 comment, last by Ructions 21 years, 1 month ago
Newbie to opengl.. I have a texture as a background that covers the entire screen. I have another texture which i want to display abou this background. but at the moment it cant be seen how do i get the bottom texture to the top. Any help would be greatful.
Not sure what you''re asking -- clarify? Spelling too
Advertisement
Probably, you''ve drawn the 2nd texture at the same position as, or behind (as seen from the point of view) the first one, so the 2nd one disappears or flickers (stripes of tex1 and tex2). Try drawing the second textured quad (or other primitive) closer to the camera than the first one or disable depth testing (which tests if there is already drawn something to the screen at that depth, or closer, is so, nothing will be drawn) with this code:

glDisable(GL_DEPTH_TEST);

Don''t forget to enable it again or your drawing after this code (even the next frames) will become a bit strange :

glEnable(GL_DEPTH_TEST);

You could also try to set a different depth testing function so it draws too if the depth is equal to the already drawn, not only if it''s less:

glDepthFunc(GL_LEQUAL);

Now, i am not sure this isn''t the deafault value, but it''s worth trying .

TP

This topic is closed to new replies.

Advertisement