FlowVisProgram Class Reference

Represents the OpenGL GLSL program which is used for rendering. More...

#include <flowvis_program.h>

List of all members.

Public Types

enum  Mode { M_BG_INTER, M_TEXTURE_ROTATION }

Public Member Functions

 FlowVisProgram (const char *name)
 ~FlowVisProgram ()
 Common Destructor (unbinding the currently running program).
void SetTransferFunctionTexture (GLuint tex)
 Set the texture representing the transfer function.
void SetBGDataTexture (GLuint tex)
 Set the texture representing the background data.
void SetVelocityTexture (GLuint tex)
 Set the texture representing the velocity field.
void SetArrowTexture (GLuint tex)
 Set the texture used for drawing arrows.
void SetGlyphTexture (GLuint tex)
 Set the texture used for drawing glyphs on streamlines.
void Use ()
 Make this program the current OpenGL program.
void Prepare ()
 Prepare the currently selected program - but don't start it yet.
void Start ()
 Start the currently prepared program.
void Stop ()
 Stop using any custom shaders.
void SetMode (Mode new_mode)
 Set the current shader mode.

Private Member Functions

GLuint CompileProgram (const char *name) const
 Compiles the GLSL program.
void RecompileWhenRequired ()
 Recompile the program if the mode changed (or on first run).

Private Attributes

GLuint m_transfer_texture_
 Texture representing the transfer function.
GLuint m_bgdata_texture_
 Texture representing the background data.
GLuint m_velocity_texture_
 Texture representing the velocity field.
GLuint m_arrow_texture_
 Texture used for drawing arrows.
GLuint m_glyph_texture_
 Texture used for drawing glyphs on streamlines.
GLuint program_
bool recompile_
std::string progname_
Mode m_mode


Detailed Description

Represents the OpenGL GLSL program which is used for rendering.

Definition at line 8 of file flowvis_program.h.


Member Enumeration Documentation

Enumerator:
M_BG_INTER  Used when interpolating background data.
M_TEXTURE_ROTATION  Used when rotating the textures of point sprites.

Definition at line 10 of file flowvis_program.h.


Constructor & Destructor Documentation

FlowVisProgram::FlowVisProgram ( const char *  name  )  [explicit]

The GLSL program is stored on the filesystem. Vertex and fragment shaders are stored in separate files which are found by appending ".v_source" and ".f_source" respectively.

Definition at line 29 of file flowvis_program.cpp.

References RecompileWhenRequired().

FlowVisProgram::~FlowVisProgram (  ) 

Common Destructor (unbinding the currently running program).

Definition at line 131 of file flowvis_program.cpp.

References program_.


Member Function Documentation

void FlowVisProgram::SetTransferFunctionTexture ( GLuint  tex  ) 

Set the texture representing the transfer function.

Definition at line 193 of file flowvis_program.cpp.

References m_transfer_texture_.

void FlowVisProgram::SetBGDataTexture ( GLuint  tex  ) 

Set the texture representing the background data.

Definition at line 183 of file flowvis_program.cpp.

References m_bgdata_texture_.

void FlowVisProgram::SetVelocityTexture ( GLuint  tex  ) 

Set the texture representing the velocity field.

Definition at line 188 of file flowvis_program.cpp.

References m_velocity_texture_.

void FlowVisProgram::SetArrowTexture ( GLuint  tex  ) 

Set the texture used for drawing arrows.

Definition at line 204 of file flowvis_program.cpp.

References m_arrow_texture_.

void FlowVisProgram::SetGlyphTexture ( GLuint  tex  ) 

Set the texture used for drawing glyphs on streamlines.

Definition at line 209 of file flowvis_program.cpp.

References m_glyph_texture_.

void FlowVisProgram::Use (  ) 

Make this program the current OpenGL program.

Definition at line 146 of file flowvis_program.cpp.

References Prepare(), and Start().

void FlowVisProgram::Prepare (  ) 

Prepare the currently selected program - but don't start it yet.

Definition at line 152 of file flowvis_program.cpp.

References m_bgdata_texture_, m_glyph_texture_, m_transfer_texture_, and RecompileWhenRequired().

Referenced by Use().

void FlowVisProgram::Start (  ) 

Start the currently prepared program.

Definition at line 169 of file flowvis_program.cpp.

References program_.

Referenced by Use().

void FlowVisProgram::Stop (  ) 

Stop using any custom shaders.

Definition at line 178 of file flowvis_program.cpp.

void FlowVisProgram::SetMode ( Mode  new_mode  ) 

Set the current shader mode.

Definition at line 198 of file flowvis_program.cpp.

References m_mode, and recompile_.

GLuint FlowVisProgram::CompileProgram ( const char *  name  )  const [private]

Compiles the GLSL program.

The GLSL program is stored on the filesystem. Vertex and fragment shaders are stored in separate files which are found by appending ".v_source" and ".f_source" respectively.

Definition at line 38 of file flowvis_program.cpp.

References LoadFile(), M_BG_INTER, m_mode, and M_TEXTURE_ROTATION.

Referenced by RecompileWhenRequired().

void FlowVisProgram::RecompileWhenRequired (  )  [private]

Recompile the program if the mode changed (or on first run).

Definition at line 136 of file flowvis_program.cpp.

References CompileProgram(), progname_, program_, and recompile_.

Referenced by FlowVisProgram(), and Prepare().


Member Data Documentation

Texture representing the transfer function.

Definition at line 62 of file flowvis_program.h.

Referenced by Prepare(), and SetTransferFunctionTexture().

Texture representing the background data.

Definition at line 65 of file flowvis_program.h.

Referenced by Prepare(), and SetBGDataTexture().

Texture representing the velocity field.

Definition at line 68 of file flowvis_program.h.

Referenced by SetVelocityTexture().

Texture used for drawing arrows.

Definition at line 71 of file flowvis_program.h.

Referenced by SetArrowTexture().

Texture used for drawing glyphs on streamlines.

Definition at line 74 of file flowvis_program.h.

Referenced by Prepare(), and SetGlyphTexture().

GLuint FlowVisProgram::program_ [private]

Definition at line 79 of file flowvis_program.h.

Referenced by RecompileWhenRequired(), Start(), and ~FlowVisProgram().

Definition at line 81 of file flowvis_program.h.

Referenced by RecompileWhenRequired(), and SetMode().

std::string FlowVisProgram::progname_ [private]

Definition at line 82 of file flowvis_program.h.

Referenced by RecompileWhenRequired().

Definition at line 84 of file flowvis_program.h.

Referenced by CompileProgram(), and SetMode().


The documentation for this class was generated from the following files:

Generated on Wed Jan 21 16:22:24 2009 for FlowVis by  doxygen 1.5.6