[Lazarus] NanoVG Graphics

Anthony Walter sysrpl at gmail.com
Tue Jan 28 19:32:57 CET 2020


The library does not have any code to manage creating a window, creating a
valid opengl context, or handle event processing. These are things which
are not exactly trivial in nature, especially in a cross platform manner.
Typically for simplicity makers of OpenGL demos rely upon things like GLFW
(Graphics Library FrameWork) to get a demo working. Other libraries to do
the same thing are SDL, GLUT, SFML, or other similar libraries.

The good news is that NanoVG is designed to work independently of those
things. The original C implementation has a callback stub to load the
appropriate OpenGL functions based on which back end you choose.
Fortunately this tool named Glad <https://glad.dav1d.de/> makes it very
simple to create a correct Pascal (or other language) file for the various
OpenGL versions. This is probably something we ought to consider using in
the FCL, so that for example people would know what functions to load for
OpenGL ES versus the full version of OpenGL.

And finally the LCL and TOpenGLControl provided in the components folder
handle all the requirements already, so if you wanted to use a NanoVG port
with Lazarus it ought to be as simple as including some NanoVG.pas in your
project and putting a few NanoVG drawing function calls into your
TForm1.OpenGLControl1Paint method. In this way using hardware accelerated
animated vector text and graphics in any desktop project would be very
easy. NanoVG even includes functions to draw vector controls such as
sliders, check boxes, buttons, and combo boxes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200128/9c53ac70/attachment.html>

More information about the lazarus mailing list