fsleyes.gl.shaders.glsl.parse

This module implements a simple GLSL parser, for extracting information about a GLSL program.

Note

The code in this module is based on work by Nicolas P. Rougier (https://github.com/rougier/glsl-parser), which is released under the New BSD license.

The main entry point to this module is the parseGLSL() function which, given the source code of a GLSL program, parses it and returns information about the program.

fsleyes.gl.shaders.glsl.parse.getDeclarations(code)[source]

Get all declarations prefixed with a storage qualifier.

Code example

::
uniform lowp vec4 fg_color = vec4(1),
bg_color = vec4(vec3(0),1);
fsleyes.gl.shaders.glsl.parse.main()[source]

If this module is executed as a script, this function is called. It expects a path to a glsl file as a single parameter. This file is parsed, and information about it printed to standard output.