Java OpenGL color material darkens when depth test is disabled?

Since you got no answers so far, I'll try to give it my shot, although I'm really a bit guessing here A few reasons I can imagine, why the effect you see would happen: In contrast to the ambient and diffuse component of the lighting model, the specular component needs to take into account the eye location relative to the object and light source. So this will probably be faster, when OpenGL uses the depth buffer. I assume, that this way - for every pixel to be drawn - it could use the depth value to complete the eye coordinates with the z component Maybe it's also related to light attenuation?

When light attenuation is used, OpenGL calculates the distance, which the light has to travel before reaching your eye (or does it simplify by only calculating the distance between the light and the object? I'm not sure. ) So I assume, that it's not possible to use lighting correctly without a depth buffer.

I think you mentioned in your other post, that you can't just clear the depth buffer, because it would interfere with the rest of the application? I think there should be a solution with stencils, something similar to "Example 10-1 : Using the Stencil Test" in glprogramming.com/red/chapter10.html (it's written in C, but I hope it's similar in JOGL). The stencil would simply bar the remaining application from drawing over your precious pixels.

Since you got no answers so far, I'll try to give it my shot, although I'm really a bit guessing here. A few reasons I can imagine, why the effect you see would happen: In contrast to the ambient and diffuse component of the lighting model, the specular component needs to take into account the eye location relative to the object and light source. So this will probably be faster, when OpenGL uses the depth buffer.

I assume, that this way - for every pixel to be drawn - it could use the depth value to complete the eye coordinates with the z component. Maybe it's also related to light attenuation? When light attenuation is used, OpenGL calculates the distance, which the light has to travel before reaching your eye (or does it simplify by only calculating the distance between the light and the object?

I'm not sure. ) So I assume, that it's not possible to use lighting correctly without a depth buffer. I think you mentioned in your other post, that you can't just clear the depth buffer, because it would interfere with the rest of the application?

I think there should be a solution with stencils, something similar to "Example 10-1 : Using the Stencil Test" in glprogramming.com/red/chapter10.html (it's written in C, but I hope it's similar in JOGL). The stencil would simply bar the remaining application from drawing over your precious pixels.

Thanks, Chris. I think you're right. I was able to work around the problem by actually disabling the depth mask on all the non-selected items and render them last.

This ensures they end up on top. Though I think using the stencil is a better solution. Thanks.

– Jeff Storey Mar 26 '10 at 17:23.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions