Jogl Newb Design-Question

If i got some classes. let’s say there is a triangle-class and a quad-class etc, and they can build/draw themselves, . Wouldn’t it be quite useful to implement a singleton for the GL-object, so that i don’t have to worry about a gl-member anymore.

Or would this solution be create some bad side-effects with jogl?

tia && regards
titoH

The Singleton Pattern as such is considered to be (widespread) bad practice, because it is inherent sideeffect producing. Passing the gl instance in JOGL is by intend and trying to bypass it is not encouraged. If you want to create classes, that can draw itself, just make your draw()-Method take a gl argument.

Well, i also thought so, so i tried it, at the moment it works perfectly well, but you’ll never know. I will remove the changes, thank you for answering.

titoH