OGRE  2.1.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::GLSLProgram Class Referenceabstract

C++ encapsulation of GLSL program object. More...

#include <OgreGLSLProgram.h>

+ Inheritance diagram for Ogre::GLSLProgram:

Classes

class  CmdAttach
 Command object for attaching another GLSL Program. More...
 
class  CmdColumnMajorMatrices
 Command object for setting matrix packing in column-major order. More...
 
class  CmdInputOperationType
 Command object for setting the input operation type (geometry shader only) More...
 
class  CmdMaxOutputVertices
 Command object for setting the maximum output vertices (geometry shader only) More...
 
class  CmdOutputOperationType
 Command object for setting the output operation type (geometry shader only) More...
 
class  CmdPreprocessorDefines
 Command object for setting macro defines. More...
 

Public Member Functions

 GLSLProgram (GLSLShader *vertexProgram, GLSLShader *hullProgram, GLSLShader *domainProgram, GLSLShader *geometryProgram, GLSLShader *fragmentProgram, GLSLShader *computeProgram)
 Constructor should only be used by GLSLMonolithicProgramManager and GLSLSeparableProgramManager. More...
 
 GLSLProgram (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual, ManualResourceLoader *loader)
 
 ~GLSLProgram ()
 
virtual ~GLSLProgram (void)
 
virtual void activate (void)=0
 Makes a program object active by making sure it is linked and then putting it in use. More...
 
void attachChildShader (const String &name)
 Attach another GLSL Shader to this one. More...
 
void attachToProgramObject (const GLuint programObject)
 
bool compile (const bool checkErrors=false)
 Compile source into shader object. More...
 
GpuProgramParametersSharedPtr createParameters (void)
 Overridden from GpuProgram. More...
 
void detachFromProgramObject (const GLuint programObject)
 
virtual void extractLayoutQualifiers (void)
 Finds layout qualifiers in the shader source and sets attribute indices appropriately. More...
 
String getAttachedShaderNames () const
 
virtual GLint getAttributeIndex (VertexElementSemantic semantic, uint index)
 Get the index of a non-standard attribute bound in the linked code. More...
 
bool getColumnMajorMatrices (void) const
 Gets whether matrix packed in column-major order. More...
 
GLSLShadergetComputeShader () const
 
GLSLShadergetDomainShader () const
 
GLSLShadergetFragmentShader () const
 
GLSLShadergetGeometryShader () const
 
GLuint getGLProgramHandle () const
 
GLuint getGLProgramHandle (void) const
 Get the GL Handle for the program object. More...
 
GLuint getGLShaderHandle () const
 
GLSLShadergetHullShader () const
 
virtual RenderOperation::OperationType getInputOperationType (void) const
 Returns the operation type that this geometry program expects to receive as input. More...
 
const StringgetLanguage (void) const
 Overridden from GpuProgram. More...
 
virtual int getMaxOutputVertices (void) const
 Returns the maximum number of vertices that this geometry program can output in a single run. More...
 
virtual RenderOperation::OperationType getOutputOperationType (void) const
 Returns the operation type that this geometry program will emit. More...
 
bool getPassFogStates (void) const
 
bool getPassSurfaceAndLightStates (void) const
 
bool getPassTransformStates (void) const
 Overridden. More...
 
const StringgetPreprocessorDefines (void) const
 Sets the preprocessor defines use to compile the program. More...
 
GL3PlusOldVertexArrayObjectgetVertexArrayObject ()
 
GLSLShadergetVertexShader () const
 
bool isAttributeValid (VertexElementSemantic semantic, uint index)
 Is a non-standard attribute bound in the linked code? More...
 
bool isSkeletalAnimationIncluded (void) const
 Returns whether the linked program includes the required instructions to perform skeletal animation. More...
 
void setColumnMajorMatrices (bool columnMajor)
 Sets whether matrix packing in column-major order. More...
 
virtual void setInputOperationType (RenderOperation::OperationType operationType)
 Sets the operation type that this geometry program expects to receive. More...
 
virtual void setMaxOutputVertices (int maxOutputVertices)
 Set the maximum number of vertices that a single run of this geometry program can emit. More...
 
virtual void setOutputOperationType (RenderOperation::OperationType operationType)
 Set the operation type that this geometry program will emit. More...
 
void setPreprocessorDefines (const String &defines)
 Sets the preprocessor defines use to compile the program. More...
 
void setSkeletalAnimationIncluded (bool included)
 Sets whether the linked program includes the required instructions to perform skeletal animation. More...
 
virtual void updatePassIterationUniforms (GpuProgramParametersSharedPtr params)=0
 Updates program object uniforms using data from pass iteration GpuProgramParameters. More...
 
virtual void updateUniformBlocks (GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType)=0
 Updates program object uniform blocks using data from GpuProgramParameters. More...
 
virtual void updateUniforms (GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType)=0
 Updates program object uniforms using data from GpuProgramParameters. More...
 

Public Attributes

GLint mBaseInstanceLocation
 

Detailed Description

C++ encapsulation of GLSL program object.

Specialisation of HighLevelGpuProgram to provide support for OpenGL Shader Language (GLSL).

Remarks
GLSL has no target assembler or entry point specification like DirectX 9 HLSL. Vertex and Fragment shaders only have one entry point called "main".
When a shader is compiled, microcode is generated but can not be accessed by the application. GLSL also does not provide assembler low level output after compiling. The GL Render system assumes that the Gpu program is a GL Gpu program so GLSLProgram will create a GLSLGpuProgram that is subclassed from GLGpuProgram for the low level implementation. The GLSLProgram class will create a shader object and compile the source but will not create a program object. It's up to GLSLGpuProgram class to request a program object to link the shader object to.
Note
GLSL supports multiple modular shader objects that can be attached to one program object to form a single shader. This is supported through the "attach" material script command. All the modules to be attached are listed on the same line as the attach command separated by white space.

Constructor & Destructor Documentation

◆ GLSLProgram() [1/2]

Ogre::GLSLProgram::GLSLProgram ( GLSLShader vertexProgram,
GLSLShader hullProgram,
GLSLShader domainProgram,
GLSLShader geometryProgram,
GLSLShader fragmentProgram,
GLSLShader computeProgram 
)

Constructor should only be used by GLSLMonolithicProgramManager and GLSLSeparableProgramManager.

◆ ~GLSLProgram() [1/2]

virtual Ogre::GLSLProgram::~GLSLProgram ( void  )
virtual

◆ GLSLProgram() [2/2]

Ogre::GLSLProgram::GLSLProgram ( ResourceManager creator,
const String name,
ResourceHandle  handle,
const String group,
bool  isManual,
ManualResourceLoader loader 
)

◆ ~GLSLProgram() [2/2]

Ogre::GLSLProgram::~GLSLProgram ( )

Member Function Documentation

◆ activate()

virtual void Ogre::GLSLProgram::activate ( void  )
pure virtual

Makes a program object active by making sure it is linked and then putting it in use.

Implemented in Ogre::GLSLSeparableProgram, and Ogre::GLSLMonolithicProgram.

◆ attachChildShader()

void Ogre::GLSLProgram::attachChildShader ( const String name)

Attach another GLSL Shader to this one.

◆ attachToProgramObject()

void Ogre::GLSLProgram::attachToProgramObject ( const GLuint  programObject)

◆ compile()

bool Ogre::GLSLProgram::compile ( const bool  checkErrors = false)

Compile source into shader object.

◆ createParameters()

GpuProgramParametersSharedPtr Ogre::GLSLProgram::createParameters ( void  )

Overridden from GpuProgram.

◆ detachFromProgramObject()

void Ogre::GLSLProgram::detachFromProgramObject ( const GLuint  programObject)

◆ extractLayoutQualifiers()

virtual void Ogre::GLSLProgram::extractLayoutQualifiers ( void  )
virtual

Finds layout qualifiers in the shader source and sets attribute indices appropriately.

◆ getAttachedShaderNames()

String Ogre::GLSLProgram::getAttachedShaderNames ( ) const
inline

◆ getAttributeIndex()

virtual GLint Ogre::GLSLProgram::getAttributeIndex ( VertexElementSemantic  semantic,
uint  index 
)
virtual

Get the index of a non-standard attribute bound in the linked code.

Reimplemented in Ogre::GLSLSeparableProgram.

◆ getColumnMajorMatrices()

bool Ogre::GLSLProgram::getColumnMajorMatrices ( void  ) const
inline

Gets whether matrix packed in column-major order.

◆ getComputeShader()

GLSLShader* Ogre::GLSLProgram::getComputeShader ( ) const
inline

◆ getDomainShader()

GLSLShader* Ogre::GLSLProgram::getDomainShader ( ) const
inline

◆ getFragmentShader()

GLSLShader* Ogre::GLSLProgram::getFragmentShader ( ) const
inline

◆ getGeometryShader()

GLSLShader* Ogre::GLSLProgram::getGeometryShader ( ) const
inline

◆ getGLProgramHandle() [1/2]

GLuint Ogre::GLSLProgram::getGLProgramHandle ( ) const
inline

◆ getGLProgramHandle() [2/2]

GLuint Ogre::GLSLProgram::getGLProgramHandle ( void  ) const
inline

Get the GL Handle for the program object.

◆ getGLShaderHandle()

GLuint Ogre::GLSLProgram::getGLShaderHandle ( ) const
inline

◆ getHullShader()

GLSLShader* Ogre::GLSLProgram::getHullShader ( ) const
inline

◆ getInputOperationType()

virtual RenderOperation::OperationType Ogre::GLSLProgram::getInputOperationType ( void  ) const
inlinevirtual

Returns the operation type that this geometry program expects to receive as input.

◆ getLanguage()

const String& Ogre::GLSLProgram::getLanguage ( void  ) const

Overridden from GpuProgram.

◆ getMaxOutputVertices()

virtual int Ogre::GLSLProgram::getMaxOutputVertices ( void  ) const
inlinevirtual

Returns the maximum number of vertices that this geometry program can output in a single run.

◆ getOutputOperationType()

virtual RenderOperation::OperationType Ogre::GLSLProgram::getOutputOperationType ( void  ) const
inlinevirtual

Returns the operation type that this geometry program will emit.

◆ getPassFogStates()

bool Ogre::GLSLProgram::getPassFogStates ( void  ) const

◆ getPassSurfaceAndLightStates()

bool Ogre::GLSLProgram::getPassSurfaceAndLightStates ( void  ) const

◆ getPassTransformStates()

bool Ogre::GLSLProgram::getPassTransformStates ( void  ) const

Overridden.

◆ getPreprocessorDefines()

const String& Ogre::GLSLProgram::getPreprocessorDefines ( void  ) const
inline

Sets the preprocessor defines use to compile the program.

◆ getVertexArrayObject()

GL3PlusOldVertexArrayObject* Ogre::GLSLProgram::getVertexArrayObject ( )
inline

◆ getVertexShader()

GLSLShader* Ogre::GLSLProgram::getVertexShader ( ) const
inline

◆ isAttributeValid()

bool Ogre::GLSLProgram::isAttributeValid ( VertexElementSemantic  semantic,
uint  index 
)

Is a non-standard attribute bound in the linked code?

◆ isSkeletalAnimationIncluded()

bool Ogre::GLSLProgram::isSkeletalAnimationIncluded ( void  ) const
inline

Returns whether the linked program includes the required instructions to perform skeletal animation.

Remarks
If this returns true, OGRE will not blend the geometry according to skeletal animation, it will expect the vertex program to do it.

◆ setColumnMajorMatrices()

void Ogre::GLSLProgram::setColumnMajorMatrices ( bool  columnMajor)
inline

Sets whether matrix packing in column-major order.

◆ setInputOperationType()

virtual void Ogre::GLSLProgram::setInputOperationType ( RenderOperation::OperationType  operationType)
inlinevirtual

Sets the operation type that this geometry program expects to receive.

◆ setMaxOutputVertices()

virtual void Ogre::GLSLProgram::setMaxOutputVertices ( int  maxOutputVertices)
inlinevirtual

Set the maximum number of vertices that a single run of this geometry program can emit.

◆ setOutputOperationType()

virtual void Ogre::GLSLProgram::setOutputOperationType ( RenderOperation::OperationType  operationType)
inlinevirtual

Set the operation type that this geometry program will emit.

◆ setPreprocessorDefines()

void Ogre::GLSLProgram::setPreprocessorDefines ( const String defines)
inline

Sets the preprocessor defines use to compile the program.

◆ setSkeletalAnimationIncluded()

void Ogre::GLSLProgram::setSkeletalAnimationIncluded ( bool  included)
inline

Sets whether the linked program includes the required instructions to perform skeletal animation.

Remarks
If this is set to true, OGRE will not blend the geometry according to skeletal animation, it will expect the vertex program to do it.

◆ updatePassIterationUniforms()

virtual void Ogre::GLSLProgram::updatePassIterationUniforms ( GpuProgramParametersSharedPtr  params)
pure virtual

Updates program object uniforms using data from pass iteration GpuProgramParameters.

Normally called by GLSLShader::bindMultiPassParameters() just before multi pass rendering occurs.

Implemented in Ogre::GLSLSeparableProgram, and Ogre::GLSLMonolithicProgram.

◆ updateUniformBlocks()

virtual void Ogre::GLSLProgram::updateUniformBlocks ( GpuProgramParametersSharedPtr  params,
uint16  mask,
GpuProgramType  fromProgType 
)
pure virtual

Updates program object uniform blocks using data from GpuProgramParameters.

Normally called by GLSLShader::bindParameters() just before rendering occurs.

Implemented in Ogre::GLSLSeparableProgram, and Ogre::GLSLMonolithicProgram.

◆ updateUniforms()

virtual void Ogre::GLSLProgram::updateUniforms ( GpuProgramParametersSharedPtr  params,
uint16  mask,
GpuProgramType  fromProgType 
)
pure virtual

Updates program object uniforms using data from GpuProgramParameters.

Normally called by GLSLShader::bindParameters() just before rendering occurs.

Implemented in Ogre::GLSLSeparableProgram, and Ogre::GLSLMonolithicProgram.

Member Data Documentation

◆ mBaseInstanceLocation

GLint Ogre::GLSLProgram::mBaseInstanceLocation

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