Example #1
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)
}
Example #2
0
func ShaderLocation(glProg gl.Uint, name string, isAtt bool) gl.Int {
	var loc gl.Int
	var s = gl.GLString(name)
	defer gl.GLStringFree(s)
	if isAtt {
		loc = gl.GetAttribLocation(glProg, s)
	} else {
		loc = gl.GetUniformLocation(glProg, s)
	}
	// if loc < 0 { log.Panicf("sprog att/uni %s: bind error %d", name, loc) }
	// PanicIfErrors("ShaderLocation(n=%v a=%v)", name, isAtt)
	LastErrors()
	return loc
}
Example #3
0
File: gl.go Project: vron/fm
func GetUniformLocation(p g.Uint, s string) g.Int {
	cstr := g.GLString(s)
	defer g.GLStringFree(cstr)
	return g.GetUniformLocation(p, cstr)
}