is referencing GL object from other objects bad/innefficient?

i’m working on a simple testbed utilizing JOGL. right now i have an object called Renderer which handles GL’s init(), display(), reshape() calls. i can see into the future of my project that the display() call will become quite complex. i know i can create another object to actually make all of these calls as in:

public void display(GLAutoDrawable drawable) { myObjectThatFiguresOutWhatToDrawAndHow.sendOpenGLCommandStream(); }

where sendOpenGLCommandStream() simply encapsulates calls like glRotatef(), glutSolidCube(), glPushMatrix(), etc.

but, is this innefficient? do large JOGL or OpenGL apps have extremely long display() functions, or what? i’ve tested it at a small level with no performance hit, but i’m not sure how it would fare in a fully busy complex app.

thx in advance for any help…

You definitely should factor your display() call into multiple objects with differing behavior. HotSpot and other modern JVMs will inline method bodies appropriately to make the dispatch overhead go away just as with normal (non-OpenGL) Java programs.

fantastic. thank you ken.