opengl texture issue

Started by
5 comments, last by dantheman1337 14 years, 1 month ago
sorry i didnt know whether to ask this in graphics specifically because its also game programming. anyway, im programming a 3-d game with c++ and opengl. I came across a problem. if i have a polygon with a texture applied, and i have a second polygon with the same x and y values, or around the same values, with a different z value, i can see through the closest polygon and view the other polygon. is there a way to solve this? help would be appreciated.
Advertisement
This sounds like a z-fighting problem. Need more of a description though as to what your problem is.

------------------------------

redwoodpixel.com

okay so lets say i have a textured square. this is texture 1. then i have one behind it. if the second texture is drawn to the screen last, no matter where it is, texture 2 will show through texture 1. so in other words, texture 1 becomes a window instead a solid.



its weird. i dont know how to fix it. if you need me to explain more ill try again
You need to enable depth buffering.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

thanks i'll give it a shot
it didnt work. i used this call


glEnable(GL_DEPTH_TEST);



i did research and was also enabled



glDepthMask(GL_TRUE);


which didnt work as well.



i'll giv screen shots. brb
Nevermind! i fixed it. i needed to apply GLUT_DEPTH in the display mode. thanks for the help everyone. sorry about posting this in the wrong area. im as you might say a newb lol.

This topic is closed to new replies.

Advertisement