MinGL (Minimal Graphics Library) is a tiny graphics rendering class built on top of OpenGL. Its core function is MinGL::putPixel()
, which receives the x/y coordinates and a color to draw a single pixel on the screen.
The idea is to serve as the most basic graphics API to try computer graphics concepts and algorithms such as line drawing, triangle rasterization, perspective projection etc, without the need to deal with complicated API states and calls. Without a graphics API, such concepts are usually tested using still images rendered to disc, but with MinGL you can see the results immediately.
Note: Since ray-tracing is very demanding, you better of writing an image to disc in such cases.
The above image was drawn using MinGL within a DrawLine()
function based on Bresenham’s Line Algorithm
Bresenham’s Line Algorithm used in the example code was based on https://github.com/ssloy/tinyrenderer/wiki
MinGL depends on glad and GLFW to work. Following is an example of how files could be organized:
Main.cpp
MinGL.h
MinGL.cpp
glad/khrplatform.h
glad/glad.h
glad/glad.c
GLFW/glfw3.h
GLFW/glfw3native.h
Note: If you are trying to run the example, don't forget to link the glfw2 binaries: https://www.glfw.org/download.
MinGL is licensed under MIT License
- glad is licensed under MIT License
- GLFW is licensed zlib license