Example #1
0
func VertexShader(s string) gl.Uint {

	shader := gl.CreateShader(gl.VERTEX_SHADER)
	gl.ShaderSource(shader, 1, &s, nil)
	gl.CompileShader(shader)
	var stat gl.Int
	gl.GetShaderiv(shader, gl.COMPILE_STATUS, &stat)
	if stat != 0 {
		log.Fatalln(stat)
	}
	return shader
}
Example #2
0
func FragmentShader(s string) uint32 {
	shader := gl.CreateShader(gl.FRAGMENT_SHADER)
	gl.ShaderSource(shader, 1, &s, nil)
	gl.CompileShader(shader)
	var stat int32
	gl.GetShaderiv(shader, gl.COMPILE_STATUS, &stat)
	if stat != 0 {
		log.Fatalln(stat)
	}
	return shader

}