Computer graphics: handling multiple light sources

I'm writing this post because I've spent a week trying to figure this one out - and there isn't a one-size-fits all solution :) At least from the manhours perspective. So, after implementing simple lihgting in my toy game engine, I wanted to add more than 1 light. But since the light source coordinates are passed to the shader as uniform values, the number of lights was limited (to 1). There [Read More]

Tracing OpenGL errors (1282)

The infamous 1282 error in OpenGL stands for GL_INVALID_OPERATION, and can be pretty annoying. A friend once described it as "GL_GENERIC_FUCK_YOU_ERROR" since it really doesn't tell you anything except that you are somehow using OpenGL wrong. The simple method of debugging this is to, line by line, place something like printf( "%d\n", glGetError() ); and then compile, rerun, and eventually [Read More]

Tying To Efficiently Mimic Object Oriented Programming In C

A couple of weeks back I gave myself the somewhat impossible task of writing a game/rendering engine in C. The "somewhat impossible" part relates to writing the engine in C. I actually think that writing rendering engines is awesome. There is so much computer science in those things, and it is overall much fun. So, while writing the damn thing in C, I encountered a serious problem. [Read More]