fsleyes.gl.gl21.gltensor_funcs

This module provides functions which are used by the GLTensor class for rendering DTIFitTensor overlays, and compatible Image overlays in an OpenGL 2.1 compatible manner.

The rendering code makes use of the OpenGL ARB_draw_instanced extension so that voxel coordinates do not need to be repeated for every vertex of a single tensor.

For each voxel, the vertices of a unit sphere are passed to the gltensor vertex shader, which looks up the eigenvectors and values for the voxel, and transforms the sphere accordingly.

If the VectorOpts.colourImage property is not set, the glvector fragment shader is used to colour the tensors. Otherwise, the glvolume fragment shader is used to colour the tensors according to the specified colourImage. The functions in the gl21.glvector_funcs module are used to manage the fragment shader.

fsleyes.gl.gl21.gltensor_funcs.init(self)[source]

Calls compileShaders() and updateShaderState().

fsleyes.gl.gl21.gltensor_funcs.destroy(self)[source]

Deletes the GLSLShader.

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

Creates a GLSLShader for drawing this GLTensor. This is done via a call to gl21.glvector_funcs.compileShaders().

fsleyes.gl.gl21.gltensor_funcs.updateShaderState(self)[source]

Updates the state of the vertex and fragment shaders. The fragment shader is updated via the gl21.glvector_funcs.updateShaderState() function.

fsleyes.gl.gl21.gltensor_funcs.preDraw(self, xform=None, bbox=None)[source]

Must be called before draw(). Loads the shader programs, and does some shader state configuration.

fsleyes.gl.gl21.gltensor_funcs.draw2D(self, zpos, axes, xform=None, bbox=None)[source]

Generates voxel coordinates for each tensor to be drawn, does some final shader state configuration, and draws the tensors.

fsleyes.gl.gl21.gltensor_funcs.draw3D(self, xform=None, bbox=None)[source]
fsleyes.gl.gl21.gltensor_funcs.postDraw(self, xform=None, bbox=None)[source]

Unloads the shader program.