JOGL Hogging Resources

Hi. I am having some problems with JOGL hogging resources. When running my app everything else starts running reeeaaaally slowly.

Application useage according to taskmanager is only:
24% CPU
24MB memory (1gig available)

I notice if I introduce a sleep into my display() loop things run much faster:

try{Thread.sleep(10);}
catch (Exception e) {}

There isnt a noticeable performance drop from the application. Should I need to do this? I’m sure there must be a better way?

Another thing I notice is if I am running FRAPS (a framerate utility - google search for ino) everything is responsive with or without the sleep, and the framerate is 85 regardless.

Any ideas?

I stuck together a quick fps counter inside my program and it runs 85fps without the sleep and around 85 with (although drops to 75 range quite often). I can only guess its something to do with the display call being attempted too early and then blocking?? I am new to JOGL and no little :)!

How can I stop this? How exactly does Animator control the display calls?

I don’t know about the resource hogging part, but when you said that your FPS is maxing out at 85, that tells me that your vsync is turned on in your video card driver util. If it is on, it will force the FPS to match that of the refresh rate of your monitor. Just go into your video card driver util, there is typically an OpenGL tab that would have the vsync attribute, or a global setting. Either turn it off, or set it to application controlled.

It is turned off and it does it anyway. I assumed it wa JOGL enforcing the fps. There is no point having the fps faster than the screen refresh rate anyway so thats not a problem, just trying to fix this damn resource hogging.

Well, I can definately see times when you may want the vsync turned off. Let’s say you’re using the Animator class, that means the display() method is only getting called 85 times per second, but if your machine can handle a lot more than that you may want to use that time to perform other calculations, such as A.I.

You might want to use the FPSAnimator class to manage your fps. I think the Animator class tries to call display rather relentlessly, and setting your fps to a conservative number might allow your resources to be handled better.

You can check out FPSAnimator here:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1074587438;start=3#3

[quote]Well, I can definately see times when you may want the vsync turned off. Let’s say you’re using the Animator class, that means the display() method is only getting called 85 times per second, but if your machine can handle a lot more than that you may want to use that time to perform other calculations, such as A.I.
[/quote]
It would seem something is causing vsync. Its definately not the graphics card settings. I think its probably either the animator class or swing?? Any ideas?? ps: does it on other graphics cards so it isnt a bug with my drivers.

FAO logic:
Have you got the other files needed to use that class? It wont compile with ExceptionHandler.class (and maybe more but thats the first one it finds when I try and compile).

downloaded a newer JOGL and its no longer hogging. still seems to be enforcing vsync though.

Try:


public interface ExceptionHandler {
    void handleException(Exception e);
}