func GetShaderSource(s Shader) string { sourceLen := GetShaderi(s, SHADER_SOURCE_LENGTH) if sourceLen == 0 { return "" } buf := C.malloc(C.size_t(sourceLen)) defer C.free(buf) C.glGetShaderSource(s.c(), C.GLsizei(sourceLen), nil, (*C.GLchar)(buf)) return C.GoString((*C.char)(buf)) }
func GetShaderSource( shader uint32, bufsize Sizei, length *Sizei, source *string) { s := glString(*source) C.glGetShaderSource( C.GLuint(shader), C.GLsizei(bufsize), (*C.GLsizei)(length), s) source = goString(s) }
func (shader Shader) GetSource() string { var len C.GLint C.glGetShaderiv(C.GLuint(shader), C.GLenum(SHADER_SOURCE_LENGTH), &len) log := C.malloc(C.size_t(len + 1)) C.glGetShaderSource(C.GLuint(shader), C.GLsizei(len), nil, (*C.GLchar)(log)) defer C.free(log) return C.GoString((*C.char)(log)) }
func GetShaderSource(s Shader) (r0 string) { defer func() { errstr := errDrain() log.Printf("gl.GetShaderSource(%v) %v%v", s, r0, errstr) }() sourceLen := GetShaderi(s, SHADER_SOURCE_LENGTH) if sourceLen == 0 { return "" } buf := C.malloc(C.size_t(sourceLen)) defer C.free(buf) C.glGetShaderSource(s.c(), C.GLsizei(sourceLen), nil, (*C.GLchar)(buf)) return C.GoString((*C.char)(buf)) }
func GetShaderSource(shader uint, bufsize int) string { cs := CString("") //defer C.free(unsafe.Pointer(cs)) C.glGetShaderSource(C.GLuint(shader), C.GLsizei(bufsize), nil, cs) return GoString(cs) }