Beispiel #1
0
// PrintLog prints the error log for an object
func PrintLog(object uint32) {
	var logLength int32
	if gl.IsShader(object) {
		gl.GetShaderiv(object, gl.INFO_LOG_LENGTH, &logLength)
	} else if gl.IsProgram(object) {
		gl.GetProgramiv(object, gl.INFO_LOG_LENGTH, &logLength)
	} else {
		log.Fatal("PrintLog: not a shader or program")
	}

	infoLog := strings.Repeat("\x00", int(logLength+1))
	if gl.IsShader(object) {
		gl.GetShaderInfoLog(object, logLength, nil, gl.Str(infoLog))
	} else if gl.IsProgram(object) {
		gl.GetProgramInfoLog(object, logLength, nil, gl.Str(infoLog))
	}
	log.Fatal(infoLog)
}
Beispiel #2
0
// IsShader reports if s is valid shader.
//
// http://www.khronos.org/opengles/sdk/docs/man3/html/glIsShader.xhtml
func IsShader(s Shader) bool {
	return gl.IsShader(s.Value)
}