Last active
August 29, 2015 14:17
-
-
Save mattn/827bc949adf45e9e4df5 to your computer and use it in GitHub Desktop.
patch for https://github.com/go-gl-legacy/gl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/program.go b/program.go | |
index 4bcd1c1..3905e83 100644 | |
--- a/program.go | |
+++ b/program.go | |
@@ -9,6 +9,7 @@ package gl | |
// return glGetUniformBlockIndex(program, uniformBlockName); | |
// } | |
import "C" | |
+import "strings" | |
import "unsafe" | |
// Program | |
@@ -74,7 +75,10 @@ func (program Program) GetInfoLog() string { | |
log := C.malloc(C.size_t(length)) | |
defer C.free(log) | |
C.glGetProgramInfoLog(C.GLuint(program), C.GLsizei(length), nil, (*C.GLchar)(log)) | |
- return C.GoString((*C.char)(log)) | |
+ err := strings.TrimSpace(C.GoString((*C.char)(log))) | |
+ if err != "No errors." { | |
+ return err | |
+ } | |
} | |
return "" | |
diff --git a/shader.go b/shader.go | |
index cd8514f..09e34a0 100644 | |
--- a/shader.go | |
+++ b/shader.go | |
@@ -12,6 +12,7 @@ package gl | |
// } | |
// | |
import "C" | |
+import "strings" | |
import "unsafe" | |
// Shader | |
@@ -31,7 +32,10 @@ func (shader Shader) GetInfoLog() string { | |
log := C.malloc(C.size_t(length)) | |
defer C.free(log) | |
C.glGetShaderInfoLog(C.GLuint(shader), C.GLsizei(length), nil, (*C.GLchar)(log)) | |
- return C.GoString((*C.char)(log)) | |
+ err := strings.TrimSpace(C.GoString((*C.char)(log))) | |
+ if err != "No errors." { | |
+ return err | |
+ } | |
} | |
return "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment