// 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 }
// 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 }
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 }