From: <jen...@ag...> - 2003-05-12 08:33:16
|
Hi Pepijn, hi ng, i'm followed your discussions about extending gl4java to the future since i'm using gl4java now for more than a year. The extension mechanism you've described should be the right way. Anyway maybe it makes sense to not redefine the init(...)-methods because as you know there is a difference in the init()-methods coming from the subclassing model and the GLEventListener model. in GLCanvas: init() just without arguments in GLEventListener: init(GLDrawable) What you think about something like this: preGLinit() -- former preInit() in GLCanvas postGLinit(GLContext) -- for the extension instanciation you've described GLCanvas.init()/GLEventListener.init(GLDrawable) left untouched for backward compatibility regards, Jens ----- Original Message ----- From: "Pepijn Van Eeckhoudt" <pep...@lu...> To: <gl4...@li...> Sent: Sunday, May 11, 2003 12:09 PM Subject: [gl4java-usergroup] OpenGL Extensions > I've been trying to come up with a clean mechanism to handle extensions > in OpenGL. The current solution is to throw all methods and tokens > (core OpenGL and extensions) into one big class. This leaves you with a > class that has many methods that simply do nothing. I'm hoping we can > do better than this. > The best solution I've been able to come up with is the following: > - We keep the GLFunc class but it only contains the core OpenGL > functions and tokens > - For each extension we provide a class that contais the necessary > methods and tokens. This extension class can then be loaded if a user > needs it. I've made a dummy example for the vertex program extension > (not 100% correct, but it's a good illustration. > If this is the way to go it might be a good idea to do the same loading > type mechanism for the core functions as well, for consistency's sake. > You're application would then be responsible for creating an instance > of GL, GLU, and any other extension objects and maintaining them. This > would have to be done in the init method, because the GLContext object > must already have been created. > > Example: > private GL gl; > private GLU glu; > private ARBVertexProgram vertProg; > > public void init(GLDrawable gld) { > GLContext context = gld.getContext(); > gl = GL.createNewInstance(context); > glu = GLU.createNewInstance(context); > vertProg = ARBVertexProgram.loadExtension(context); > } > > I would love to here some other ideas and feedback about this. > > Pepijn > > P.S. Maybe we should move our development discussions to the devel > list... > Alex: sorry I ended up playing Metroid Prime all night. Damn Nintendo :) > |