-
Notifications
You must be signed in to change notification settings - Fork 0
Adding OpenGL GLSL Shaders
supermaximo93 edited this page Oct 13, 2011
·
4 revisions
In this tutorial, I'll be showing you how to import OpenGL shaders. Shaders are crucial because they essentially draw pixels to the screen. Without them, then you'll have a game with no graphics! OpenGL shaders need to be coded in GLSL (GL Shader Language), but you will not need to know GLSL for this tutorial; we just want to know how to load in the shaders, not how to write them. The purpose of this tutorial is not how to write shaders, and in future tutorials shaders will be provided.
First off, we need the code from the Creating an OpenGL Window tutorial:
//C
#include
#include
#include
int main(void) {
initSDL(SDL_INIT_EVERYTHING);
initInput();
initDisplay(800, 600, 1000, 60, SM_FALSE, "OpenGL window");
while (!keyPressed(27) && !closeClicked()) {
refreshScreen();
}
quitDisplay();
quitInput();
quitSDL();
return 0;
}
//Pascal
uses
SMGL_SMSDL, SMGL_Input, SMGL_Display;
begin
initSDL(SDL_INIT_EVERYTHING);
initInput;
initDisplay(800, 600, 1000, 60, SM_FALSE, 'OpenGL window');
while (keyPressed(27) = SM_FALSE) and (closeClicked = SM_FALSE) do
begin
refreshScreen;
end;
quitDisplay;
quitInput;
quitSDL;
end.
Now we need to add the header that will allow us to import shaders.
//C
#include
//Pascal
uses
SMGL_SMSDL, SMGL_Input, SMGL_Display, SMGL_Shader;
Let's load up some shaders! TODO: finish