You're right but if he kept this reference passed to the constructor to render the VBO, it would be unsafe.
That was never an issue. I made sure to read documentation thoroughly before doing something.
https://jogl.dev.java.net/nonav/source/browse/*checkout*/jogl/doc/userguide/index.html?rev=HEAD&content-type=text/html
Under the section "Writing a GLEventListener":
Quote
It is strongly recommended that applications always refetch the GL object out of the GLAutoDrawable upon each call to the init(), display() and reshape() methods and pass the GL object down on the stack to any drawing routines, as opposed to storing the GL in a field and referencing it from there.
Sample init code:
| 1 2 3 4 5 | public void init(GLAutoDrawable drawable) { |
Render code:
| 1 2 3 4 5 6 | public void display(GLAutoDrawable drawable) { |
OP:
If I need to initialise a new object within the game, I use an existing renderable item (I load up everything in the first shot) and change it's properties. For instance, properties of shaders can be changed like:
| 1 2 3 4 5 6 7 8 9 | public void enable(GL gl) { |
On the other hand if you wish to pass new geometry it would be worth looking into various data structures and patterns (The state pattern looks suited to this) depending on your existing design.






