JOGL Occlusion Query

Hello ladies & gentlemen !
I send you this post because I got to implement an occlusion test in a JOGL code for my work.

My machine :

  • Core 2 duo 2.33GHz
  • 2 Go DDR
  • ATI Radeon HD 2400 XT
  • JRE 1.6
  • IE 7 ( JOGL run in an applet )

The occlusion test don’t return anything and my navigator crashe in a very short time…

my source code :

// Rendering loop

        // Occlusion query
        IntBuffer ibFragmentVisible = IntBuffer.allocate( 1 );
        ibFragmentVisible.put( 0 );
        IntBuffer ibQuery = IntBuffer.allocate( 1 );
        gl.glGenQueries( 1, ibQuery );

        gl.glBeginQuery( GL.GL_SAMPLES_PASSED, ibQuery.get( 0 ) );

        // for now, I don't draw anything for the test

        gl.glEndQuery( GL.GL_SAMPLES_PASSED );

        gl.glGetQueryObjectiv( ibQuery.get( 0 ), GL.GL_QUERY_RESULT, ibFragmentVisible );

        gl.glDeleteQueries( 1, ibQuery );

// End of rendering loop

Is the Occlusion query work on JOGL ?
If someone should have a solution, it would be great.
Thanks

               Anthony BASCOULERGUE

did you try the code outside of an applet?
does it crash there too?

I learnt occlusion query with a C++ code, and there wasn’t any problem …
Thanks for your reply.

  Anthony BASCOULERGUE

no, i meant if you could try running the jogl code embedded in a java.awt.Frame and not an applet.

if it still crashes, can you provide the stacktrace?

Salut !
En fait j’ai trouvé : fallait pas mettre de valeur dans le indexBuffer
ibFragmentVisible.put( 0 );
La valeur de la requète se mettait après celle ci et du coup, en lisant la première je retrouvait ma valeur par default

Merci .