-
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
How can I copy a nvgPaint from one context to another? #543
Comments
I don't think there's any proper way to do that. I've reread your question maybe 10 times, and still not quite sure what you want to do. I sounds like half half way implemented wrong idea :) So, if I understood correctly, you want to render something cool with projectM, and display that with NanoVG? In that case all you need to do is to share the texture you rendered to between the two OpenGL contexts, and use I don't know how to share textures between OpenGL contexts. |
Sorry for the unclear question - it's kind of a mess. Here's a short writeup in case someone else finds this issue in the future: What I wanted to do was render some library's stuff (projectM) which requires an OpenGL 3.3 core context, but I'm embedded in a program (VCV Rack) that gives me a context of less than that. As it turns out, I didn't need to do anything at the NVG level. All I had to do was:
|
Nice you found the solution! |
Hi, I'm trying to use one context to render an image using OpenGL, then use nvgImagePattern() to obtain a NVGPaint for it, and finally use that NVGPaint for a nvgFillPaint() operation in a different context. Is there a "proper" way to do this?
What about if one context uses GL2 and the other one uses GL3 (or GLES3)?
x/y problem statement: I'm writing a module for VCV Rack, which uses nanovg with GL2. The module is loaded dynamically into Rack. My module uses projectM to render visuals with OpenGL. On OSX, the shaders that projectM use require me to request an OpenGL3 context because they use GLSL 300 (according to this comment at least). So my solution (maybe very naive - I know next to nothing about OpenGL) is to create a separate NVGcontext for projectM rendering, possibly running the code for that in a separate thread, have it render to a texture, and use that texture as a NVGpaint to fill a shape in the "main" NVGcontext that Rack provides me (the GL2 one).
Thoughts? thanks!
The text was updated successfully, but these errors were encountered: