예제 #1
0
파일: testlib.go 프로젝트: kebo/gorgasm
// Create a vertex shader from a string and return its reference.
func VertexShader(s string) uint32 {
	shader := gl.CreateShader(gl.VERTEX_SHADER)
	gl.ShaderSource(shader, 1, &s, nil)
	gl.CompileShader(shader)
	checkShaderCompileStatus(shader)
	return shader
}
예제 #2
0
파일: testlib.go 프로젝트: kebo/gorgasm
// Create a fragment shader from a string and return its reference.
func FragmentShader(s string) uint32 {
	shader := gl.CreateShader(gl.FRAGMENT_SHADER)
	gl.ShaderSource(shader, 1, &s, nil)
	gl.CompileShader(shader)
	checkShaderCompileStatus(shader)
	return shader
}
예제 #3
0
func compileShader(typeOfShader gl.Enum, source string) uint32 {
	if shader := gl.CreateShader(typeOfShader); shader != 0 {
		gl.ShaderSource(shader, 1, &source, nil)
		gl.CompileShader(shader)
		checkShaderCompileStatus(shader)
		return shader
	}
	return 0
}