Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
OpenGl_ShaderManager::OpenGl_ShaderProgramFFP Class Reference

Fake OpenGL program for tracking FFP state in the way consistent to programmable pipeline. More...

#include <OpenGl_ShaderManager.hxx>

Inheritance diagram for OpenGl_ShaderManager::OpenGl_ShaderProgramFFP:

Protected Member Functions

 OpenGl_ShaderProgramFFP ()
Protected Member Functions inherited from OpenGl_ShaderProgram
bool Share ()
 Increments counter of users. Used by OpenGl_ShaderManager.
bool UnShare ()
 Decrements counter of users. Used by OpenGl_ShaderManager.
bool link (const occ::handle< OpenGl_Context > &theCtx)
 Links the program object.

Additional Inherited Members

typedef void base_type
 Returns a type descriptor about this object.
Public Member Functions inherited from OpenGl_ShaderProgram
 OpenGl_ShaderProgram (const occ::handle< Graphic3d_ShaderProgram > &theProxy=nullptr, const TCollection_AsciiString &theId="")
 Creates uninitialized shader program.
 ~OpenGl_ShaderProgram () override
 Releases resources of shader program.
bool Create (const occ::handle< OpenGl_Context > &theCtx)
 Creates new empty shader program of specified type.
void Release (OpenGl_Context *theCtx) override
 Destroys shader program.
size_t EstimatedDataSize () const override
 Returns estimated GPU memory usage - cannot be easily estimated.
bool AttachShader (const occ::handle< OpenGl_Context > &theCtx, const occ::handle< OpenGl_ShaderObject > &theShader)
 Attaches shader object to the program object.
bool DetachShader (const occ::handle< OpenGl_Context > &theCtx, const occ::handle< OpenGl_ShaderObject > &theShader)
 Detaches shader object to the program object.
bool Initialize (const occ::handle< OpenGl_Context > &theCtx, const NCollection_Sequence< occ::handle< Graphic3d_ShaderObject > > &theShaders)
 Initializes program object with the list of shader objects.
bool Link (const occ::handle< OpenGl_Context > &theCtx, bool theIsVerbose=true)
 Links the program object.
bool FetchInfoLog (const occ::handle< OpenGl_Context > &theCtx, TCollection_AsciiString &theLog)
 Fetches information log of the last link operation.
bool ApplyVariables (const occ::handle< OpenGl_Context > &theCtx)
 Fetches uniform variables from proxy shader program.
const occ::handle< Graphic3d_ShaderProgram > & Proxy () const
bool IsValid () const
GLuint ProgramId () const
bool HasTessellationStage () const
 Return TRUE if program defines tessellation stage.
int NbLightsMax () const
 Return the length of array of light sources (THE_MAX_LIGHTS), to be used for initialization occLightSources (OpenGl_OCC_LIGHT_SOURCE_PARAMS).
int NbShadowMaps () const
 Return the length of array of shadow maps (THE_NB_SHADOWMAPS); 0 by default.
int NbClipPlanesMax () const
 Return the length of array of clipping planes (THE_MAX_CLIP_PLANES), to be used for initialization occClipPlaneEquations (OpenGl_OCC_CLIP_PLANE_EQUATIONS) and occClipPlaneChains (OpenGl_OCC_CLIP_PLANE_CHAINS).
int NbFragmentOutputs () const
 Return the length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS), to be used for initialization occFragColorArray/occFragColorN.
bool HasAlphaTest () const
 Return true if Fragment Shader should perform alpha test; FALSE by default.
Graphic3d_RenderTransparentMethod OitOutput () const
 Return if Fragment Shader color should output the OIT values; OFF by default.
int TextureSetBits () const
 Return texture units declared within the program,.
OpenGl_ShaderUniformLocation GetUniformLocation (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName) const
 Returns location of the specific uniform variable.
GLint GetAttributeLocation (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName) const
 Returns index of the generic vertex attribute by variable name.
const OpenGl_ShaderUniformLocation & GetStateLocation (OpenGl_StateVariable theVariable) const
 Returns location of the OCCT state uniform variable.
template<typename ValueType>
bool GetUniform (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, ValueType &theValue) const
 Returns the value of the uniform variable from given name.
bool GetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, NCollection_Vec4< int > &theValue) const
 Returns the value of the integer uniform variable. Wrapper for glGetUniformiv()
bool GetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, NCollection_Vec4< float > &theValue) const
 Returns the value of the float uniform variable. Wrapper for glGetUniformfv()
template<typename ValueType>
bool GetAttribute (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, ValueType &theValue) const
 Returns the vertex attribute from given name.
bool GetAttribute (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, NCollection_Vec4< int > &theValue) const
 Returns the integer vertex attribute. Wrapper for glGetVertexAttribiv()
bool GetAttribute (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, NCollection_Vec4< float > &theValue) const
 Returns the float vertex attribute. Wrapper for glGetVertexAttribfv()
bool SetAttributeName (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, const GLchar *theName)
 Wrapper for glBindAttribLocation()
template<typename ValueType>
bool SetAttribute (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, const ValueType &theValue)
 Wrapper for glVertexAttrib*() for attribute with the given name.
bool SetAttribute (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, GLfloat theValue)
 Wrapper for glVertexAttrib1f()
bool SetAttribute (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, const NCollection_Vec2< float > &theValue)
 Wrapper for glVertexAttrib2fv()
bool SetAttribute (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, const NCollection_Vec3< float > &theValue)
 Wrapper for glVertexAttrib3fv()
bool SetAttribute (const occ::handle< OpenGl_Context > &theCtx, GLint theIndex, const NCollection_Vec4< float > &theValue)
 Wrapper for glVertexAttrib4fv()
template<typename ValueType>
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, const ValueType &theValue)
 Specifies the value of the uniform variable with given name.
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLint theValue)
 Specifies the value of the integer uniform variable. Wrapper for glUniform1i()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec2< int > &theValue)
 Specifies the value of the integer uniform 2D vector. Wrapper for glUniform2iv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec3< int > &theValue)
 Specifies the value of the integer uniform 3D vector. Wrapper for glUniform3iv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec4< int > &theValue)
 Specifies the value of the integer uniform 4D vector. Wrapper for glUniform4iv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec2< unsigned int > &theValue)
 Specifies the value of the unsigned integer uniform 2D vector (uvec2). Wrapper for glUniform2uiv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, const GLsizei theCount, const NCollection_Vec2< unsigned int > *theValue)
 Specifies the value of the uvec2 uniform array Wrapper for glUniform2uiv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const GLsizei theCount, const NCollection_Vec2< unsigned int > *theValue)
 Specifies the value of the uvec2 uniform array Wrapper for glUniform2uiv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLfloat theValue)
 Specifies the value of the float uniform variable. Wrapper for glUniform1f()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec2< float > &theValue)
 Specifies the value of the float uniform 2D vector. Wrapper for glUniform2fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec3< float > &theValue)
 Specifies the value of the float uniform 3D vector. Wrapper for glUniform3fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Vec4< float > &theValue)
 Specifies the value of the float uniform 4D vector. Wrapper for glUniform4fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Mat3< float > *theData)
 Specifies the value of the array of float uniform 3x3 matrices. Wrapper over glUniformMatrix3fv().
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, const NCollection_Mat3< float > &theValue, GLboolean theTranspose=GL_FALSE)
 Specifies the value of the float uniform 3x3 matrix. Wrapper for glUniformMatrix3fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Mat3< float > &theValue, GLboolean theTranspose=GL_FALSE)
 Specifies the value of the float uniform 3x3 matrix. Wrapper for glUniformMatrix3fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, const NCollection_Mat4< float > &theValue, GLboolean theTranspose=GL_FALSE)
 Specifies the value of the float uniform 4x4 matrix. Wrapper for glUniformMatrix4fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const NCollection_Mat4< float > &theValue, GLboolean theTranspose=GL_FALSE)
 Specifies the value of the float uniform 4x4 matrix. Wrapper for glUniformMatrix4fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Mat4< float > *theData)
 Specifies the value of the array of float uniform 4x4 matrices. Wrapper over glUniformMatrix4fv().
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const float *theData)
 Specifies the value of the float uniform array Wrapper over glUniform1fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Vec2< float > *theData)
 Specifies the value of the float2 uniform array Wrapper over glUniform2fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Vec3< float > *theData)
 Specifies the value of the float3 uniform array Wrapper over glUniform3fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Vec4< float > *theData)
 Specifies the value of the float4 uniform array Wrapper over glUniform4fv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const int *theData)
 Specifies the value of the integer uniform array Wrapper over glUniform1iv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Vec2< int > *theData)
 Specifies the value of the int2 uniform array Wrapper over glUniform2iv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Vec3< int > *theData)
 Specifies the value of the int3 uniform array Wrapper over glUniform3iv()
bool SetUniform (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, GLuint theCount, const NCollection_Vec4< int > *theData)
 Specifies the value of the int4 uniform array Wrapper over glUniform4iv()
bool SetSampler (const occ::handle< OpenGl_Context > &theCtx, const GLchar *theName, const Graphic3d_TextureUnit theTextureUnit)
 Specifies the value of the sampler uniform variable.
bool SetSampler (const occ::handle< OpenGl_Context > &theCtx, GLint theLocation, const Graphic3d_TextureUnit theTextureUnit)
 Specifies the value of the sampler uniform variable.
bool UpdateDebugDump (const occ::handle< OpenGl_Context > &theCtx, const TCollection_AsciiString &theFolder="", bool theToBeautify=false, bool theToReset=false)
 Update the shader program from external files (per shader stage) in the following way: 1) If external file does not exist, then it will be created (current source code will be dumped, no recompilation) and FALSE will be returned. 2) If external file exists and it has the same timestamp as myDumpDate, nothing will be done and FALSE will be returned. 3) If external file exists and it has newer timestamp than myDumpDate, shader will be recompiled and relinked and TRUE will be returned.
Public Member Functions inherited from OpenGl_NamedResource
 OpenGl_NamedResource (const TCollection_AsciiString &theId)
 Empty constructor.
const TCollection_AsciiString & ResourceId () const
 Return resource name.
Public Member Functions inherited from OpenGl_Resource
 OpenGl_Resource ()
 Empty constructor.
 ~OpenGl_Resource () override
 Destructor. Inheritors should call Clean (NULL) within it.
virtual void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
Standard_Transient & operator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
Standard_Transient * This () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
int GetRefCount () const noexcept
 Get the reference counter of this object.
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
virtual void Delete () const
 Memory deallocator for transient classes.
Static Public Member Functions inherited from OpenGl_ShaderProgram
static bool compileShaderVerbose (const occ::handle< OpenGl_Context > &theCtx, const occ::handle< OpenGl_ShaderObject > &theShader, const TCollection_AsciiString &theSource, bool theToPrintSource=true)
 Wrapper for compiling shader object with verbose printing on error.
static constexpr const char * get_type_name ()
 Returns a type descriptor about this object.
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
Static Public Attributes inherited from OpenGl_ShaderProgram
static const GLuint NO_PROGRAM = 0
 Non-valid shader name.
static const GLint INVALID_LOCATION = -1
 Invalid location of uniform/attribute variable.
static const char * PredefinedKeywords [OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES]
 List of pre-defined OCCT state uniform variables.
Protected Attributes inherited from OpenGl_ShaderProgram
GLuint myProgramID
 Handle of OpenGL shader program.
NCollection_Sequence< occ::handle< OpenGl_ShaderObject > > myShaderObjects
 List of attached shader objects.
occ::handle< Graphic3d_ShaderProgram > myProxy
 Proxy shader program (from application layer)
int myShareCount
 program users count, initialized with 1 (already shared by one user)
int myNbLightsMax
 length of array of light sources (THE_MAX_LIGHTS)
int myNbShadowMaps
 length of array of shadow maps (THE_NB_SHADOWMAPS)
int myNbClipPlanesMax
 length of array of clipping planes (THE_MAX_CLIP_PLANES)
int myNbFragOutputs
 length of array of Fragment Shader outputs (THE_NB_FRAG_OUTPUTS)
int myTextureSetBits
 texture units declared within the program,
Graphic3d_RenderTransparentMethod myOitOutput
 flag indicating that Fragment Shader includes OIT outputs
bool myHasAlphaTest
 flag indicating that Fragment Shader should perform alpha-test
bool myHasTessShader
 flag indicating that program defines tessellation stage
size_t myCurrentState [OpenGl_UniformStateType_NB]
 defines last modification for variables of each state type
OpenGl_ShaderUniformLocation myStateLocations [OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES]
 Stores locations of OCCT state uniform variables.
Protected Attributes inherited from OpenGl_NamedResource
TCollection_AsciiString myResourceId
 resource name
Static Protected Attributes inherited from OpenGl_ShaderProgram
static OpenGl_VariableSetterSelector mySetterSelector

Detailed Description

Fake OpenGL program for tracking FFP state in the way consistent to programmable pipeline.

Constructor & Destructor Documentation

◆ OpenGl_ShaderProgramFFP()

OpenGl_ShaderManager::OpenGl_ShaderProgramFFP::OpenGl_ShaderProgramFFP ( )
inlineprotected

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