memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.06k stars 767 forks source link

Manually loading images / Generating custom MipMaps for images #637

Closed senxd closed 2 years ago

senxd commented 2 years ago

Is there a way to generate the opengl textures manually, and pass the textureID to nanovg? I tried doing this, but it is just the color of the paint.

senxd commented 2 years ago

Also a note, I haven't spent too much time looking at how NanoVG controls textures, but I assume it looks up the texture in it's internal database or something like this. A workaround is to load the image as you usually would and then update it.

mulle-nat commented 2 years ago

I think these functions are what you are looking for. Create the OpenGL texture pass it to nvglCreateImageFromHandle... then use the returned value as the image for nanovg calls.

senxd commented 2 years ago

Thanks!