memononen / nanovg

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

Transformation from Screen Space to World Space? #663

Open valdessa opened 9 months ago

valdessa commented 9 months ago

Hello :D

I'm developing my graphics engine in OpenGL... and now I'm stuck because I want to make a 3D vector graphics game. But I don't know how to make the lines be painted in world space instead of screen space.

How could I apply the projection and view matrices from the camera to the drawing of the lines in order to draw them in world space?

Here I have a star that I have made for now. Thanks in advance :)

Star

mulle-nat commented 9 months ago

If I were to make the transition from 2D to 3D, I would try not to use nanovg, but use OpenGL directly, which is basically made for that. If I needed nanovg edge antialiasing and could not use OpenGL AntiAliasing, I would try to rip that out from nanovg and expand it for 3D in OpenGL. Just my thoughts on this.