-
Notifications
You must be signed in to change notification settings - Fork 779
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
OpenGL 3 context sharing is broken #631
Comments
I added a comment to your commit. Is the VAO all that is needed to enable context sharing? I would rather have nvgAddGlContext/nvgRemoveGlContext that sets up the VAO for the nvg+GL combo. |
I am sharing textures (not vertex arrays) between contexts successfully. I extended the nanovg API with these three methods: // @mulle-nanovg@ >
// This is like nvglCreateImageFromHandleGL3
// In order to share images, the windows these
// contexts belong to, must have been created with object sharing.
// Returns handle to the image.
int nvgCreateImageTexture(NVGcontext* ctx, int w, int h, int imageFlags, int type, void **texture);
// Get the OpenGL/Vulkan texture opaque handle (OpenGL is really unsigned int)
void nvgImageTextureInfo( NVGcontext* ctx, int image, int *imageFlags, int *type, void **texture);
// Relinquish OpenGL/Vulkan texture id, so it won't be deleted when the
// image is deleted
void nvgForgetImageTexture(NVGcontext* ctx, int image);
// @mulle-nanovg@ < In essence what this does is make an OpenGL One could extend this scheme to other OpenGL objects besides textures, but if it's just to offload code into nanovg, that could be done elsewhere, it would kill the "nano" in nanovg IMO. |
Are these three extensions available somewhere? |
Not yet. I plan to release my stuff, but I am already a year behind 😩 |
I put my nanovg fork out there (not really a release yet). The relevant API tidbits for this issue are in the header and source. The actual work is done via the callbacks declared in struct NVGparams and defined in nanovg_gl.h. As explained above this is very lowlevel and the actual texture sharing logic is implemented on top of it. But without these functions, you couldn't get nanovg to use a shared texture. |
I'm trying to use NanoVG to render to multiple windows whilst sharing the same OpenGL context to resolve the reasons outlined in Issue #379. However, since the OpenGL 3 implementation uses VAOs, this breaks rendering on the second window.
Expected:
Actual:
0x000501 after tex paint tex
is printed to the console.To recreate:
The text was updated successfully, but these errors were encountered: