Ejemplo n.º 1
0
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))
}
Ejemplo n.º 2
0
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)
}
Ejemplo n.º 3
0
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))
}
Ejemplo n.º 4
0
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))
}
Ejemplo n.º 5
0
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)
}