Login  Register

Re: Setting render loop without using FPSAnimator

Posted by gouessej on Jun 05, 2012; 2:54pm
URL: https://forum.jogamp.org/Setting-render-loop-without-using-FPSAnimator-tp4025143p4025149.html

We don't impose its use. For example, I implemented the support of JOGL 2.0 in Ardor3D and it does not use any animator as far as I know.

We don't encapsulate everything into a Display class because it is a limited approach. Our competitor will have to modify its public API in its third major version to support some things already supported in JOGL 2.0. Therefore, the good choice has been done for JOGL.

Why do you see that as a constraint? When you use an animator, you avoid some problems. When you don't do it, you have to handle these problems by yourself. For example, under some operating systems with weak drivers, you cannot create the context and perform OpenGL calls on different threads, you have to do it on the same one. If you don't use any animator, you will have to take care of the thread(s) you use to do that. I wasted several weeks on a bug caused by this behaviour, it was not reproducible on my computer. Do you imagine how much time a newbie would waste on such a problem?

I don't see what is wrong. We do something similar in Java3D, Xith3D, JMonkeyEngine and Ardor3D. Maybe look at our source code. You need to perform OpenGL calls in each "view" to setup the matrices, the viewport, etc... What is a View3D in your case? Is it just a GLCanvas? Now I see what you mean, you want to avoid putting OpenGL calls everywhere, especially in Main.

Edit.: Don't focus on your loop. Your Main class should work fine without it anyway.

Edit.2: You can use final methods and choose an appropriate visibility to avoid exposing all JOGL calls.

Edit.3: Look at how FrameHandler works in Ardor3D. It allows to do what you're trying to do.
Julien Gouesse | Personal blog | Website