Advanced C++/Graphics Tutorial 8: GLSLProgram, Initialization Lists, extern! @makinggameswithben
Advanced C++/Graphics Tutorial 8: GLSLProgram, Initialization Lists, extern!  @makinggameswithben
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
Advanced C++/Graphics Tutorial 8: GLSLProgram, Initialization Lists, extern!C++/Game Tutorial 27: new, delete, and delete[]Advanced C++/Graphics Tutorial 36: Cache-FriendlinessAdvanced C++/Graphics Tutorial 14: Maps, Binary Search, Caching!Advanced C++/Graphics Tutorial 47: Platformer Player ControlAdvanced C++/Graphics Tutorial 53: GUI class and static_castAdvanced C++/Graphics Tutorial 43: Multiple Renderers, Lazy InitAdvanced C++/Graphics Tutorial 37: ParticleEngine2D!C++/Game Tutorial 38: Game States, enums, enum Classes!Cmake and Vcpkg C++ Project SetupC++/Game Tutorial 17: Vectors!Advanced C++/Graphics Tutorial 49: Capsule Collision
MakingGamesWithBen |

Advanced C++/Graphics Tutorial 8: GLSLProgram, Initialization Lists, extern!

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER