it''s still hard for me to understand. I have several quads, let''s say named A1,A2,Ax and a main object named B. I want depth test disabled between A1,A2,Ax object, but enabled for B.
I wrote this routine:
glEnable(GL_DEPTH_TEST);
DrawObject_B();
glDisable(GL_DEPTH_TEST);
DrawObject_A1();
DrawObject_A2();
DrawObject_Ax();
But A1,A2,Ax they always appear in front of B even when they should be hidden. I''m really missing the concept here. Can you help me ?
www.web-discovery.net
penetrator: yes B will be hidden, because : glEnable(GL_DEPTH_TEST); DrawObject_B(); // depth-test enabled : only the "closer" triangles of B are visible glDisable(GL_DEPTH_TEST); DrawObject_A1(); // depth-test disabled : A1 is rendered no matter the depth buffer is, because the depth test is disabled DrawObject_A2(); // idem : A2 is rendered everywhere even if Z is farther DrawObject_Ax(); // idem...
Maybe you want A1, A2 and Ax to test depth but not to WRITE into the depth buffer. That is, the Ax objects may be hidden by objects that were already rendered (B for instance), but Ax objects may not hide other objects (for instance you never want A1 to hide A2). In that case, you don''t have to disable DEPTH TESTING, you have to disable DEPTH WRITING