#include <Graphic3d_ShaderObject.hxx>
#include <Graphic3d_ShaderProgram.hxx>
-#include <InterfaceGraphic_tgl_all.hxx>
-
#include <OpenGl_Vec.hxx>
#include <OpenGl_Matrix.hxx>
#include <OpenGl_ShaderObject.hxx>
-#include <Handle_OpenGl_ShaderProgram.hxx>
+
+class OpenGl_ShaderProgram;
+DEFINE_STANDARD_HANDLE(OpenGl_ShaderProgram, OpenGl_Resource)
//! The enumeration of OCCT-specific OpenGL/GLSL variables.
enum OpenGl_StateVariable
// OpenGL clip planes state
OpenGl_OCC_CLIP_PLANE_EQUATIONS,
- OpenGl_OCC_CLIP_PLANE_SPACES,
OpenGl_OCC_CLIP_PLANE_COUNT,
// OpenGL light state
OpenGl_OCCT_BACK_MATERIAL,
OpenGl_OCCT_COLOR,
+ OpenGl_OCCT_TEXTURE_TRSF2D,
OpenGl_OCCT_POINT_SIZE,
// DON'T MODIFY THIS ITEM (insert new items before it)
OpenGl_MODEL_WORLD_STATE,
OpenGl_WORLD_VIEW_STATE,
OpenGl_PROJECTION_STATE,
- OpenGl_MATERIALS_STATE
+ OpenGl_MATERIALS_STATE,
+ OpenGl_SURF_DETAIL_STATE
};
//! Total number of state types.
//! Wrapper for OpenGL program object.
class OpenGl_ShaderProgram : public OpenGl_Resource
{
- friend class OpenGl_Workspace;
+ friend class OpenGl_View;
public:
//! List of pre-defined OCCT state uniform variables.
static Standard_CString PredefinedKeywords[OpenGl_OCCT_NUMBER_OF_STATE_VARIABLES];
-protected:
-
//! Creates uninitialized shader program.
+ //!
+ //! WARNING! This constructor is not intended to be called anywhere but from OpenGl_ShaderManager::Create().
+ //! Manager has been designed to synchronize camera position, lights definition and other aspects of the program implicitly,
+ //! as well as sharing same program across rendering groups.
+ //!
+ //! Program created outside the manager will be left detached from these routines,
+ //! and them should be performed manually by caller.
+ //!
+ //! This constructor has been made public to provide more flexibility to re-use OCCT OpenGL classes without OCCT Viewer itself.
+ //! If this is not the case - create the program using shared OpenGl_ShaderManager instance instead.
Standard_EXPORT OpenGl_ShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProxy = NULL);
+protected:
+
static OpenGl_VariableSetterSelector mySetterSelector;
public:
Standard_EXPORT Standard_Boolean Create (const Handle(OpenGl_Context)& theCtx);
//! Destroys shader program.
- Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
+ Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
//! Attaches shader object to the program object.
Standard_EXPORT Standard_Boolean AttachShader (const Handle(OpenGl_Context)& theCtx,
public:
- //! Specifies the value of the 64-bit unsigned integer uniform variable.
+ //! Specifies the value of the unsigned integer uniform 2D vector (uvec2).
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
const GLchar* theName,
- GLuint64 theValue);
+ const OpenGl_Vec2u& theValue);
- //! Specifies the value of the 64-bit unsigned integer uniform variable.
+ //! Specifies the value of the unsigned integer uniform 2D vector (uvec2).
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
GLint theLocation,
- GLuint64 theValue);
+ const OpenGl_Vec2u& theValue);
- //! Specifies the value of the 64-bit unsigned integer uniform array.
+ //! Specifies the value of the uvec2 uniform array
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
const GLchar* theName,
const GLsizei theCount,
- const GLuint64* theValue);
+ const OpenGl_Vec2u* theValue);
- //! Specifies the value of the 64-bit unsigned integer uniform array.
+ //! Specifies the value of the uvec2 uniform array
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
GLint theLocation,
const GLsizei theCount,
- const GLuint64* theValue);
+ const OpenGl_Vec2u* theValue);
public:
public:
- DEFINE_STANDARD_RTTI (OpenGl_ShaderProgram)
+ DEFINE_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource)
friend class OpenGl_ShaderManager;
};