https://github.com/larpon/sgldraw
An experimental real-time vector render V module based on `sokol.sgl`
https://github.com/larpon/sgldraw
Last synced: 8 months ago
JSON representation
An experimental real-time vector render V module based on `sokol.sgl`
- Host: GitHub
- URL: https://github.com/larpon/sgldraw
- Owner: larpon
- License: mit
- Created: 2022-03-30T08:47:33.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-18T15:01:36.000Z (9 months ago)
- Last Synced: 2025-02-18T16:21:38.301Z (9 months ago)
- Language: V
- Size: 55.7 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-v - sgldraw - An experimental real-time vector render V module based on `sokol.sgl`. (Libraries / Graphics)
- trackawesomelist - sgldraw (⭐10) - An experimental real-time vector render V module based on `sokol.sgl`. (Recently Updated / [Feb 28, 2025](/content/2025/02/28/README.md))
README
# sgldraw
`sgldraw` is a GPU accelerated, fairly performant, V module for
drawing vector shapes through `sokol.sgl`.
The example can be run with: `v run examples/app.v`:

The special thing about `sgldraw` is that it's real-time - meaning that it'll draw all
shapes from scratch 60 frames per second.
It also handles line widths > 1 - which makes the shapes look more like they'd do in
e.g. Inkscape. All shapes can also be animated with `sgl` transforms or by changing
each vertice coordinate the shapes is made up from.
## Why
It was an experiment on doing real-time vector graphics and also
to explore a way to package vector shape drawing into a self-contained
and standalone module.
`sgldraw` has served as a personal sandbox but
I'm releasing it to the public in case some of the code might
be of interest to anyone.
## Install
```bash
git clone https://github.com/larpon/sgldraw.git ~/.vmodules/sgldraw
```
When `sgldraw` is in `~/.vmodules/` you can run the examples and import
it as a normal V module with `import sgldraw`.
## Notes
**Legacy project**
It's not completely abandoned, but my focus is currently elsewhere
in V-land.
**Licenses**
Some code found in this module is adapted from code originally written by
Chris H.F. Tsang published under the [CPOL License](https://en.wikipedia.org/wiki/Code_Project_Open_License).
Also note that the `earcut` module is based on work licenced under the [ISC License](https://github.com/mapbox/earcut/blob/master/LICENSE).
The version of `earcut` is from [Larpon/earcut](https://github.com/larpon/earcut/)@[1790a9e](https://github.com/larpon/earcut/tree/1790a9e60dae09889b95b337acb205699fd4f51e).
Both CPOL and ISC are very permissive licenses that ressembles MIT