https://github.com/gecko0307/minigl
Tiny software renderer
https://github.com/gecko0307/minigl
Last synced: 12 days ago
JSON representation
Tiny software renderer
- Host: GitHub
- URL: https://github.com/gecko0307/minigl
- Owner: gecko0307
- License: bsl-1.0
- Created: 2022-05-20T14:54:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-03T19:47:17.000Z (4 months ago)
- Last Synced: 2025-04-14T01:14:35.090Z (12 days ago)
- Language: D
- Size: 828 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# MiniGL
Small (<1000 LoC) OpenGL-inspired old-school software rasterizer written in D language just for fun.```d
mglClearColor(0.0f, 0.0f, 0.0f, 1.0);
mglClearDepth(1.0);
mglSetProjectionMatrix(pm);
mglSetModelViewMatrix(mvm);
mglBindVertexShader(&vs);
mglBindPixelShader(&ps);
mglBindTexture(0, tex);
mglBindVertexBuffer(vb);
mglDrawVertexBuffer();
```An example game provided with first person corridor shooter mechanics.
[](https://github.com/gecko0307/minigl/raw/main/assets/screenshot.jpg)
## Features
- Fully platform-independent. SDL is only used to create a window, you can use MiniGL with any other multimedia framework
- The only dependency is [dlib](https://github.com/gecko0307/dlib)
- Very simple imperative API
- Basic graphics pipeline similar to ancient OpenGL
- Supports only triangles
- Renders vertex buffers (vertex position buffer + texture coordinate buffer + index buffer)
- Textures
- Nearest-neighbour and bilinear sampling (`mglEnable(MGL_BILINEAR_FILTER)`)
- Blending modes: alpha, additive, modulate
- Fog
- Vertex and pixel shaders!
- Shader-based multitexturing, 32 texture units per pass
- User-defined frame buffersNo fancy-schmancy modern features like mipmapping or lights 😅 But they can be implemented on user side, of course.