Eclipse RCP / SWT / JOGL Rendering Problem

First, I’m new to all this, so please be gentle…

I wrote a simple RCP application which incorporated the JOGL GEARS demo code. It runs fine, but the gears aren’t being rendered correctly. It is most noticable with the green gear (screen shot attached.) I based my code on the Eclipse / JOGL code snippet which has JOGL draw to an SWT GLcanvas: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet209.java?rev=HEAD&content-type=text/vnd.viewcvs-markup

I have tried the code on both Linux and Mac platforms with the same results, but with one exception. I have a Linux system that is using an Xgl enabled desktop and the application works perfectly there :-\

If someone could possible point me in the right direction here I would be very greatfull!

I’m pretty much an JOGL/OpenGL noob myself but I have the feeling this has something to do with depth testing not being turned on or something like that.

What I see in my code is this:

	gl.glEnable(GL.GL_DEPTH_TEST);
	gl.glDepthFunc(GL.GL_LEQUAL);

while your code seems to be missing the glDepthFunc although maybe I just missed it. I’m not even sure it’s necessary but it might explain why it does work on a Xgl display: it is probably already set there because you’re drawing inside another 3D scene.

It turns out that I did have GL_DEPTH_TEST enabled with the default test (GL_LESS). I played around with different test values, but with the same results. Thanks for the suggestion though.

Maybe it runs fine on the Linux XGL system 'cause the defaults are what are good for the app? Which raises the question: what are the values of your GLData class when you pass them to the GLCanvas? While messing around with that has never shown any drastic differences before (then again, I’ve only programmed on Windows with my SWT/JOGL app), it might affect cross-platform code. I dunno. Worth a try eh? ;D

And what happens if you put another glEnable(GL.GL_DEPTH_TEST) and glDepthFun() in the run() of the asyncExec()?