Re: Depth buffer not working on Win7-64b?
Posted by
Sven Gothel on
Nov 20, 2010; 5:02am
URL: https://forum.jogamp.org/Depth-buffer-not-working-on-Win7-64b-tp1737435p1934717.html
On Thursday, November 18, 2010 23:28:41 markm [via jogamp] wrote:
>
> ...for those whose only option is an Intel graphics chip, the following might be useful:
> After having this exact problem on my rather old laptop, it turned out that the GLCapabilities object I was using to create my GLCanvas was asking for a 24-bit depth buffer:
>
> GLProfile profile = GLProfile.get(GLProfile.GL2);
> GLCapabilities capabilities = new GLCapabilities(profile);
> System.out.println("caps: " + capabilities.getDepthBits()); // Returns 24
>
> Now I'm assuming that my graphics chip can't fulfil this request, because later when I come to query the actual depth buffer size, it's zero...
>
> public void init(GLAutoDrawable drawable) {
> ...
> GL2 gl2 = drawable.getGL().getGL2();
> IntBuffer buff = IntBuffer.allocate(1);
> gl2.glGetIntegerv(GL2.GL_DEPTH_BITS,buff);
> System.out.println("Depth buffer: " + buff.get(0)); // Prints 0; oops, our depth buffer looks a little shallow...
> ...
> }
>
> I was able to work around this on my system by changing the depth requested by the GLCapabilities:
>
> capabilities.setDepthBits(16); // Gears now render correctly!
>
> I'm not yet sure as to the ideal way to incorporate this workaround in my code; it'd be nice if I could find out in advance the best non-zero depth buffer value to ask for. But for the moment this seems to work. Hope it's useful to someone.
Thats a very good one!
I guess we should lower the level to 16 as the min requirement.
The highest available will be picked up anyways.
~Sven