Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared GL Context between AWTGLCanvas possible? #16

Closed
hageldave opened this issue Jun 11, 2019 · 6 comments
Closed

Shared GL Context between AWTGLCanvas possible? #16

hageldave opened this issue Jun 11, 2019 · 6 comments
Labels

Comments

@hageldave
Copy link
Contributor

Hi,
Currently every AWTGLCanvas instances have their own GL context.
Because of this, I cannot share GL objects between them, e.g. I have to create the same texture for every Canvas separately, and more importantly keep track of the objects membership to the corresponding canvas and also delete them when destroying the respective canvas (even though I'm not sure whether the GL objects are deleted upon context destruction).

Is it possible that every AWTGLCanvas uses the same GL context so that objects can be shared easily between them?
What are the benefits of having separate contexts?

@hageldave
Copy link
Contributor Author

Ah of course the befit is being able to have different frame buffer configurations for each.
In my case this is unimportant as I'm using FBOs as render targets, but I see that this feature cannot be compromised just like that.

Maybe there could be shared context versions of the PlatformGLCanvas implementations where the first instance creates a static shared context?

Or maybe have an AWTGLCanvas constructor that has AWTGLCanvas as argument which would result in the canvases to share their context?

@httpdigest
Copy link
Member

Just set GLData.shareContext when creating a new AWTGLCanvas. The new canvas will then build a WGL/GLX share group with the given context.

@hageldave
Copy link
Contributor Author

nice!!

@hageldave
Copy link
Contributor Author

I see that this feature is currently windows exclusive as the attribs.shareContext field is nowhere used in PlatformLinuxGLCanvas.
Alright lets see what we can do about it...

@hageldave
Copy link
Contributor Author

Are you planning on supporting this on Linux as well?

@hageldave
Copy link
Contributor Author

Done as of #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants