gecko0307 / minigl

Tiny software renderer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MiniGL

Small (<1000 LoC) OpenGL-inspired old-school software rasterizer written in D language just for fun.

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();

Screenshot1

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
  • 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 buffers

No fancy-schmancy modern features like mipmapping or lights šŸ¤£ But they can be implemented on user side, of course.

About

Tiny software renderer

License:Boost Software License 1.0


Languages

Language:D 100.0%