Bad performance with JOGL and direct buffers

David Daney ddaney@avtrex.com
Fri Nov 9 22:37:00 GMT 2007


Stefan Krause wrote:
> I recently tried to compile a small JOGL demo with GCJ. I had to use SWT 
> because GCJ would throw an exception  with AWT and JOGL 1.1 (Exception 
> in thread "main" java.lang.IllegalArgumentException: 
> GLDrawableFactory.chooseGraphicsConfiguration() was not used when 
> creating this Component
>   at 
> com.sun.opengl.impl.x11.X11GLDrawableFactory.getGLDrawable(jogl.jar.so)) 
> - but never mind, the SWT version is faster on Ubuntu Linux anyways.
> 
> The GCJ compiled demo runs okay with SWT and JOGL, but the performance 
> isn't quite as good as with Sun's JDK 6. The performance is something 
> like 128 FPS for GCJ and 200 FPS for JDK 6. When I remove only the 
> OpenGL calls from the render loop the performance for both JDK 6 and GCJ 
> is equal. It even seems as if all methods except gl.glDrawRangeElements 
> do not slow GCJ down. I'm using OpenGL Vertex Buffer Objects with direct 
> buffers. The buffers passed to glDrawRangeElements are (many) IntBuffers 
> each created like that:
>        ByteBuffer bb = ByteBuffer.allocateDirect(byteCount);
>        bb.order(ByteOrder.nativeOrder());
>       IntBuffer ib = bb.asIntBuffer();
> 
> Before starting further investigations: Does anyone have an idea what 
> might slow GCJ that much down? I don't think GCJ adds that much of JNI 
> overhead (since the empty render loop is equally fast). Are there any 
> known GCJ performance problems / pitfalls with direct buffers?
> 

Perhaps related to this:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27982

David Daney



More information about the Java mailing list