hey guys,

when i create and place object "A" for example at (0.0, 0.0, 0.0) and "B" at (0.0, 0.0, -10.0) the second object (B) "appears" to be in front of the first object (A) when the camera is at (0.0,0.0,+50.0) looking at -Z which is wrong because A is in front of B; but when the camera is looking from (+50.0,0.0,0.0) to -X, "A" is correctly located in front of "B".

when i change the order of creating A and B (with same coordinates as above), everything appears the way it should be but i know it shouldnt be like this. any ideas what could have gone wrong in my initialization?? is there anything that i should enable or disable?

i have found the solution. Enabling GL_DEPTH_TEST fixed it.

glEnable( GL_DEPTH_TEST );

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.