I’m working on an isometric RPG with JOGL, and I want to be able to make updates to the game world independant of framerate. For instance, I’d want to refresh the screen at least 30 times a second, but I can get away with updating the world every 10th of a second.
The problem, of course, is that when I call GLCanvas.refresh(), I have to wait for an unspecified point in time when GLEventListener.refresh() is called, and as that’s called (I assume) from an external thread, I have no idea what state the world will be in by then.
My current workaround is to use a synchronised ‘gateway’ method to ensure that any world update is complete before I begin an attempt to refresh the screen based on that information. Are there any other solutions you’d reccomend?