• Advertisement

Archived

This topic is now archived and is closed to further replies.

Textures Display Order

This topic is 5156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement