From c23d6ec61faf1997d84f2e51472fa9fbc73e2b6d Mon Sep 17 00:00:00 2001 From: osa Date: Fri, 21 Aug 2020 11:35:49 +0300 Subject: [PATCH] 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. --- src/Graphic3d/Graphic3d_ShaderProgram.hxx | 5 +++++ src/OpenGl/OpenGl_ShaderProgram.hxx | 3 +++ 2 files changed, 8 insertions(+) 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 {