add Program.get_uniform_location()

This commit is contained in:
josh committed 2015-06-11 20:16:39 -04:00
1 parent 5d1351fc66
commit 3d531ace23
4 files changed
+10 -13

No files matched your search

+3 -1
View File
@@ -1,4 +1,6 @@
uniform vec4 color;
void main(void)
{
gl_FragColor = vec4(0.5, 0.1, 0.9, 1.0);
gl_FragColor = color;
}
+2
View File
@@ -48,6 +48,8 @@ void display(SDL_Window * window)
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat), NULL);
program->use();
GLint uniform_location = program->get_uniform_location("color");
glUniform4f(uniform_location, 1.0, 0.6, 0.2, 1.0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
SDL_GL_SwapWindow(window);
}