Reputation: 1148
I'm working on a 3d game in JOGL with my project group. we're countering a performance issues. Our game runs at 20 frames per second or less.
We measured the excecution time of the main display function. It turned out to be 4 miliseconds which is good. But, when we measured the time between two display calls it turned out to be 60 miliseconds.
So the question is. What happens between two display calls in Opengl?
thanks in advance
Upvotes: 1
Views: 524
Reputation: 4066
I agree with xranby but you don't give enough information about your project.
If you call Thread.sleep() in the wrong place, it can cause problems of synchronization with the GPU and ruin your performance.
If you leave the auto swap buffer mode on and uselessly swap your buffers manually, it can ruin your performance too.
If you try to make your OpenGL current whereas it's not necessary, it can ruin your performance too.
Have you enabled v-sync? Do you use FPSAnimator?
Upvotes: 1
Reputation: 596
If JOGL is used in combination with AWT by using a GLCanvas then rendering is blocked while the AWT Event Dispatch Thread perform input and 2D rendering.
If JOGL is used in combination with AWT by using a GLJPanel then rendering is blocked while the AWT Event Dispatch Thread perform input and 2D rendering + extra time is spent performing data copys from GPU graphics memory into Java2D CPU memory.
The JOGL recommendation is to use a NEWT GLWindow directly. NEWT is JOGL’s High Performance Native Windowing Toolkit. NEWT performs input in parallel to the OpenGL rendering. High performance rendering is achieved without being blocked by input events or vice versa. http://jogamp.org/jogl/doc/NEWT-Overview.html
Upvotes: 6