From: osa Date: Fri, 21 Aug 2020 08:35:49 +0000 (+0300) Subject: 0031715: Visualization, OpenGl_ShaderProgram - add access to proxy shader program. X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=c23d6ec61faf1997d84f2e51472fa9fbc73e2b6d;p=occt-copy.git 0031715: Visualization, OpenGl_ShaderProgram - add access to proxy shader program. Back porting of setting unique ID for shader program used to manage resource in graphic driver. --- diff --git a/src/Graphic3d/Graphic3d_ShaderProgram.hxx b/src/Graphic3d/Graphic3d_ShaderProgram.hxx index 5118e177ff..3ff305e319 100755 --- a/src/Graphic3d/Graphic3d_ShaderProgram.hxx +++ b/src/Graphic3d/Graphic3d_ShaderProgram.hxx @@ -49,6 +49,11 @@ public: //! Returns unique ID used to manage resource in graphic driver. const TCollection_AsciiString& GetId() const { return myID; } + //! Sets unique ID used to manage resource in graphic driver. + //! WARNING! Graphic3d_ShaderProgram constructor generates a unique id for proper resource management; + //! however if application overrides it, it is responsibility of application to avoid name collisions. + void SetId (const TCollection_AsciiString& theId) { myID = theId; } + //! Returns GLSL header (version code and extensions). const TCollection_AsciiString& Header() const { return myHeader; } diff --git a/src/OpenGl/OpenGl_ShaderProgram.hxx b/src/OpenGl/OpenGl_ShaderProgram.hxx index 702b399a04..897525028d 100755 --- a/src/OpenGl/OpenGl_ShaderProgram.hxx +++ b/src/OpenGl/OpenGl_ShaderProgram.hxx @@ -201,6 +201,9 @@ public: //! Fetches uniform variables from proxy shader program. Standard_EXPORT Standard_Boolean ApplyVariables (const Handle(OpenGl_Context)& theCtx); + //! @return proxy shader program. + const Handle(Graphic3d_ShaderProgram)& Proxy() const { return myProxy; } + //! @return true if current object was initialized inline bool IsValid() const {