Depth test is not working

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Depth test is not working

falcon_intel
Hi,
I have spent several hours on fixing my depth, unfortunately  I was not able to solve it, here in  the picture you see the result
Can anyone give me any idea of how to fix this bug? I'd be appreciated.
Here is my code, where I called gl.glEnable(GL2.GL_DEPTH_TEST);
in init method
public void init(GLAutoDrawable drawable) {
                // TODO Auto-generated method stub

                final GL2 gl = drawable.getGL().getGL2();

                gl.glShadeModel(GL2.GL_SMOOTH);
       
                gl.glClearColor(1f, 1f, 1f, 1f);
                gl.glClearDepth(1.0f);
                gl.glEnable(GL2.GL_DEPTH_TEST);
                gl.glDepthFunc(GL2.GL_LEQUAL);
                gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);
                GeometricObjects.initlighting(drawable);
        }
*********************************************
Even i tried to call in display function, but did not work out.
public void display(GLAutoDrawable drawable) {
                GL2 gl2 = drawable.getGL().getGL2();
                gl2.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
                gl2.glMatrixMode(GL2.GL_PROJECTION);
                gl2.glEnable(GL2.GL_DEPTH_TEST);
                gl2.glLoadIdentity();

}
**********************
And finally tried to give bits in capability
GLCapabilities capabilities = new GLCapabilities(profile);
                capabilities.setBlueBits(16);
***************************************

How do you think the hardware may matter or another reason here?

Best regards,
Reply | Threaded
Open this post in threaded view
|

Re: Depth test is not working

gouessej
Administrator
Hi

Please test this example. If it works, inject (step by step) your changes until it stops working so that you can find the culprit in your own code, in JOGL itself or in the driver.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Depth test is not working

falcon_intel
Thanks you Julien, for quick response. I checked everything ok, but stilll the problem is not fixed. Can I post all code? Can you please check it for me on your computer? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Depth test is not working

gouessej
Administrator
Hi

What is ok?

Feel free to post the whole code. I can give it a try.
Julien Gouesse | Personal blog | Website