Uploaded August 2014 | Updated September 2026, 2 weeks ago
Commented Source Code: dropbox.com/s/3wk7erfmlndzeyr/BenGraphicsTut8.zip?dl=0
In this long but information dense tutorial we finally use our first GLSL shader program! We also get to learn about initialization lists and the extern keyword! In the next video we will make some cool effects with shaders, and enhance our GLSLProgram class!
ATTENTION MAC USERS: This tutorial isn't going to quite work for you. Please follow the below steps to ensure that it will work on your machine (Thanks to +Johnny Von Kelaita and +Yann Vanhalewyn):
1) Download above ^ source code and shader files (to be safe, you can download tutorial 9 version instead)
2) Remove all of the "glew" includes and replaced them with "OpenGL/gl3.h"
3) Remove glew initialization.
4) Add the following lines right before you make the opengl context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
5) Bind a VAO (Vertex array object) with this code, after you make the context:
GLuint vertexArrayID;
glGenVertexArrays(1, &vertexArrayID);
glBindVertexArray(vertexArrayID);
6) If this still doesn't work, comment below and I or someone else will do our best to help!
NOTE: If your graphics card doesn't support opengl 3 then you can't follow these tutorials :( However, a graphics card driver can often fix the problem. You can query your OpenGL and GLSL version with:
int glVersionMajor;
int glVersionMinor;
glGetIntegerv(GL_MAJOR_VERSION, &glVersionMajor);
glGetIntegerv(GL_MINOR_VERSION, &glVersionMinor);
printf("\n=== OpenGL Implementation ===\n");
printf("Vendor: %s\n", glGetString(GL_VENDOR));
printf("GL Version: %s\n", glGetString(GL_VERSION));
printf("GL Version (Strict): %d.%d\n", glVersionMajor, glVersionMinor);
printf("GLSL Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
P.S. Sorry about the raspy voice, allergies suck ;_;
Twitter: twitter.com/ChillstepCoder
Seed Of Andromeda Channel: youtube.com/user/DubstepCoder
Seed Of Andromeda Website: seedofandromeda.com
Commented Source Code: dropbox.com/s/3wk7erfmlndzeyr/BenGraphicsTut8.zip?dl=0
In this long but information dense tutorial we finally use our first GLSL shader program! We also get to learn about initialization lists and the extern keyword! In the next video we will make some cool effects with shaders, and enhance our GLSLProgram class!
ATTENTION MAC USERS: This tutorial isn't going to quite work for you. Please follow the below steps to ensure that it will work on your machine (Thanks to +Johnny Von Kelaita and +Yann Vanhalewyn):
1) Download above ^ source code and shader files (to be safe, you can download tutorial 9 version instead)
2) Remove all of the "glew" includes and replaced them with "OpenGL/gl3.h"
3) Remove glew initialization.
4) Add the following lines right before you make the opengl context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
5) Bind a VAO (Vertex array object) with this code, after you make the context:
GLuint vertexArrayID;
glGenVertexArrays(1, &vertexArrayID);
glBindVertexArray(vertexArrayID);
6) If this still doesn't work, comment below and I or someone else will do our best to help!
NOTE: If your graphics card doesn't support opengl 3 then you can't follow these tutorials :( However, a graphics card driver can often fix the problem. You can query your OpenGL and GLSL version with:
int glVersionMajor;
int glVersionMinor;
glGetIntegerv(GL_MAJOR_VERSION, &glVersionMajor);
glGetIntegerv(GL_MINOR_VERSION, &glVersionMinor);
printf("\n=== OpenGL Implementation ===\n");
printf("Vendor: %s\n", glGetString(GL_VENDOR));
printf("GL Version: %s\n", glGetString(GL_VERSION));
printf("GL Version (Strict): %d.%d\n", glVersionMajor, glVersionMinor);
printf("GLSL Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
P.S. Sorry about the raspy voice, allergies suck ;_;
Twitter: twitter.com/ChillstepCoder
Seed Of Andromeda Channel: youtube.com/user/DubstepCoder
Seed Of Andromeda Website: seedofandromeda.com
![C++/Game Tutorial 27: new, delete, and delete[]
In this episode we learn how to allocate variables on the heap using the new operator, and how to delete them from the heap with delete or delete[]! We also learn a little more about the difference between a by reference parameter and a pointer, and we learn that we should use nullptr instead of NULL :)
Twitter: https://twitter.com/ChillstepCoder
Seed Of Andromeda Channel: https://www.youtube.com/user/DubstepCoder
Seed Of Andromeda Website: http://www.seedofandromeda.com/ C++/Game Tutorial 27: new, delete, and delete[]](https://i.ytimg.com/vi/LMpkhZc17Z0/mqdefault.jpg)









