Framework, Part 1

Today I’ll go on something quite different, at least we’ll shift our focus away from shaders for now, and talk about something else that’s equally important in writing games.

A Framework.

Framework is a mini version of an Engine, it sets up the basics of the program, let it read from various libraries (in this case, OpenGL and GLSL compilers). Some time ago I wrote a framework for our game that includes support for OpenGL, loading OBJ models and supports of audios such like sound and music. There is some SFML code we used to make sure the game will recognize different ways of input, like Keyboard and Mouse inputs. Even though you can easily do Keyboard Input in the form of normal C++ code, personally I felt that if we could use a superior library it would be good to actually use it.

Now, we must ask, with the recent addition of shaders, what do we need to add into our framework to make it tick again?

It’s quite simple actually, since GLSL is included in OpenGL, we need to first include glsl.h, then we can create different shader objects like GL_VERTEX_SHADER and so, then we need something that can read from a text file and output them as a file so the contents of said text fire can be bind to the shader. Afterwards, we’ll apply the shader object to the finished render.

It’s not that hard really, in practice, some company just leave their shader system right there and let the user play all they want. Which resulted in this gem from SEGA’s recent Sonic Generations PC Version. This is a video so no screenshot would be provided today.

The video up there may not be clear, but it’s the normal gameplay with the added effect of white colors. When the main character is zooming through the stage, the colors went back to their original. This is a simple shader change dealing with render post-processing, which is what I’ll be talking about next week.

Thus, until next week.

Post a Comment