In this post, I will write the code to compile and link the shaders inside the program to be able to use it for drawing.
You will need 2 new variables and a struct for this part. One of the variables will be used to hold the program handle, which you will use to make subsequent calls to OpenGL that need it. The other variable, an array, will hold the information about your uniforms, their name and location.
Every time you draw, you will probably want to give your shaders a different ModelView transformation matrix, to make your object move for example. For that, you need its name and location, and this should only be queried once. Here is the struct and the two variables you need to add (Add them to your private interface):
Here's the code for compiling the shaders:
And here's the code for creating the program and linking the compiled shaders:
And finally, here's a piece of code to query the uniforms information
Now you can add these two lines of code where you left off in the ViewDidLoad method
This is all for the program part, build and run the application. Nothing should have changed, but you shouldn't be getting any errors. You also have a fully operational program, as well as all the information you need to set the uniforms inside the shader every time you want to draw.