View2DShaderGLSL Class Reference

specialized shader that uses ARB_fragment_program to implement a (up-to) 16 bit Hardware Lut More...

#include <View2DShaderGLSL.h>

Inheritance diagram for View2DShaderGLSL:

View2DTextureLUTShader View2DShader

List of all members.

Public Member Functions

 View2DShaderGLSL ()
virtual ~View2DShaderGLSL ()
virtual void bind (View2DTexture *texture, int tw, int th)
 binds/activates the shader
const char * name ()
 get the shader's name
virtual void unbind ()
 deactivates the shader
virtual void destroy ()
 destroy the previous shader

Static Public Member Functions

static bool runsInHardware ()
 returns if the shader is supported and would run in hardware (calling this method requires a valid GL context!)

Protected Member Functions

virtual bool create (View2DTexture *texture)
 creates the desired shader
bool create (const char *vertexShader, const char *fragmentShader)
 creates the shader and returns true if it worked.
void createCubicShader (std::stringstream &str, bool use16BitLut)
void createNearestShader (std::stringstream &str, bool use16BitLut)
void createLinearShader (std::stringstream &str, bool use16BitLut)

Static Protected Member Functions

static std::string getShaderErrors (GLuint shaderId)
 get current shader error log
static std::string getProgramErrors (GLuint programId)
 get current program error log

Protected Attributes

ml::GLSLFragmentShader _fragmentShader
ml::GLSLVertexShader _vertexShader
ml::GLSLProgram _program
View2DTextureFilter _lastFilter
size_t _lastDataSize


Detailed Description

specialized shader that uses ARB_fragment_program to implement a (up-to) 16 bit Hardware Lut

The RGBA LookupTable is loaded into a 2D texture of 256 pixels width and dynamic height. The texture lookups and color interpolation is done with two "assembly" fragment programs, one for bilinear interpolation and one for nearest neigbor interpolation. The shader interacts with the View2DTexture and it's bind message is called by each subtexture that the View2DTexture renders. This is done because the size of the textures changes and this size is needed as local parameters in the fragment program.

Definition at line 31 of file View2DShaderGLSL.h.


Constructor & Destructor Documentation

View2DShaderGLSL::View2DShaderGLSL (  ) 

virtual View2DShaderGLSL::~View2DShaderGLSL (  )  [virtual]


Member Function Documentation

virtual void View2DShaderGLSL::bind ( View2DTexture texture,
int  tw,
int  th 
) [virtual]

binds/activates the shader

Implements View2DShader.

bool View2DShaderGLSL::create ( const char *  vertexShader,
const char *  fragmentShader 
) [protected]

creates the shader and returns true if it worked.

virtual bool View2DShaderGLSL::create ( View2DTexture texture  )  [protected, virtual]

creates the desired shader

void View2DShaderGLSL::createCubicShader ( std::stringstream &  str,
bool  use16BitLut 
) [protected]

void View2DShaderGLSL::createLinearShader ( std::stringstream &  str,
bool  use16BitLut 
) [protected]

void View2DShaderGLSL::createNearestShader ( std::stringstream &  str,
bool  use16BitLut 
) [protected]

virtual void View2DShaderGLSL::destroy (  )  [virtual]

destroy the previous shader

Implements View2DShader.

static std::string View2DShaderGLSL::getProgramErrors ( GLuint  programId  )  [static, protected]

get current program error log

static std::string View2DShaderGLSL::getShaderErrors ( GLuint  shaderId  )  [static, protected]

get current shader error log

const char* View2DShaderGLSL::name (  )  [inline, virtual]

get the shader's name

Implements View2DShader.

Definition at line 41 of file View2DShaderGLSL.h.

static bool View2DShaderGLSL::runsInHardware (  )  [static]

returns if the shader is supported and would run in hardware (calling this method requires a valid GL context!)

virtual void View2DShaderGLSL::unbind (  )  [virtual]

deactivates the shader

Implements View2DShader.


Member Data Documentation

ml::GLSLFragmentShader View2DShaderGLSL::_fragmentShader [protected]

Definition at line 68 of file View2DShaderGLSL.h.

size_t View2DShaderGLSL::_lastDataSize [protected]

Definition at line 73 of file View2DShaderGLSL.h.

Definition at line 72 of file View2DShaderGLSL.h.

ml::GLSLProgram View2DShaderGLSL::_program [protected]

Definition at line 70 of file View2DShaderGLSL.h.

ml::GLSLVertexShader View2DShaderGLSL::_vertexShader [protected]

Definition at line 69 of file View2DShaderGLSL.h.


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

Generated on Sat Sep 3 18:39:33 2011 for MeVisLab Toolbox Reference by  doxygen 1.5.8