|
@@ -0,0 +1,22 @@
|
|
|
|
|
+#ifndef GL_UTIL_H
|
|
|
|
|
+#define GL_UTIL_H
|
|
|
|
|
+
|
|
|
|
|
+int32_t get_uniform_or_exit(uint32_t prog, const char *name);
|
|
|
|
|
+
|
|
|
|
|
+#if defined(GL_UTIL_IMP) || defined(IMP)
|
|
|
|
|
+
|
|
|
|
|
+int32_t
|
|
|
|
|
+get_uniform_or_exit(uint32_t prog, const char *name)
|
|
|
|
|
+{
|
|
|
|
|
+ int32_t uni = glGetUniformLocation(prog, name);
|
|
|
|
|
+ if ( uni == -1 ) {
|
|
|
|
|
+ fprintf(stderr, "Failed getting %s uniform location\n", name);
|
|
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
|
|
+ }
|
|
|
|
|
+ printf("Got %s -> %d\n", name, uni);
|
|
|
|
|
+ return uni;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#endif /* defined(GL_UTIL_IMP) || defined(IMP) */
|
|
|
|
|
+
|
|
|
|
|
+#endif
|