Example #1
0
func AttachShader(p Program, s Shader) {
	defer func() {
		errstr := errDrain()
		log.Printf("gl.AttachShader(%v, %v) %v", p, s, errstr)
	}()
	C.glAttachShader(p.c(), s.c())
}
Example #2
0
func createProgram(vertShaderSrc string, fragShaderSrc string) C.GLuint {
	vertShader := loadShader(C.GL_VERTEX_SHADER, vertShaderSrc)
	fragShader := loadShader(C.GL_FRAGMENT_SHADER, fragShaderSrc)
	prog := C.glCreateProgram()
	if prog == 0 {
		panic("Failed to create shader program")
	}
	C.glAttachShader(prog, vertShader)
	checkGLError()
	C.glAttachShader(prog, fragShader)
	checkGLError()
	C.glLinkProgram(prog)
	var linkStatus C.GLint
	C.glGetProgramiv(prog, C.GL_LINK_STATUS, &linkStatus)
	if linkStatus != C.GL_TRUE {
		log := GetProgramInfoLog(prog)
		panic(fmt.Errorf("Failed to link program: %v", log))
	}
	return prog
}
Example #3
0
func AttachShader(p Program, s Shader) {
	C.glAttachShader(p.c(), s.c())
}
Example #4
0
func AttachShader(
	program uint32, shader uint32) {
	C.glAttachShader(
		C.GLuint(program),
		C.GLuint(shader))
}
Example #5
0
File: gl.go Project: extrame/gl
// Attach attaches a shader object
func (p *Program) Attach(s Shader) {
	C.glAttachShader(p.i, C.GLuint(s))
}
Example #6
0
func (program *Program) AttachShader(shader Shader) {
	C.glAttachShader(program.id, C.GLuint(shader))
	program.shadersValid = false
}
Example #7
0
File: shader.go Project: eaburns/gl
// AttachShader attaches a shader object to a program object.
func (p Program) AttachShader(s Shader) {
	C.glAttachShader(C.GLuint(p), C.GLuint(s))
}
Example #8
0
func (program Program) AttachShader(shader Shader) {
	C.glAttachShader(C.GLuint(program), C.GLuint(shader))
}