#include <flowvis_program.h>
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 |
Definition at line 8 of file flowvis_program.h.
enum FlowVisProgram::Mode |
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.
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_.
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 | ( | ) |
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 | ( | ) |
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().
GLuint FlowVisProgram::m_transfer_texture_ [private] |
Texture representing the transfer function.
Definition at line 62 of file flowvis_program.h.
Referenced by Prepare(), and SetTransferFunctionTexture().
GLuint FlowVisProgram::m_bgdata_texture_ [private] |
Texture representing the background data.
Definition at line 65 of file flowvis_program.h.
Referenced by Prepare(), and SetBGDataTexture().
GLuint FlowVisProgram::m_velocity_texture_ [private] |
Texture representing the velocity field.
Definition at line 68 of file flowvis_program.h.
Referenced by SetVelocityTexture().
GLuint FlowVisProgram::m_arrow_texture_ [private] |
Texture used for drawing arrows.
Definition at line 71 of file flowvis_program.h.
Referenced by SetArrowTexture().
GLuint FlowVisProgram::m_glyph_texture_ [private] |
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().
bool FlowVisProgram::recompile_ [private] |
Definition at line 81 of file flowvis_program.h.
Referenced by RecompileWhenRequired(), and SetMode().
std::string FlowVisProgram::progname_ [private] |
Mode FlowVisProgram::m_mode [private] |