Example #1
0
func glGetInfoLog(shaderOrProgram gl.Uint, isShader bool) string {
	var l = gl.Sizei(256)
	var s = gl.GLStringAlloc(l)
	defer gl.GLStringFree(s)
	if isShader {
		gl.GetShaderInfoLog(shaderOrProgram, l, nil, s)
	} else {
		gl.GetProgramInfoLog(shaderOrProgram, l, nil, s)
	}
	return gl.GoString(s)
}
Example #2
0
func glGetLocation(glProg gl.Uint, name string, isAtt bool) gl.Uint {
	var a gl.Int
	var s = gl.GLString(name)
	defer gl.GLStringFree(s)
	if isAtt {
		a = gl.GetAttribLocation(glProg, s)
	} else {
		a = gl.GetUniformLocation(glProg, s)
	}
	if a < 0 {
		panic("Shader attribute or uniform bind error")
	}
	return gl.Uint(a)
}