Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::Shader Class Reference

Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects. More...

#include <Shader.hpp>

Inheritance diagram for vl::Shader:

vl::Object

List of all members.

Public Member Functions

 Shader ()
virtual ~Shader ()
virtual const char * className ()
 Returns the name of the class.
GLSLProgramgocGLSLProgram ()
const GLSLProgramgetGLSLProgram () const
GLSLProgramgetGLSLProgram ()
PixelTransfergocPixelTransfer ()
const PixelTransfergetPixelTransfer () const
PixelTransfergetPixelTransfer ()
HintgocHint ()
const HintgetHint () const
HintgetHint ()
CullFacegocCullFace ()
const CullFacegetCullFace () const
CullFacegetCullFace ()
FrontFacegocFrontFace ()
const FrontFacegetFrontFace () const
FrontFacegetFrontFace ()
DepthFuncgocDepthFunc ()
const DepthFuncgetDepthFunc () const
DepthFuncgetDepthFunc ()
DepthMaskgocDepthMask ()
const DepthMaskgetDepthMask () const
DepthMaskgetDepthMask ()
ColorMaskgocColorMask ()
const ColorMaskgetColorMask () const
ColorMaskgetColorMask ()
PolygonModegocPolygonMode ()
const PolygonModegetPolygonMode () const
PolygonModegetPolygonMode ()
ShadeModelgocShadeModel ()
const ShadeModelgetShadeModel () const
ShadeModelgetShadeModel ()
BlendEquationgocBlendEquation ()
const BlendEquationgetBlendEquation () const
BlendEquationgetBlendEquation ()
AlphaFuncgocAlphaFunc ()
const AlphaFuncgetAlphaFunc () const
AlphaFuncgetAlphaFunc ()
MaterialgocMaterial ()
const MaterialgetMaterial () const
MaterialgetMaterial ()
LightModelgocLightModel ()
const LightModelgetLightModel () const
LightModelgetLightModel ()
FoggocFog ()
const FoggetFog () const
FoggetFog ()
PolygonOffsetgocPolygonOffset ()
const PolygonOffsetgetPolygonOffset () const
PolygonOffsetgetPolygonOffset ()
LogicOpgocLogicOp ()
const LogicOpgetLogicOp () const
LogicOpgetLogicOp ()
DepthRangegocDepthRange ()
const DepthRangegetDepthRange () const
DepthRangegetDepthRange ()
LineWidthgocLineWidth ()
const LineWidthgetLineWidth () const
LineWidthgetLineWidth ()
PointSizegocPointSize ()
const PointSizegetPointSize () const
PointSizegetPointSize ()
LineStipplegocLineStipple ()
const LineStipplegetLineStipple () const
LineStipplegetLineStipple ()
PolygonStipplegocPolygonStipple ()
const PolygonStipplegetPolygonStipple () const
PolygonStipplegetPolygonStipple ()
PointParametergocPointParameter ()
const PointParametergetPointParameter () const
PointParametergetPointParameter ()
StencilFuncgocStencilFunc ()
const StencilFuncgetStencilFunc () const
StencilFuncgetStencilFunc ()
StencilOpgocStencilOp ()
const StencilOpgetStencilOp () const
StencilOpgetStencilOp ()
StencilMaskgocStencilMask ()
const StencilMaskgetStencilMask () const
StencilMaskgetStencilMask ()
BlendColorgocBlendColor ()
const BlendColorgetBlendColor () const
BlendColorgetBlendColor ()
BlendFuncgocBlendFunc ()
const BlendFuncgetBlendFunc () const
BlendFuncgetBlendFunc ()
SampleCoveragegocSampleCoverage ()
const SampleCoveragegetSampleCoverage () const
SampleCoveragegetSampleCoverage ()
LightgocLight (int light_index)
const LightgetLight (int light_index) const
LightgetLight (int light_index)
ClipPlanegocClipPlane (int plane_index)
const ClipPlanegetClipPlane (int plane_index) const
ClipPlanegetClipPlane (int plane_index)
TextureUnitgocTextureUnit (int unit_index)
const TextureUnitgetTextureUnit (int unit_index) const
TextureUnitgetTextureUnit (int unit_index)
TexEnvgocTexEnv (int unit_index)
const TexEnvgetTexEnv (int unit_index) const
TexEnvgetTexEnv (int unit_index)
TexGengocTexGen (int unit_index)
const TexGengetTexGen (int unit_index) const
TexGengetTexGen (int unit_index)
TextureMatrixgocTextureMatrix (int unit_index)
const TextureMatrixgetTextureMatrix (int unit_index) const
TextureMatrixgetTextureMatrix (int unit_index)
void reset ()
void enable (EEnable capability)
void disable (EEnable capability)
const std::vector< EEnable > & enables () const
int isEnabled (EEnable capability) const
void disableAll ()
bool blendingEnabled () const
void setRenderState (RenderState *renderstate)
const RenderStaterenderState (ERenderState type) const
RenderStaterenderState (ERenderState type)
const std::vector< ref
< RenderState > > & 
renderStates () const
void eraseRenderState (ERenderState type)
void eraseRenderState (RenderState *rs)
void eraseAllRenderStates ()
const GLSLProgramglslProgram () const
 Returns the GLSLProgram associated to a Shader (if any).
GLSLProgramglslProgram ()
 Returns the GLSLProgram associated to a Shader (if any).
void setUniform (Uniform *uniform)
 Equivalent to gocUniformSet()->setUniform(...).
const std::vector< ref
< Uniform > > & 
uniforms () const
 Equivalent to gocUniformSet()->uniforms(...).
void eraseUniform (const std::string &name)
 Equivalent to gocUniformSet()->eraseUniform(...).
void eraseUniform (const Uniform *uniform)
 Equivalent to gocUniformSet()->eraseUniform(...).
void eraseAllUniforms ()
 Equivalent to gocUniformSet()->eraseAllUniforms(...).
UniformgocUniform (const std::string &name)
 Equivalent to gocUniformSet()->gocUniform(...).
UniformgetUniform (const std::string &name)
 Equivalent to gocUniformSet()->getUniform(...).
const UniformgetUniform (const std::string &name) const
 Equivalent to gocUniformSet()->getUniform(...).
EnableSetgocEnableSet ()
EnableSetgetEnableSet ()
const EnableSetgetEnableSet () const
RenderStateSetgocRenderStateSet ()
RenderStateSetgetRenderStateSet ()
const RenderStateSetgetRenderStateSet () const
UniformSetgocUniformSet ()
 Returns the UniformSet installed (creating it if no UniformSet has been installed).
UniformSetgetUniformSet ()
 Returns the UniformSet installed.
const UniformSetgetUniformSet () const
 Returns the UniformSet installed.
void setEnableSet (EnableSet *es)
void setRenderStateSet (RenderStateSet *rss)
void setUniformSet (UniformSet *us)
 Installs a new UniformSet.
void setScissor (Scissor *scissor)
 Sets the Scissor to be used when rendering an Actor.
const Scissorscissor () const
 Returns the Scissor to be used when rendering an Actor.
Scissorscissor ()
 Returns the Scissor to be used when rendering an Actor.
virtual void update (Camera *, Real)
 Virtual function used to update or animate a Shader during the rendering.
void setLastUpdateTime (Real time)
 Used internally.
Real lastUpdateTime () const
 Used internally.
void initResources ()

Protected Attributes

Real mLastUpdateTime
ref< RenderStateSetmRenderStateSet
ref< EnableSetmEnableSet
ref< UniformSetmUniformSet
ref< ScissormScissor


Detailed Description

Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects.

A Shader represents a rendering pass. Using the Effect class you can assign more rendering passes to an Actor. You can also specify different sets of rendering passes for each Effect LOD, for more information see Effect.

Remarks:
The Uniforms defined in the Actor and the ones defined in the Shader must not overlap, that is, an Actor must not define Uniforms present in the Shader and vice versa.
See also:
Effect, Actor

Constructor & Destructor Documentation

Shader::Shader (  ) 

Shader::~Shader (  )  [virtual]


Member Function Documentation

virtual const char* vl::Shader::className (  )  [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

GLSLProgram * Shader::gocGLSLProgram (  ) 

const GLSLProgram* vl::Shader::getGLSLProgram (  )  const [inline]

GLSLProgram* vl::Shader::getGLSLProgram (  )  [inline]

PixelTransfer * Shader::gocPixelTransfer (  ) 

const PixelTransfer* vl::Shader::getPixelTransfer (  )  const [inline]

PixelTransfer* vl::Shader::getPixelTransfer (  )  [inline]

Hint * Shader::gocHint (  ) 

const Hint* vl::Shader::getHint (  )  const [inline]

Hint* vl::Shader::getHint (  )  [inline]

CullFace * Shader::gocCullFace (  ) 

const CullFace* vl::Shader::getCullFace (  )  const [inline]

CullFace* vl::Shader::getCullFace (  )  [inline]

FrontFace * Shader::gocFrontFace (  ) 

const FrontFace* vl::Shader::getFrontFace (  )  const [inline]

FrontFace* vl::Shader::getFrontFace (  )  [inline]

DepthFunc * Shader::gocDepthFunc (  ) 

const DepthFunc* vl::Shader::getDepthFunc (  )  const [inline]

DepthFunc* vl::Shader::getDepthFunc (  )  [inline]

DepthMask * Shader::gocDepthMask (  ) 

const DepthMask* vl::Shader::getDepthMask (  )  const [inline]

DepthMask* vl::Shader::getDepthMask (  )  [inline]

ColorMask * Shader::gocColorMask (  ) 

const ColorMask* vl::Shader::getColorMask (  )  const [inline]

ColorMask* vl::Shader::getColorMask (  )  [inline]

PolygonMode * Shader::gocPolygonMode (  ) 

const PolygonMode* vl::Shader::getPolygonMode (  )  const [inline]

PolygonMode* vl::Shader::getPolygonMode (  )  [inline]

ShadeModel * Shader::gocShadeModel (  ) 

const ShadeModel* vl::Shader::getShadeModel (  )  const [inline]

ShadeModel* vl::Shader::getShadeModel (  )  [inline]

BlendEquation * Shader::gocBlendEquation (  ) 

const BlendEquation* vl::Shader::getBlendEquation (  )  const [inline]

BlendEquation* vl::Shader::getBlendEquation (  )  [inline]

AlphaFunc * Shader::gocAlphaFunc (  ) 

const AlphaFunc* vl::Shader::getAlphaFunc (  )  const [inline]

AlphaFunc* vl::Shader::getAlphaFunc (  )  [inline]

Material * Shader::gocMaterial (  ) 

const Material* vl::Shader::getMaterial (  )  const [inline]

Material* vl::Shader::getMaterial (  )  [inline]

LightModel * Shader::gocLightModel (  ) 

const LightModel* vl::Shader::getLightModel (  )  const [inline]

LightModel* vl::Shader::getLightModel (  )  [inline]

Fog * Shader::gocFog (  ) 

const Fog* vl::Shader::getFog (  )  const [inline]

Fog* vl::Shader::getFog (  )  [inline]

PolygonOffset * Shader::gocPolygonOffset (  ) 

const PolygonOffset* vl::Shader::getPolygonOffset (  )  const [inline]

PolygonOffset* vl::Shader::getPolygonOffset (  )  [inline]

LogicOp * Shader::gocLogicOp (  ) 

const LogicOp* vl::Shader::getLogicOp (  )  const [inline]

LogicOp* vl::Shader::getLogicOp (  )  [inline]

DepthRange * Shader::gocDepthRange (  ) 

const DepthRange* vl::Shader::getDepthRange (  )  const [inline]

DepthRange* vl::Shader::getDepthRange (  )  [inline]

LineWidth * Shader::gocLineWidth (  ) 

const LineWidth* vl::Shader::getLineWidth (  )  const [inline]

LineWidth* vl::Shader::getLineWidth (  )  [inline]

PointSize * Shader::gocPointSize (  ) 

const PointSize* vl::Shader::getPointSize (  )  const [inline]

PointSize* vl::Shader::getPointSize (  )  [inline]

LineStipple * Shader::gocLineStipple (  ) 

const LineStipple* vl::Shader::getLineStipple (  )  const [inline]

LineStipple* vl::Shader::getLineStipple (  )  [inline]

PolygonStipple * Shader::gocPolygonStipple (  ) 

const PolygonStipple* vl::Shader::getPolygonStipple (  )  const [inline]

PolygonStipple* vl::Shader::getPolygonStipple (  )  [inline]

PointParameter * Shader::gocPointParameter (  ) 

const PointParameter* vl::Shader::getPointParameter (  )  const [inline]

PointParameter* vl::Shader::getPointParameter (  )  [inline]

StencilFunc * Shader::gocStencilFunc (  ) 

const StencilFunc* vl::Shader::getStencilFunc (  )  const [inline]

StencilFunc* vl::Shader::getStencilFunc (  )  [inline]

StencilOp * Shader::gocStencilOp (  ) 

const StencilOp* vl::Shader::getStencilOp (  )  const [inline]

StencilOp* vl::Shader::getStencilOp (  )  [inline]

StencilMask * Shader::gocStencilMask (  ) 

const StencilMask* vl::Shader::getStencilMask (  )  const [inline]

StencilMask* vl::Shader::getStencilMask (  )  [inline]

BlendColor * Shader::gocBlendColor (  ) 

const BlendColor* vl::Shader::getBlendColor (  )  const [inline]

BlendColor* vl::Shader::getBlendColor (  )  [inline]

BlendFunc * Shader::gocBlendFunc (  ) 

const BlendFunc* vl::Shader::getBlendFunc (  )  const [inline]

BlendFunc* vl::Shader::getBlendFunc (  )  [inline]

SampleCoverage * Shader::gocSampleCoverage (  ) 

const SampleCoverage* vl::Shader::getSampleCoverage (  )  const [inline]

SampleCoverage* vl::Shader::getSampleCoverage (  )  [inline]

Light * Shader::gocLight ( int  light_index  ) 

const Light* vl::Shader::getLight ( int  light_index  )  const [inline]

Light* vl::Shader::getLight ( int  light_index  )  [inline]

ClipPlane * Shader::gocClipPlane ( int  plane_index  ) 

const ClipPlane* vl::Shader::getClipPlane ( int  plane_index  )  const [inline]

ClipPlane* vl::Shader::getClipPlane ( int  plane_index  )  [inline]

TextureUnit * Shader::gocTextureUnit ( int  unit_index  ) 

const TextureUnit* vl::Shader::getTextureUnit ( int  unit_index  )  const [inline]

TextureUnit* vl::Shader::getTextureUnit ( int  unit_index  )  [inline]

TexEnv * Shader::gocTexEnv ( int  unit_index  ) 

const TexEnv* vl::Shader::getTexEnv ( int  unit_index  )  const [inline]

TexEnv* vl::Shader::getTexEnv ( int  unit_index  )  [inline]

TexGen * Shader::gocTexGen ( int  unit_index  ) 

const TexGen* vl::Shader::getTexGen ( int  unit_index  )  const [inline]

TexGen* vl::Shader::getTexGen ( int  unit_index  )  [inline]

TextureMatrix * Shader::gocTextureMatrix ( int  unit_index  ) 

const TextureMatrix* vl::Shader::getTextureMatrix ( int  unit_index  )  const [inline]

TextureMatrix* vl::Shader::getTextureMatrix ( int  unit_index  )  [inline]

void vl::Shader::reset (  )  [inline]

void vl::Shader::enable ( EEnable  capability  )  [inline]

void vl::Shader::disable ( EEnable  capability  )  [inline]

const std::vector<EEnable>& vl::Shader::enables (  )  const [inline]

int vl::Shader::isEnabled ( EEnable  capability  )  const [inline]

void vl::Shader::disableAll (  )  [inline]

bool vl::Shader::blendingEnabled (  )  const [inline]

void vl::Shader::setRenderState ( RenderState renderstate  )  [inline]

const RenderState* vl::Shader::renderState ( ERenderState  type  )  const [inline]

RenderState* vl::Shader::renderState ( ERenderState  type  )  [inline]

const std::vector< ref<RenderState> >& vl::Shader::renderStates (  )  const [inline]

void vl::Shader::eraseRenderState ( ERenderState  type  )  [inline]

void vl::Shader::eraseRenderState ( RenderState rs  )  [inline]

void vl::Shader::eraseAllRenderStates (  )  [inline]

const GLSLProgram* vl::Shader::glslProgram (  )  const [inline]

Returns the GLSLProgram associated to a Shader (if any).

GLSLProgram* vl::Shader::glslProgram (  )  [inline]

Returns the GLSLProgram associated to a Shader (if any).

void vl::Shader::setUniform ( Uniform uniform  )  [inline]

Equivalent to gocUniformSet()->setUniform(...).

const std::vector< ref<Uniform> >& vl::Shader::uniforms (  )  const [inline]

Equivalent to gocUniformSet()->uniforms(...).

void vl::Shader::eraseUniform ( const std::string &  name  )  [inline]

Equivalent to gocUniformSet()->eraseUniform(...).

void vl::Shader::eraseUniform ( const Uniform uniform  )  [inline]

Equivalent to gocUniformSet()->eraseUniform(...).

void vl::Shader::eraseAllUniforms (  )  [inline]

Equivalent to gocUniformSet()->eraseAllUniforms(...).

Uniform* vl::Shader::gocUniform ( const std::string &  name  )  [inline]

Equivalent to gocUniformSet()->gocUniform(...).

Uniform* vl::Shader::getUniform ( const std::string &  name  )  [inline]

Equivalent to gocUniformSet()->getUniform(...).

const Uniform* vl::Shader::getUniform ( const std::string &  name  )  const [inline]

Equivalent to gocUniformSet()->getUniform(...).

EnableSet* vl::Shader::gocEnableSet (  )  [inline]

EnableSet* vl::Shader::getEnableSet (  )  [inline]

const EnableSet* vl::Shader::getEnableSet (  )  const [inline]

RenderStateSet* vl::Shader::gocRenderStateSet (  )  [inline]

RenderStateSet* vl::Shader::getRenderStateSet (  )  [inline]

const RenderStateSet* vl::Shader::getRenderStateSet (  )  const [inline]

UniformSet* vl::Shader::gocUniformSet (  )  [inline]

UniformSet* vl::Shader::getUniformSet (  )  [inline]

const UniformSet* vl::Shader::getUniformSet (  )  const [inline]

void vl::Shader::setEnableSet ( EnableSet es  )  [inline]

void vl::Shader::setRenderStateSet ( RenderStateSet rss  )  [inline]

void vl::Shader::setUniformSet ( UniformSet us  )  [inline]

void vl::Shader::setScissor ( Scissor scissor  )  [inline]

Sets the Scissor to be used when rendering an Actor.

Note:
You can also define a Scissor on a per-Actor basis using the function Actor::setScissor(). In case both the Shader's and the Actor's Scissor are defined the Actor's Scissor is used.
See also:

const Scissor* vl::Shader::scissor (  )  const [inline]

Returns the Scissor to be used when rendering an Actor.

See also:

Scissor* vl::Shader::scissor (  )  [inline]

Returns the Scissor to be used when rendering an Actor.

See also:

virtual void vl::Shader::update ( Camera ,
Real   
) [inline, virtual]

Virtual function used to update or animate a Shader during the rendering.

Parameters:
camera the camera used for the current rendering.
cur_t the current animation time.

void vl::Shader::setLastUpdateTime ( Real  time  )  [inline]

Used internally.

Real vl::Shader::lastUpdateTime (  )  const [inline]

Used internally.

void vl::Shader::initResources (  )  [inline]


Member Data Documentation


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

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Dec 29 13:57:01 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.