troubleshooting Question

JOGL's GLCanvas swapBuffer() is really slow... need speed up

Avatar of Cheney
Cheney asked on
Game ProgrammingJava
2 Comments1 Solution2000 ViewsLast Modified:
I'm trying to put together a simple game in Java with jogl. I'm using GLCanvas on a JFrame.

My main class implements GLEventListener and does all the game logic and rendering in the overriden GLEventListener's display() method, the listener is registered with the GLCanvas. There is an infinate loop that repeatly calls display() on the GLCanvas instance.

All the rendering works fine, the problem is that no matter how may quads I'm drawing (even doing nothing in the display() method) I can never pass about 70fps.

If I call mCanvas.setAutoSwapBufferMode(false), I get massive frame rates (~1000fps) but no automatic render. So I call swapBuffers myself - rendering works again but the frame rate drops to ~70fps again.

Seems to me that swapping the buffers should be relativily fast, compared to the actual compositing of the back buffer anyway. In other games I've made (C++/OpenGL/Direct3D) swapping the buffers has taken less than 1ms. Here I'm seeing about 15ms.

I guess I've set up JOGL or the GLCanvas wrong but can't figure it out.

Anyone come across this already?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros