domenica 14 giugno 2015

Day 2: Shaders

Today i had to write a lot of code, mostly because a lot of stuff needed refactoring.

I started by creating a MainGame class to refactor the game cycle, so that now i have all the game logic in one class, with easy-to-read functions like initialize_system(), draw() or handle_input().

Then i started working on displaying a simple shape on screen.

This required 3 steps:

1) Writing OpenGL code to pass the shape data to the gpu
2) Writing the shaders in GLSL language
3) Make a GLSL program working

The first two steps were pretty easy and straightforward, but the third step required me to create a class to handle everything related to the GLSL program.

So i wrote this class that can load, compile and link the shaders to the GLSL program, and also activate or deactivate the GLSL program when needed.


Nessun commento:

Posta un commento