Nicolas Richeton's blog

SWT, LWJGL, MacOS : The Depth Buffer problem in OpenGL

☕️ 1 min read

The Open GL viewer in Sharemedia never worked correctly on Mac, because the opengl depth test was failing : objects were drawn according to the creation order(the latest ones over the oldest ones) whereas they should have been drawn according to their position in the scene (the closest one over the farest ones).

On win32, everything worked as expected, so I suspected a bug on my Macbook video card (Intel GMA950) or in apple drivers.

On win32:

No depth issue

On osx:

Depth issue

I just solved this issue today: SWT/LWJGL has different default values for the creation of the opengl context : a depth buffer is created on win32 and not on osx.

To fix this, create the GLData object this way :

GLData data = new GLData();
data.doubleBuffer = true;
data.depthSize = 1; // Add this line to force a depth buffer

I guess this would solve this problem too :,1858.msg11016.html#msg11016

Now I can say that the OpenGL viewer will work on mac with the next release of Sharemedia.

UPDATE : See Bug 220518