View Full Version : Can't access java drawable object outside of 4 fns

03-23-2010, 10:51 AM
In java, how do I access the GLAutoDrawable object "drawable" outside of the functions "init(...)", "reshape(...)", "display(...)" and "displayChanged(...)". I am using the Netbeans OpenGL Pack in windows, but anyone who knows JOGL should be able to answer this (I hope).

Reason: At various points of my application I want to load images into display lists from file and not only when OpenGL is initialised using init(...). It is possible that I could find a way for it to be handled during the display function but that seems clumsy to me. In C/C++ nothing was hidden so I could build my display lists from any part of my program. I want to do the same here.

03-23-2010, 01:11 PM
No idea how the NetBeans OpenGL pack works, but what about storing the drawable passed to init() into a member object, thus easily accessible from other places ?

class MyClass

// initialized after init()
GLAutoDrawable myDrawable=null;

init (...) {
this.myDrawable = drawable;