fluidvis
Public Member Functions | List of all members
sx::Shader Class Reference

#include <SXCore.h>

Inheritance diagram for sx::Shader:
sx::SXResource

Public Member Functions

EX Shader (const string &id)
 
EX ~Shader ()
 
EX void load ()
 
EX bool isLoaded () const
 
EX vector< string > getErrorLog () const
 
EX void addShader (const string &code, ShaderType type)
 
EX void addShaderFile (const string &path, ShaderType type)
 
EX void addTransformFeedbackBuffer (const string &identifier)
 
EX void use ()
 
EX bool isTessellating () const
 
EX bool isTransformFeedback () const
 
EX bool isFragmentShading () const
 
EX int getProgramID () const
 
EX const vector< string > & getTransformFeedbackBuffers () const
 
EX int getTransformFeedbackLocation (const string &identifyer)
 
EX int getUniformLocation (const string &identifyer)
 
EX int getTargetLocation (const string &identifyer)
 
EX int Shader::getAttribLocation (const std::string &identifyer)
 
EX void freeTextureSlots ()
 
EX unsigned int createTextureSlot ()
 
EX void lockTextureSlots ()
 
EX void unlockTextureSlots ()
 
- Public Member Functions inherited from sx::SXResource
virtual EX ~SXResource ()
 
EX const string & getID () const
 

Additional Inherited Members

- Protected Attributes inherited from sx::SXResource
string id
 

Detailed Description

a shader program

Constructor & Destructor Documentation

EX sx::Shader::Shader ( const string &  id)

default constructor

EX sx::Shader::~Shader ( )

deconstructor

Member Function Documentation

EX void sx::Shader::addShader ( const string &  code,
ShaderType  type 
)

adds new shadercode to newShaders, which will be compiled by load

EX void sx::Shader::addShaderFile ( const string &  path,
ShaderType  type 
)

adds path to new shadercode to newShaders, which will be loaded and compiled

EX void sx::Shader::addTransformFeedbackBuffer ( const string &  identifier)

Adds the identifier of a transform feedback buffer. After executing load(), this shader is a transform feedback shader, which should only be used between the calls beginCapture and endCapture in the class BufferedMesh.

EX unsigned int sx::Shader::createTextureSlot ( )

Returns the next free texture slot which can be used by a texture to be used with this shader.

EX void sx::Shader::freeTextureSlots ( )

Releases all texture slots from being used by shaders, which are not locked.

EX vector<string> sx::Shader::getErrorLog ( ) const

returns compilation/link errors generated turing the execution of load()

EX int sx::Shader::getProgramID ( ) const

Returns the program ID, which is internally used to access the shader program. If the shader is not initialized, the return value is not specified.

EX int sx::Shader::getTargetLocation ( const string &  identifyer)

Returns the location of an identifyer of a fragment output target. If the shader does not have a fragment output target named identifyer, a negative number is returned.

EX const vector<string>& sx::Shader::getTransformFeedbackBuffers ( ) const

returns the identifiers of the transform feedback buffers

EX int sx::Shader::getTransformFeedbackLocation ( const string &  identifyer)

Returns the location of the transform feedback buffer with ID identifyer. If no such transform feedback buffer exists, a negative number is returned.

EX int sx::Shader::getUniformLocation ( const string &  identifyer)

Returns the uniform location of an identifyer. If the shader does not have a uniform named identifyer, a negative number is returned.

EX bool sx::Shader::isFragmentShading ( ) const

returns true iff the program has a fragment shader

EX bool sx::Shader::isLoaded ( ) const
virtual
EX bool sx::Shader::isTessellating ( ) const

returns true iff the program was successfully loaded with a tessellation shader

EX bool sx::Shader::isTransformFeedback ( ) const

returns true iff

EX void sx::Shader::load ( )
virtual

Unloads the current program, and compiles and links all the shaders in newShaders

See also
SXResource::load()

Implements sx::SXResource.

EX void sx::Shader::lockTextureSlots ( )

Locks all the texture slots which are used currently. (from zero to newTextureSlot - 1) The locked texture slots are not affected by an invocation of freeTextureSlots() or use()

EX int sx::Shader::Shader::getAttribLocation ( const std::string &  identifyer)

Returns the location of an identifyer of a vertex attribute. If the shader does not have an attribute named identifyer, a negative number is returned.

EX void sx::Shader::unlockTextureSlots ( )

Undos the last lockTextureSlots operation, which has not been undone.

EX void sx::Shader::use ( )

Turns the shader into the current shader. If the shader isn't loaded, the method has no effect. Releases all unlocked texture slots.


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