Page 1 of 1

loveshape: draw geometric shapes in retained mode

Posted: Sun Nov 12, 2023 11:59 pm
by BurrickSlayer
Hi all,

I have created a simple library for drawing several geometric shapes (like rectangles or convex polygons) in retained mode instead of immediate mode. So instead of using the love.graphics.* functions to set the color and size of your shapes, you create objects, set their visual properties and then draw them on the screen. The shape objects are based on meshes, so you can texture them, transform them and whatnot.

Personally, I will use this library to draw elements in a classic retained mode GUI, but you might find it useful for other applications as well.

This is what the demo looks like:
screenshot.png
screenshot.png (84.35 KiB) Viewed 10707 times
Shape borders are smoothed in a similar way as implemented in the LÖVE drawing functions. I plan to use this smoothing technique for the shapes themselves as well in a future release, to further improve the rendering quality.

Oh, and I haven't implemented ellipses yet, but it's on my list. :)

Repository: https://github.com/binaryfs/loveshape

Best regards

Re: loveshape: draw geometric shapes in retained mode

Posted: Mon Nov 20, 2023 10:09 pm
by BurrickSlayer
Hello all,

I released version 1.1.0 with the following major changes:
  • Unit tests added. During the tests I discovered some issues and inconsistencies which I fixed along the way.
  • Elliptical shapes added. Not that I badly needed them, but the library felt incomplete without them. ;)
  • Soft edges added. These can be used for both, simple anti-aliasing and some interesting visual effects.
  • Revised LÖVE demo (you can see a screenshot of it in the initial post, which I updated)
You can see the full list of changes in the changelog: https://github.com/binaryfs/loveshape/b ... CHANGES.md

And this is what the soft edges look like:

soft-edges.png
soft-edges.png (13.5 KiB) Viewed 10704 times

I thought about implementing straight lines as well, but currently I have no use for them and technically they can be represented by rectangles. So at the moment I have no plans to add them.

Best regards