VolProgram Class Reference

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

#include <volprogram.h>

List of all members.

Classes

struct  CompileSettings
 Simple structure holding compile settings. More...

Public Types

enum  Mode { M_SLICE, M_3D_COLOR_CUBE, M_3D_RAYCAST }
 The mode tells the program what is about to be rendered. More...

Public Member Functions

 VolProgram (const char *name)
 Loads the GLSL Program from the filesystem.
 ~VolProgram ()
void SetMode (Mode mode)
 Set the current mode.
void SetVolumeTexture (GLuint texture)
 Set the volume texture to use.
void SetBackAndFrontTextures (GLuint back, GLuint front)
 Set the front and back textures used when raycasting.
void SetTransferFunctionTexture (GLuint tex)
 Set the texture representing the transfer function.
void Use ()
 Make this program the current OpenGL program.

Private Member Functions

GLuint CompileProgram (const char *name, const CompileSettings &settings) const
 Compiles the GLSL program.
void RecompileWhenRequired ()

Private Attributes

Mode mode_
bool recompile_
std::string progname_
 Identifies the shaders to use by rellative_path/shader_filenames (without extension).
OpenGL generated id's
GLuint program_
 Program id obtained through 'glCreateProgram'.
GLuint volume_texture_
 Texture id of 3D Texture holding density data.
GLuint front_texture_
 Texture id of 2D Texture holding flattened 3D color cube for front faces.
GLuint back_texture_
 Texture id of 2D Texture holding flattened 3D color cube for back faces.
GLuint transfer_texture_


Detailed Description

Represents the OpenGL GLSL program which is used for rendering.

Definition at line 8 of file volprogram.h.


Member Enumeration Documentation

The mode tells the program what is about to be rendered.

Enumerator:
M_SLICE  Used when drawing slices.
M_3D_COLOR_CUBE  Used when drawing the bounding cube.
M_3D_RAYCAST  Used when doing raycasting.

Definition at line 11 of file volprogram.h.


Constructor & Destructor Documentation

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

Loads the GLSL Program from the filesystem.

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 23 of file volprogram.cpp.

References RecompileWhenRequired().

VolProgram::~VolProgram (  ) 

Definition at line 109 of file volprogram.cpp.

References program_.


Member Function Documentation

GLuint VolProgram::CompileProgram ( const char *  name,
const CompileSettings settings 
) 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 29 of file volprogram.cpp.

References VolProgram::CompileSettings::mode.

Referenced by RecompileWhenRequired().

void VolProgram::RecompileWhenRequired (  )  [private]

void VolProgram::SetBackAndFrontTextures ( GLuint  back,
GLuint  front 
)

Set the front and back textures used when raycasting.

Definition at line 119 of file volprogram.cpp.

References back_texture_, and front_texture_.

Referenced by VolumeCanvas::Render3dView().

void VolProgram::SetMode ( Mode  mode  ) 

Set the current mode.

Definition at line 130 of file volprogram.cpp.

References mode_, and recompile_.

Referenced by VolumeCanvas::Render3dView(), and VolumeCanvas::RenderSliceView().

void VolProgram::SetTransferFunctionTexture ( GLuint  tex  ) 

Set the texture representing the transfer function.

Definition at line 125 of file volprogram.cpp.

References transfer_texture_.

Referenced by VolumeCanvas::Render3dView(), and VolumeCanvas::RenderSliceView().

void VolProgram::SetVolumeTexture ( GLuint  texture  ) 

Set the volume texture to use.

Definition at line 114 of file volprogram.cpp.

References volume_texture_.

Referenced by VolumeCanvas::Render3dView(), and VolumeCanvas::RenderSliceView().

void VolProgram::Use (  ) 

Make this program the current OpenGL program.

Definition at line 159 of file volprogram.cpp.

References back_texture_, front_texture_, program_, RecompileWhenRequired(), transfer_texture_, and volume_texture_.

Referenced by VolumeCanvas::Render3dView(), and VolumeCanvas::RenderSliceView().


Member Data Documentation

GLuint VolProgram::back_texture_ [private]

Texture id of 2D Texture holding flattened 3D color cube for back faces.

Definition at line 62 of file volprogram.h.

Referenced by SetBackAndFrontTextures(), and Use().

GLuint VolProgram::front_texture_ [private]

Texture id of 2D Texture holding flattened 3D color cube for front faces.

Definition at line 61 of file volprogram.h.

Referenced by SetBackAndFrontTextures(), and Use().

Definition at line 66 of file volprogram.h.

Referenced by RecompileWhenRequired(), and SetMode().

std::string VolProgram::progname_ [private]

Identifies the shaders to use by rellative_path/shader_filenames (without extension).

Definition at line 68 of file volprogram.h.

Referenced by RecompileWhenRequired().

GLuint VolProgram::program_ [private]

Program id obtained through 'glCreateProgram'.

Definition at line 59 of file volprogram.h.

Referenced by RecompileWhenRequired(), Use(), and ~VolProgram().

bool VolProgram::recompile_ [private]

Definition at line 67 of file volprogram.h.

Referenced by RecompileWhenRequired(), and SetMode().

Texture id of 1D Texture used by shader to mapping density values to color/opacity

Definition at line 63 of file volprogram.h.

Referenced by SetTransferFunctionTexture(), and Use().

GLuint VolProgram::volume_texture_ [private]

Texture id of 3D Texture holding density data.

Definition at line 60 of file volprogram.h.

Referenced by SetVolumeTexture(), and Use().


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

Generated on Wed Dec 17 17:14:22 2008 for VisLU by  doxygen 1.5.7.1