Reflection
[opengl.git] / program.cpp
index b1f2edeb52d2c210985fb24dadfe843d78d8c5de..d6adf0630cd2b3d22f7f775a8fd1ee3d5811bbb9 100644 (file)
@@ -48,3 +48,17 @@ Program::Program(const string vertexShader, const string fragmentShader) {
                exit(1);
        }
 }
+
+void Program::validate() const {
+       glValidateProgram(progId);
+       
+       GLint success;
+       glGetProgramiv(progId, GL_VALIDATE_STATUS, &success);
+       if (!success) {
+               GLchar log[1024];
+               glGetProgramInfoLog(progId, sizeof(log), NULL, log);
+               fprintf(stderr, "error: %s\n", log);
+               exit(1);
+       }
+}
+