Extending GLCanvas

Hello,

I have an application where the AWT Canvas is extended with functionality to provide a complete 3D viewer. This class is called Canvas3D and has a range of additional methods as well as a database to hold the model.

I would like to complement this software engine with a GL based variant using JoGL.

My initial thought was now to create an interface (CanvasEngine) and a factory (CanvasFactory) to create a CanvasEngine for the program automatically.

There would be a Canvas3DGL variant for the hardware accelerated version. The Canvas3DGL would then extend GLCanvas instead of Canvas. Both variants would implement the interface.

Older posts on this subject (1993) indicate that extending GLCanvas is not an option because the important methods are final. Is this still the case?

If this is not an option, what would you recommend me to do instead to avoid messing up the rest of the program?

Thanks
/Jonas Forssell, Gothenburg, Sweden

I’m not sure what version of JOGL and the docs you’ve got, but my current project (using all the latest JSR 231 stuff) extends GLCanvas and runs like a champ, so I’m inclined to believe that’s an ok way to go. Just have to plug your rendering engine into the GLEventListener way of doing things, and you’re good to go.

-CW

Great to hear.

This will make life so much easier :slight_smile:

/Jonas