示例#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
}