Passing a variable to an OpenGL GLSL shader
One option is to pass information via uniform variables. After glUseProgram(myShaderProgram); you can use GLint myUniformLocation = glGetUniformLocation(myShaderProgram, “myUniform”); and for example glUniform1f(myUniformLocation, /* some floating point value here */); In your vertex or fragment shader, you need to add the following declaration: uniform float myUniform; That’s it, in your shader you can now access … Read more