This article is part of the Experiments with OpenGL series.

This experiment started with just one thing in mind, the stencil buffer.

At this point of the series, you must be asking, why am I bothering myself with such trivial experiments. I wish to explain few things here:

  1. These experiments are going to build up in building blocks forms. Each experiment is going to grow over each other, so, I’m keeping initial blocks as minimalistic as possible.

  2. I’m trying to use C, to keep things as simple as possible. Also, this is the most C I’ve used in years. Years of Object Oriented philosophy has spoiled my brain. I spend great deal of time figuring out best ways possible to arrange my data structures. I’m focusing more on computer side, not the human side. Trying to keep the data packed, aligned, optimized, not fragmenting the memory unnecessarily. In my opinion C is one the best programming language a programmer can have, I’m just relearning it.

  3. I’m also working on finishing my game, so I intend to keep each experiment at this stage at minimum level. One that I can finish off in couple of hours. Honestly, I don’t even test them thoroughly, I’m keeping the fixes for days when the experiments get more complicated and issues will start to surface. And there is also a chance that someday I might come back and improve all these experiments to a better level.

OK, so getting back to the experiment. This experiment is all about using a stencil buffer. I thought of doing a reflection on a random surface.