Is it possible to create a context without a GLCanvas/GLJPanel/GLWindow?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to create a context without a GLCanvas/GLJPanel/GLWindow?

lixoman100
Hello,

I have an application that currently has a GLCanvas with several viewports. Right now I do some texture work on the init() method of my listener and all is well when rending etc.

I want, however, to change the system so I can have several GLCanvases sharing the same context. My current version works; whenever a GLCanvas has its init() method called, I grab the context and set it to any GLCanvas that already exist and haven't init()'ed yet, and use it for any future canvases that are created.

I feel that this is a bit hacky, though. What I'd like to do is to first create the GLContext so I can use invokeOnOpenGLThread() to build my textures whenever I have the data ready, independent of when I want to create any GLCanvases for these textures. Ideally, I would create the GLContext, build textures on it as I can and, when needing to create GLCanvases, use the GLContext I already have.

I tried using the GLDrawableFactory stuff but I was utterly lost by it. Is it possible to do what I intend to? If so, can anyone give me a few pointers on what direction to follow?

I'm using the latest JOGL version (2.0-rc11)
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to create a context without a GLCanvas/GLJPanel/GLWindow?

gouessej
Administrator
Hi

Please look at our Github repository, there is an example using shared contexts. You have to create a canvas first as far as I know.

Edit.: I advise you to use the latest build instead of the RC11.
Julien Gouesse | Personal blog | Website