A simple-to-use modular, cross-platform graphics library. It combines the freedom of lower-level graphics libraries with modern C techniques, offering both simplicity and convenience.
C
206
787 commits
updated Sep 19, 2026
RSGL is a modular simple-to-use cross-platform graphics library. It attempts to combine the freedoms of low libraries with modern C techniques. Thus offering simplicity and convenience.
The RSGL.h header itself does not handle rendering nor input devices itself, both must be handled externally.
RSGL_gl.h is used by default for rendering, it renders via OpenGL 1.0 - 4.4.
UI elements have been moved to RSGL_ui, in it's own repo.

#define RSGL_NO_TEXT - makes it so RSGL does not include text rendering functions
#define RSGL_NO_SAVE_IMAGE - makes it so RSGL does not save/load images (don't use RSGL_drawImage if you use this). This is here because RSGL_drawImage saves the file name with its loaded texture so it can load the texture when you use the same file. \To link RSGL you must add the line.
#define RSGL_IMPLEMENTATION
in exactly one file which includes the RSGL.h header.
You could also use the command line argument -D RSGL_IMPLEMENTATION.
Optionally, RSGL can be compiled into a .o or .so file and link it.
Compiling RSGL isn't required. But if you want to, here's how.
make
This will compile RSGL into a static library into a shared library. You can also compile RSGL by hand.
gcc -x c -c RSGL.h -fPIC.ar rcs RSGL.a RSGL.ogcc -shared RSGL.o <system libs> windows:
gcc -shared RSGL.o -lshell32 -lgdi32 -lwinmm -o RSGL.dll
linux:
gcc -shared RSGL.o -lX11 -lXcursor -lXrandr -o RSGL.so
macos:
gcc -shared RSGL.o -framework Foundation -framework AppKit -framework CoreVideo
// (see application in basic.c)
#define RSGL_IMPLEMENTATION
#include "RSGL.h"
// include graphics backend header here too
#include "RSGL_gl.h"
int main() {
// create window with your API choice here
u32 WIDTH = //??? window width
u32 HEIGHT = //??? window height
void* procAddress = //??? renderer proc address (ex. RGFW_getProcAddress/glfwGetProcAddress)
RSGL_init(RSGL_AREA(WIDTH, HEIGHT), procAddress);
bool running = true;
while (running) {
// (handle your API's events here)
RSGL_drawRect((RSGL_rect){200, 200, 200, 200}, RSGL_RGB(255, 0, 0));
RSGL_clear(RSGL_RGBA(255, 255, 255));
RSGL_draw();
// swap draw buffer with API here
// for example RGFW_window_swapBuffer or glfwSwapBuffers
}
RSGL_free();
// free window API here
}
Both of the included makefiles (Makefile or examples/Makefile) use the Unlicense license so feel free to copy from either of them if you wish.
these can be compiled by running make examples in the current directory\
or by using the makefile in examples/\
The Makefile in examples/ allows you to compile all the examples using make,
compile one specific example using make <example> or
run make debug which compiles and runs each example in debug mode
Ensure you're running the example in the ./examples folder so the fonts are properly loaded.
NOTE: Most of these examples use RGFW, but the library used can easily be changed.
examples/basics/basic.c is a basic example that shows many of the window managing features RSGL has
It also shows multiple ways of drawing a triangle
examples/advanced/glfw.c is an example that shows how you can use RSGL with GLFW.
This example requires GLFW to be installed.
You can download GLFW here
examples/basics/shapes.c is an example that shows off shape rendering using RSGL, the shapes rotate and switch between being filled and unfilled
examples/basics/text.c is an example of text rendering using RSGL
examples/basics/textures.c is an example that shows off rendering textures on a shape, the textures switch between being enabled and disabled as the shapes spin
examples/advanced/shader.c is an example of how you'd use shaders with RSGL. It renders a circle, using a grid shader with changing colors, that follows the mouse.
examples/custom_render_samples/custom_render_gl1.c is an example that shows how you'd implement a custom rendering system.
examples/custom_render_samples/custom_render_template.c and examples/custom_render_samples/custom_render_template.h can be used as an example/template for implementing a completely custom rendering system.
examples/custom_render_samples/custom_render_template.h is an example/template for implementing a completely custom rendering system.
When creating a custom renderer you need to implement these functions.
void RSGL_renderBatch(RSGL_RENDER_INFO* info); renders the current batches based on the info data
void RSGL_renderInit(void* proc, RSGL_RENDER_INFO* info); do whatever to init render backend
void RSGL_renderFree(void); do whatever to free render backend
void RSGL_renderClear(float r, float g, float b, float a); clears the screen based on a given color
void RSGL_renderViewport(i32 x, i32 y, i32 w, i32 h); sets viewport
u32 RSGL_renderCreateTexture(u8* bitmap, RSGL_area memsize, u8 channels); create a texture based on given bitmap data
void RSGL_renderUpdateTexture(u32 texture, u8* bitmap, RSGL_area memsize, u8 channels); updates a texture based on its id with new data info
void RSGL_renderDeleteTexture(u32 tex); - deletes a texture based on its id
Things you can do if you want to support the development of RSGL:
If you want to contribute to RSGL but don't know what to contribute, you can check the TODO file.
All of RSGL's (non-native) dependencies are built-in. They can also be avoided or replaced.\
RFont is a super lightweight and modular font library for text rendering that I created.
stb_image is a public domain single header image loader library.
Since I started RSGL, has helped boost the morale of the project and has helped me come up with new ideas and improvements for the project. He also contributed some code to the project.
RSGL uses the Zlib/libPNG license, this means you can use RSGL freely as long as you do not claim you wrote this software, mark altered versions as such and keep the license included with the header.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
570 followers · starred Mar 2024
5,703 followers · starred Apr 2024
169 followers · starred Apr 2024
207 followers · starred Feb 2026
A simple-to-use modular, cross-platform graphics library. It combines the freedom of lower-level graphics libraries with modern C techniques, offering both simplicity and convenience.
C
206
787 commits
updated Sep 19, 2026
RSGL is a modular simple-to-use cross-platform graphics library. It attempts to combine the freedoms of low libraries with modern C techniques. Thus offering simplicity and convenience.
The RSGL.h header itself does not handle rendering nor input devices itself, both must be handled externally.
RSGL_gl.h is used by default for rendering, it renders via OpenGL 1.0 - 4.4.
UI elements have been moved to RSGL_ui, in it's own repo.

#define RSGL_NO_TEXT - makes it so RSGL does not include text rendering functions
#define RSGL_NO_SAVE_IMAGE - makes it so RSGL does not save/load images (don't use RSGL_drawImage if you use this). This is here because RSGL_drawImage saves the file name with its loaded texture so it can load the texture when you use the same file. \To link RSGL you must add the line.
#define RSGL_IMPLEMENTATION
in exactly one file which includes the RSGL.h header.
You could also use the command line argument -D RSGL_IMPLEMENTATION.
Optionally, RSGL can be compiled into a .o or .so file and link it.
Compiling RSGL isn't required. But if you want to, here's how.
make
This will compile RSGL into a static library into a shared library. You can also compile RSGL by hand.
gcc -x c -c RSGL.h -fPIC.ar rcs RSGL.a RSGL.ogcc -shared RSGL.o <system libs> windows:
gcc -shared RSGL.o -lshell32 -lgdi32 -lwinmm -o RSGL.dll
linux:
gcc -shared RSGL.o -lX11 -lXcursor -lXrandr -o RSGL.so
macos:
gcc -shared RSGL.o -framework Foundation -framework AppKit -framework CoreVideo
// (see application in basic.c)
#define RSGL_IMPLEMENTATION
#include "RSGL.h"
// include graphics backend header here too
#include "RSGL_gl.h"
int main() {
// create window with your API choice here
u32 WIDTH = //??? window width
u32 HEIGHT = //??? window height
void* procAddress = //??? renderer proc address (ex. RGFW_getProcAddress/glfwGetProcAddress)
RSGL_init(RSGL_AREA(WIDTH, HEIGHT), procAddress);
bool running = true;
while (running) {
// (handle your API's events here)
RSGL_drawRect((RSGL_rect){200, 200, 200, 200}, RSGL_RGB(255, 0, 0));
RSGL_clear(RSGL_RGBA(255, 255, 255));
RSGL_draw();
// swap draw buffer with API here
// for example RGFW_window_swapBuffer or glfwSwapBuffers
}
RSGL_free();
// free window API here
}
Both of the included makefiles (Makefile or examples/Makefile) use the Unlicense license so feel free to copy from either of them if you wish.
these can be compiled by running make examples in the current directory\
or by using the makefile in examples/\
The Makefile in examples/ allows you to compile all the examples using make,
compile one specific example using make <example> or
run make debug which compiles and runs each example in debug mode
Ensure you're running the example in the ./examples folder so the fonts are properly loaded.
NOTE: Most of these examples use RGFW, but the library used can easily be changed.
examples/basics/basic.c is a basic example that shows many of the window managing features RSGL has
It also shows multiple ways of drawing a triangle
examples/advanced/glfw.c is an example that shows how you can use RSGL with GLFW.
This example requires GLFW to be installed.
You can download GLFW here
examples/basics/shapes.c is an example that shows off shape rendering using RSGL, the shapes rotate and switch between being filled and unfilled
examples/basics/text.c is an example of text rendering using RSGL
examples/basics/textures.c is an example that shows off rendering textures on a shape, the textures switch between being enabled and disabled as the shapes spin
examples/advanced/shader.c is an example of how you'd use shaders with RSGL. It renders a circle, using a grid shader with changing colors, that follows the mouse.
examples/custom_render_samples/custom_render_gl1.c is an example that shows how you'd implement a custom rendering system.
examples/custom_render_samples/custom_render_template.c and examples/custom_render_samples/custom_render_template.h can be used as an example/template for implementing a completely custom rendering system.
examples/custom_render_samples/custom_render_template.h is an example/template for implementing a completely custom rendering system.
When creating a custom renderer you need to implement these functions.
void RSGL_renderBatch(RSGL_RENDER_INFO* info); renders the current batches based on the info data
void RSGL_renderInit(void* proc, RSGL_RENDER_INFO* info); do whatever to init render backend
void RSGL_renderFree(void); do whatever to free render backend
void RSGL_renderClear(float r, float g, float b, float a); clears the screen based on a given color
void RSGL_renderViewport(i32 x, i32 y, i32 w, i32 h); sets viewport
u32 RSGL_renderCreateTexture(u8* bitmap, RSGL_area memsize, u8 channels); create a texture based on given bitmap data
void RSGL_renderUpdateTexture(u32 texture, u8* bitmap, RSGL_area memsize, u8 channels); updates a texture based on its id with new data info
void RSGL_renderDeleteTexture(u32 tex); - deletes a texture based on its id
Things you can do if you want to support the development of RSGL:
If you want to contribute to RSGL but don't know what to contribute, you can check the TODO file.
All of RSGL's (non-native) dependencies are built-in. They can also be avoided or replaced.\
RFont is a super lightweight and modular font library for text rendering that I created.
stb_image is a public domain single header image loader library.
Since I started RSGL, has helped boost the morale of the project and has helped me come up with new ideas and improvements for the project. He also contributed some code to the project.
RSGL uses the Zlib/libPNG license, this means you can use RSGL freely as long as you do not claim you wrote this software, mark altered versions as such and keep the license included with the header.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
570 followers · starred Mar 2024
5,703 followers · starred Apr 2024
169 followers · starred Apr 2024
207 followers · starred Feb 2026