aboutsummaryrefslogtreecommitdiff
path: root/program.go
diff options
context:
space:
mode:
Diffstat (limited to 'program.go')
-rw-r--r--program.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/program.go b/program.go
index 56944e8..9dcef76 100644
--- a/program.go
+++ b/program.go
@@ -5,6 +5,9 @@
package gl
// #include "gl.h"
+// GLuint workaroundGlGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) {
+// return glGetUniformBlockIndex(program, uniformBlockName);
+// }
import "C"
import "unsafe"
@@ -133,7 +136,13 @@ func (program Program) GetUniformBlockIndex(name string) UniformBlockIndex {
cname := glString(name)
defer freeString(cname)
- return UniformBlockIndex(C.glGetUniformBlockIndex(C.GLuint(program), cname))
+ // Workaround bug in GLEW < 1.8 where glGetUniformBlockIndex expects
+ // a string of char instead of a string of GLchar. We could ask everybody
+ // to bump their version of GLEW, or we could add a bit of C code that
+ // will silently cast GLchar into char.
+
+ //return UniformBlockIndex(C.glGetUniformBlockIndex(C.GLuint(program), cname))
+ return UniformBlockIndex(C.workaroundGlGetUniformBlockIndex(C.GLuint(program), cname))
}
func (program Program) UniformBlockBinding(index UniformBlockIndex, binding uint) {