Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Steve132/uraster

Micro simple Rasterizer in a single C++11 header file.
https://github.com/Steve132/uraster

Last synced: 13 days ago
JSON representation

Micro simple Rasterizer in a single C++11 header file.

Awesome Lists containing this project

README

        

# uraster

Micro simple software rasterizer in a single C++11 header file. Does not use OpenGL. Pure C++11.

Mostly useful as a way of teaching how the rendering pipeline in hardware works.

![Image from uraster](https://raw.githubusercontent.com/Steve132/uraster/master/example/screenshot.jpg)

A day ago, I saw this post [Asking how to create a software renderer](http://www.reddit.com/r/GraphicsProgramming/comments/2whjam/creating_a_software_renderer/).

I started writing my response, and it looked something like this:

> One should not create a software rasterizer unless they are giant masochists. However, if you were to do it, and first you need to ....

After a while I stopped. After writing my tutorial on how to make a C++ rasterizer in english, I realized it was nearly unreadable.

New idea: I'll just write the tutorial in pseudocode. Then, I looked at the pseudocode. It was unreadable because it wasn't *quite* a language

New idea: I'll write the skeleton of the header with comments explaining what to put in the code! I did this.

Surely you can see where this is going.

I ended up actually filling in the code, and implementing a simple rasterization pipeline all in one C++11 header standalone header file. The interface is similar to a dramatically simplified version of OpenGL2.0 with shader support, that is only capable of drawing interleaved arrays of vertices from index buffers.

There are a couple examples showing how you use it, and I'll add comments or a tutorial to explain the code at a later date.

## Dependencies

It needs Eigen3 for the main header, cmake to build the examples, and CImg (to display) the animation and texturing example.

You can build and run the examples on ubuntu with

sudo apt install eigen3-dev cimg-dev
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j6
cd ..
./build/examples/bunnyanim