LWJGL Forum

Programming => OpenGL => Topic started by: CodeBunny on June 23, 2011, 20:55:37

Title: Create a GLContext
Post by: CodeBunny on June 23, 2011, 20:55:37
Out of curiosity, is there any way I can create a single GLContext and share it between different AWTGLCanvasses? I'd like to have several different AWTGLCanvases show similar images in different situations, and it seems like it would be most efficient to load all of them into a single context and then just use that for all of them.
Title: Re: Create a GLContext
Post by: Fool Running on June 24, 2011, 12:38:04
I think you create a Display, then call getDrawable() on that and pass that value into the AWTGLCanvas constructor, but I'm not 100% certain of that. :P
Title: Re: Create a GLContext
Post by: CodeBunny on June 24, 2011, 19:27:14
I didn't want to have to deal with the Display.

I was just wondering if it was possible to create an entirely new GLContext in code (like GLContext newContext = new GLContext()), and then use that for different AWTGLCanvasses. It would be useful for me in particular, and I think it would be a good feature in general.
Title: Re: Create a GLContext
Post by: spasi on June 25, 2011, 10:27:36
AWTGLCanvas implements Drawable, so it's just a matter of passing one AWTGLCanvas to the constructor of another AWTGLCanvas. Both canvases will then share GL objects.
Title: Re: Create a GLContext
Post by: CodeBunny on June 25, 2011, 15:00:50
Ah, I see.
Title: Re: Create a GLContext
Post by: CodeBunny on June 27, 2011, 18:07:22
When I try to pass one AWTGLCanvas to the constructor of another, it does not work.

Can you give me an example of what you mean?