Re: How to add render object during the animator is running?
Posted by
gouessej on
May 31, 2012; 8:32am
URL: https://forum.jogamp.org/How-to-add-render-object-during-the-animator-is-running-tp4024016p4024291.html
Hi
You should not do this. init() is called once and can be called again if the OpenGL context is destroyed and recreated, you should not have to call it several times to do something else. In my humble opinion, your method display(GLAutoDrawable) should look at your list, check whether the initialization needs to be (re)done and do it if necessary for each object, and display all objects. The initialization should be redone in init only when the OpenGL context is destroyed and recreated.
If you don't want to waste your time in reinventing the wheel, maybe you should use a scenegraph instead of making your own one except for pedagogical purposes.