Create a GLContext

Started by CodeBunny, June 23, 2011, 20:55:37

Previous topic - Next topic

CodeBunny

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.

Fool Running

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
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

CodeBunny

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.

spasi

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.

CodeBunny


CodeBunny

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?