-
Notifications
You must be signed in to change notification settings - Fork 472
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
Question: nanovg with sokol_gfx? #633
Comments
A Google Search didn't return any meaningful results, other than #29 . You could ask pplux. |
Unfortunately not. The closest thing (for 2D drawing) is sokol_gp: |
Hi! at the time I was mixing sokol rendering with another gl-drawing library, in the end it worked. And maybe you can try that, nanovg supports render directly with gl so you just need to be careful to recover and save the proper gl state between the two libraries. But depends very much on what you need, if you just need some basic 2D rendering... well, consider imgui to which sokol offers a proper full implementation on top of sokol_gfx, and you ca pretty much draw whatever you want with it: |
Hi. I made this a while ago, but never published it because it was never properly tested (plus I wanted to write a custom library). But I guess it'll be useful to others, too. I still need to figure out the shader compiler to be able to distribute it for everything, but in principle, it works. I don't have access to it today (not at home), but if someone reminds me in a few days, I can try to find the code. |
@darkuranium Very interested here. |
@DagAgren @ib00 Okay, so I wanted to clean this up and make a "proper" fork, but didn't get around to it due to a lack of time. So here's just the Caveats:
If anyone would be interested in making a "proper" fork of NanoVG (as in: a hard fork, to clean some things up), let me know. There are a few things that bother me about it (e.g. the fact that it defines Note: I've been wanting to make an alternative to NanoVG (a completely new API [as in: no compatibility with NanoVG], to work around some NanoVG limitations), but there's a few obstacles I've yet to figure out. The main features I'd like to add on top of NanoVG are (in descending order of priority):
The main obstacle at the moment is in figuring out how to do anti-aliasing for paths (there is a very promising paper on wavelet rasterization, but it might need compute shaders to implement on GPUs). Ideally, I would also like to avoid relying on the stencil buffer, because it's problematic for anti-aliasing and because for 2D uses, it means unnecessary extra memory for the depth buffer (and for 3D software, it means the depth buffer cannot be 32-bit, but must be 24+8 depth/stencil). The reason I'm mentioning this is to query to see if anyone would be interested in contributing to such a project. The main issue is, as mentioned, anti-aliasing; and to some extent rasterization if I want to avoid stencil buffer approaches. |
Thanks for taking the time and making your implementation available. There is a cool small library for 2D drawing different than nanovg: But, ultimately, something like this would be fantastic: |
#define NANOVG_SG_PIPELINE_CACHE_SIZE 32 output: sokol_gfx.h:15715:0:
PIPELINE_POOL_EXHAUSTED: pipeline pool exhausted change NANOVG_SG_PIPELINE_CACHE_SIZE to 4 not error I try sokol shader compiler but draw is invalid, I'll try to see if it works fine in opengl my nanovg_sokol.h on windows opengl dx11 all rendered normally |
@zeromake Did you get this to work (in OpenGL)? |
@ib00 example> git clone https://github.com/zeromake/nanovg.git && cd nanovg
> xmake f -c -vD -m debug --example=y --pkg='sokol' -y
> xmake b example.sokol
> xmake r example.sokol |
@zeromake Very cool! I have some trouble compiling on linux. Shaders don't get compiled (and output into .h files) |
I missed sokol_shader target, now is fix |
Has anybody attempted to write a nanovg renderer with sokol_gfx?
The text was updated successfully, but these errors were encountered: