Login  Register

Re: Some issues using NEWT

Posted by ac on Mar 15, 2012; 7:17pm
URL: https://forum.jogamp.org/Some-issues-using-NEWT-tp3757230p3829759.html

Hey guys, I was away working on other projects so couldn't go back to this thread until now.

I found a way of removing the framerate capping that occurs on OSX when adding the canvas object to an AWT applet.

I realized that in the swapBuffers() method from the NSOpenGLImpl class (MacOSXCGLContext.java), there is this call:

CGL.waitUntilNSOpenGLLayerIsReady(nsOpenGLLayer, 16);

where the timeout to trigger a new draw is hardcoded to 16ms, which corresponds to a refresh rate of 60Mhz.

Even if the swap interval is set to 0 in order to disable v-sync, the refresh rate continues to be dictated by waitUntilNSOpenGLLayerIsReady() and its timeout argument. By changing the timeout to a smaller value, say 4, I can finally set my own higher framerates from the application. I eventually added some additional changes to the setSwapInterval() method also in NSOpenGLImpl, so that the correct v-sync timeout value is chosen depending on the swap interval. I will upload the patch to the bug report I opened earlier, with some further suggestions.

I will look at jogl on Android in the next few days.

Andres