fsleyes.gl.gl21.glmesh_funcs

This module provides functions which are used by the GLMesh class to render Mesh overlays in an OpenGL 2.1 compatible manner.

A GLSLShader is used to manage the glmesh vertex/fragment shader programs.

fsleyes.gl.gl21.glmesh_funcs.compileShaders(self)[source]

Loads the glmesh vertex/fragment shader source and creates GLSLShader instance(s).

fsleyes.gl.gl21.glmesh_funcs.updateShaderState(self, **kwargs)[source]

Updates the shader program according to the current MeshOpts` configuration.

fsleyes.gl.gl21.glmesh_funcs.preDraw(self)[source]

Must be called before draw(). Loads the appropriate shader program.

fsleyes.gl.gl21.glmesh_funcs.draw(self, glType, vertices, indices=None, normals=None, vdata=None, mdata=None)[source]

Called for 3D meshes, and when MeshOpts.vertexData is not None. Loads and runs the shader program.

Parameters
  • glType – The OpenGL primitive type.

  • vertices(n, 3) array containing the line vertices to draw.

  • indices – Indices into the vertices array. If not provided, glDrawArrays is used.

  • normals – Vertex normals.

  • vdata(n, ) array containing data for each vertex.

  • mdata(n, ) array containing alpha modulation data for each vertex.

fsleyes.gl.gl21.glmesh_funcs.postDraw(self)[source]

Must be called after draw(). Unloads shaders, and unbinds textures.