/sgl

Software graphics library

Primary LanguageC

SGL

Software Graphics Library

Created with 🤕 in C!

Lots of things inspired from SDL :D

Usage

Copy and paste sgl.h into your project and do this:

#define SGL_IMPLEMENTATION

in one C/C++ file before you include the cidr.hpp file.

Build the demo (Linux / Mac)

Dependencies

  • A c99 compatible compiler
  • SDL2
  • CMake

Building

Clone the repo and execute these commands from the sgl/ directory

mkdir build
cd build
cmake ..
make
./sgl

TODO

Core

Implement basic drawing functions

  • Point
  • Rectangles
  • Line
  • Circles
  • Arcs
  • Triangles
    • Stroke
    • Fill
    • Color interpolation
    • Textured triangles ⌨️
  • Images (using stb_image.h)
    • Nearest neighbor sampling
    • Save to disk
    • Linear sampling
    • Wrapping options
  • Text
    • Simple text rendering
    • Kerning
    • Alignment
    • Size
    • Shadow
  • Shaders

Utility

  • Alpha blending
  • Gamma correction
  • HSV
  • HSL
  • (ordered) Dithering (as a shader? depends on pixel format?)

Other

  • implement sglGetError() https://wiki.libsdl.org/SDL\_GetError
  • live demo code update
  • generalize sglBuffer's and sglBitmap's getPixel() function to one
  • make the library header only
  • add more pixel formats
  • allow drawing extended characters
  • text shadows
  • optimize
    • circle drawing
    • arc drawing
    • triangles