Login  Register

Setting render loop without using FPSAnimator

Posted by sasmaster on Jun 05, 2012; 7:49am
URL: https://forum.jogamp.org/Setting-render-loop-without-using-FPSAnimator-tp4025143.html

Hi All. I am not a Java or JOGL pro and come from other languages .What I see here in most of the demos is that the GLCanvas
is passed to the animator  and the init() method if the main class that implements GLEventListener is triggered only after the animator starts .This pipeline creates some restrictions like that I need to wait for the GL3 context to be made in that method .I tried to call init () explicitly without using animator and the context is invalid .My problem here is that I have a Main.java which doesn't implement GLEventListener but  serves only as an entry point for the app.Then I have another class which does implement GLEventListener  called View3d.So I want to init() the  View3D in the Main.java without using any animator and then just add a render loop like this :

while (true){
   view.render()
}

Currently if I add any GL calls after I start the animator the context is still not created .It seems like even when animator.start() is called  the call to init() of View doesn't happen immediately and any code fallowing the animator.start() is executed  . Is it asynchronous ? Or happens on separate thread ?  I mean in C++ it is synchronous and  procedural and I really have a hard time with all this init process in Java .

Thanks for help.