LoadShaderFromFile

>Psychtoolbox>PsychOpenGL

handle = LoadShaderFromFile(filename [, shadertype] [, debug=0])

Loads a GLSL OpenGL shader definition from textfile ‘filename’ and
creates an OpenGL GLSL shader of type ‘shadertype’. Returns a handle to
the new shader. If shadertype is omitted, the type of the shader is
derived from the filename extension: .vert == GL_VERTEX_SHADER, .frag ==
GL_FRAGMENT_SHADER, .geom == GL_GEOMETRY_SHADER, .tesscontrol =
GL_TESS_CONTROL_SHADER, .tesseval = GL_TESS_EVALUATION_SHADER. The
optional ‘debug’ flag allows to enable debugging output.

The optional ‘debug’ flag allows to enable debugging output:
Zero = no output, 1 = a bit of output, 2 = detailed output,
3 = Don’t compile and link anymore, but print out the shaders
source code as OpenGL would see it.

On successfull load & creation, a ‘handle’ to the new shader is returned.

Path   Retrieve current version from GitHub | View changelog
Psychtoolbox/PsychOpenGL/LoadShaderFromFile.m