Problems with Enabling Depth Testing

Hello,

I have the following code (as part of a much larger project):

        gl.glEnable(GL_DEPTH_TEST);
        if (!gl.glIsEnabled(GL.GL_DEPTH_TEST)) {
            System.out.println("Not Active!");
        }

When I run the project, I get the “Not Active!” messages printed out regularly. Are there any known issues with JOGL and depth testing, because this seems to me to be something which there doesn’t seem to be much I could have got wrong… but those are famous last words.

Gurner.

I’ve never encountered this specific problem, Are you sure you’re not picking a pixelformat which doesn’t actually HAVE a depth buffer ? I vaguely remember on older cards that you couldn’t have a stencil buffer and a depth buffer at the same time, If you requested both then you’d get back a pixelformat with one or the other enabled (although I think it defaulted to a depth buffer).

OTOH I’ve had problems with fullscreen mode, I request a 24 bit depth buffer which works fine in windowed mode, but in fullscreen It seems to give me back a 16 bit buffer so i get polygon artifacting. Don’t know why that is.

D.

maybe i will sound silly but in the code you indicated above you have

 gl.glEnable(GL_DEPTH_TEST); 
  if (!gl.glIsEnabled(GL.GL_DEPTH_TEST)) { 
      System.out.println("Not Active!"); 
  } 

Shouldn’t it be

 gl.glEnable(GL.GL_DEPTH_TEST); 
  if (!gl.glIsEnabled(GL.GL_DEPTH_TEST)) { 
      System.out.println("Not Active!"); 
  } 

I guess it should be more of a typing mistake in the post as normally compiler should notice this kind of error

No, that’s not the problem. I am (somewhat inconsistently) using static imports; like you say my compiler would have picked that up in any case.

I certainly think I have a depth buffer, since this problem seems to present itself only when I am in certain modes of glBlendFunc(…) - however, I am nowhere near my code at the moment, so I can’t actually say which ones it is a problem with.