From: kgv Date: Wed, 13 Nov 2013 17:04:52 +0000 (+0400) Subject: 0024348: TKOpenGl - the same GLSL program can not be re-assigned X-Git-Tag: V6_7_0~79 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=f85399e5df8b5daecca10f960add3b4c5ac63825 0024348: TKOpenGl - the same GLSL program can not be re-assigned Reset shader id in OpenGl aspects. Setup/retrieve shader program within getters/setters of Graphic3d_Group/Graphic3d_Structure (add missing ones). --- diff --git a/src/Graphic3d/Graphic3d_Group_8.cxx b/src/Graphic3d/Graphic3d_Group_8.cxx index 9528958e23..6dc31186a5 100755 --- a/src/Graphic3d/Graphic3d_Group_8.cxx +++ b/src/Graphic3d/Graphic3d_Group_8.cxx @@ -715,26 +715,31 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d Aspect_TypeOfDisplayText ADisplayType; Quantity_Color AColorSubTitle; - if (MyCGroup.ContextLine.IsSet) { - R = Standard_Real (MyCGroup.ContextLine.Color.r); - G = Standard_Real (MyCGroup.ContextLine.Color.g); - B = Standard_Real (MyCGroup.ContextLine.Color.b); - ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType); - AWidth = Standard_Real (MyCGroup.ContextLine.Width); + if (MyCGroup.ContextLine.IsSet) + { + R = Standard_Real (MyCGroup.ContextLine.Color.r); + G = Standard_Real (MyCGroup.ContextLine.Color.g); + B = Standard_Real (MyCGroup.ContextLine.Color.b); + ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType); + AWidth = Standard_Real (MyCGroup.ContextLine.Width); + CTXL->SetShaderProgram (MyCGroup.ContextLine.ShaderProgram); } - else { - R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r); - G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g); - B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b); - ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType); - AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width); + else + { + R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r); + G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g); + B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b); + ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType); + AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width); + CTXL->SetShaderProgram (MyCGroup.Struct->ContextLine.ShaderProgram); } AColor.SetValues (R, G, B, Quantity_TOC_RGB); CTXL->SetColor (AColor); CTXL->SetType (ALType); CTXL->SetWidth (AWidth); - if (MyCGroup.ContextText.IsSet) { + if (MyCGroup.ContextText.IsSet) + { R = Standard_Real (MyCGroup.ContextText.Color.r); G = Standard_Real (MyCGroup.ContextText.Color.g); B = Standard_Real (MyCGroup.ContextText.Color.b); @@ -746,19 +751,22 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d ASpace = Standard_Real (MyCGroup.ContextText.Space); AStyleT = Aspect_TypeOfStyleText (MyCGroup.ContextText.Style); ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.ContextText.DisplayType); + CTXT->SetShaderProgram (MyCGroup.ContextText.ShaderProgram); } - else { + else + { R = Standard_Real (MyCGroup.Struct->ContextText.Color.r); G = Standard_Real (MyCGroup.Struct->ContextText.Color.g); B = Standard_Real (MyCGroup.Struct->ContextText.Color.b); Rs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.r); Gs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.g); Bs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.b); - AFont = Standard_CString (MyCGroup.Struct->ContextText.Font); - AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan); - ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space); - AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style); - ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType); + AFont = Standard_CString (MyCGroup.Struct->ContextText.Font); + AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan); + ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space); + AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style); + ADisplayType = Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType); + CTXT->SetShaderProgram (MyCGroup.Struct->ContextText.ShaderProgram); } AColor.SetValues (R, G, B, Quantity_TOC_RGB); AColorSubTitle.SetValues (Rs, Gs, Bs, Quantity_TOC_RGB); @@ -770,31 +778,36 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d CTXT->SetDisplayType (ADisplayType); CTXT->SetColorSubTitle (AColorSubTitle); - if (MyCGroup.ContextMarker.IsSet) { - R = Standard_Real (MyCGroup.ContextMarker.Color.r); - G = Standard_Real (MyCGroup.ContextMarker.Color.g); - B = Standard_Real (MyCGroup.ContextMarker.Color.b); - AMType = MyCGroup.ContextMarker.MarkerType; - AScale = Standard_Real (MyCGroup.ContextMarker.Scale); - if( AMType == Aspect_TOM_USERDEFINED ) - { + if (MyCGroup.ContextMarker.IsSet) + { + R = Standard_Real (MyCGroup.ContextMarker.Color.r); + G = Standard_Real (MyCGroup.ContextMarker.Color.g); + B = Standard_Real (MyCGroup.ContextMarker.Color.b); + AMType = MyCGroup.ContextMarker.MarkerType; + AScale = Standard_Real (MyCGroup.ContextMarker.Scale); + CTXT->SetShaderProgram (MyCGroup.ContextMarker.ShaderProgram); - CTXM->SetBitMap( MyMarkWidth, MyMarkHeight, MyMarkArray ); + if (AMType == Aspect_TOM_USERDEFINED) + { + CTXM->SetBitMap (MyMarkWidth, MyMarkHeight, MyMarkArray); } } - else { - R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r); - G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g); - B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b); - AMType = MyCGroup.Struct->ContextMarker.MarkerType; - AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale); + else + { + R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r); + G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g); + B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b); + AMType = MyCGroup.Struct->ContextMarker.MarkerType; + AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale); + CTXT->SetShaderProgram (MyCGroup.Struct->ContextMarker.ShaderProgram); } AColor.SetValues (R, G, B, Quantity_TOC_RGB); CTXM->SetColor (AColor); CTXM->SetType (AMType); CTXM->SetScale (AScale); - if (MyCGroup.ContextFillArea.IsSet) { + if (MyCGroup.ContextFillArea.IsSet) + { // Interior AStyle = Aspect_InteriorStyle (MyCGroup.ContextFillArea.Style); R = Standard_Real (MyCGroup.ContextFillArea.IntColor.r); @@ -939,6 +952,7 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d { CTXF->SetTextureMapOff(); } + CTXF->SetShaderProgram (MyCGroup.ContextFillArea.ShaderProgram); // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets CTXF->SetPolygonOffsets(MyCGroup.ContextFillArea.PolygonOffsetMode, @@ -946,7 +960,8 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d MyCGroup.ContextFillArea.PolygonOffsetUnits); // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets } - else { + else + { // Interior AStyle = Aspect_InteriorStyle (MyCGroup.Struct->ContextFillArea.Style); R = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.r); @@ -1091,6 +1106,7 @@ void Graphic3d_Group::GroupPrimitivesAspect (const Handle(Graphic3d_AspectLine3d { CTXF->SetTextureMapOff(); } + CTXF->SetShaderProgram (MyCGroup.Struct->ContextFillArea.ShaderProgram); // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets CTXF->SetPolygonOffsets(MyCGroup.Struct->ContextFillArea.PolygonOffsetMode, diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index f0173d7d7e..fe14aaec68 100755 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -750,8 +750,8 @@ Handle(Graphic3d_AspectLine3d) Graphic3d_Structure::Line3dAspect () const { ALType = Aspect_TypeOfLine (MyCStructure.ContextLine.LineType); AWidth = Standard_Real (MyCStructure.ContextLine.Width); - Handle(Graphic3d_AspectLine3d) CTXL = - new Graphic3d_AspectLine3d (AColor, ALType, AWidth); + Handle(Graphic3d_AspectLine3d) CTXL = new Graphic3d_AspectLine3d (AColor, ALType, AWidth); + CTXL->SetShaderProgram (MyCStructure.ContextLine.ShaderProgram); return CTXL; @@ -778,8 +778,8 @@ Handle(Graphic3d_AspectText3d) Graphic3d_Structure::Text3dAspect () const { AStyle = Aspect_TypeOfStyleText (MyCStructure.ContextText.Style); ADisplayType = Aspect_TypeOfDisplayText (MyCStructure.ContextText.DisplayType); - Handle(Graphic3d_AspectText3d) CTXT = - new Graphic3d_AspectText3d (AColor, AFont, AnExpansion, ASpace,AStyle,ADisplayType); + Handle(Graphic3d_AspectText3d) CTXT = new Graphic3d_AspectText3d (AColor, AFont, AnExpansion, ASpace,AStyle,ADisplayType); + CTXT->SetShaderProgram (MyCStructure.ContextText.ShaderProgram); return CTXT; @@ -800,8 +800,8 @@ Handle(Graphic3d_AspectMarker3d) Graphic3d_Structure::Marker3dAspect () const { AMType = MyCStructure.ContextMarker.MarkerType; AScale = Standard_Real (MyCStructure.ContextMarker.Scale); - Handle(Graphic3d_AspectMarker3d) CTXM = - new Graphic3d_AspectMarker3d (AMType, AColor, AScale); + Handle(Graphic3d_AspectMarker3d) CTXM = new Graphic3d_AspectMarker3d (AMType, AColor, AScale); + CTXM->SetShaderProgram (MyCStructure.ContextMarker.ShaderProgram); return CTXM; @@ -984,6 +984,7 @@ Graphic3d_MATERIAL_PHYSIC : Graphic3d_MATERIAL_ASPECT; { CTXF->SetTextureMapOff(); } + CTXF->SetShaderProgram (MyCStructure.ContextFillArea.ShaderProgram); // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets CTXF->SetPolygonOffsets(MyCStructure.ContextFillArea.PolygonOffsetMode, @@ -1020,6 +1021,7 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine MyCStructure.ContextLine.Color.b = float (B); MyCStructure.ContextLine.LineType = int (ALType); MyCStructure.ContextLine.Width = float (AWidth); + MyCStructure.ContextLine.ShaderProgram = CTX->ShaderProgram(); MyCStructure.ContextLine.IsDef = 1; MyGraphicDriver->ContextStructure (MyCStructure); @@ -1215,6 +1217,7 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectFill MyCStructure.ContextFillArea.Texture.TextureMap = CTX->TextureMap(); MyCStructure.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0; + MyCStructure.ContextFillArea.ShaderProgram = CTX->ShaderProgram(); // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets Standard_Integer aPolyMode; @@ -1274,6 +1277,7 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectText MyCStructure.ContextText.TextZoomable = ATextZoomable; MyCStructure.ContextText.TextAngle = float (ATextAngle); MyCStructure.ContextText.TextFontAspect = int (ATextFontAspect); + MyCStructure.ContextText.ShaderProgram = CTX->ShaderProgram(); MyCStructure.ContextText.IsDef = 1; @@ -1307,6 +1311,7 @@ void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectMark MyCStructure.ContextMarker.Color.b = float (B); MyCStructure.ContextMarker.MarkerType = AMType; MyCStructure.ContextMarker.Scale = float (AScale); + MyCStructure.ContextMarker.ShaderProgram = CTX->ShaderProgram(); MyCStructure.ContextMarker.IsDef = 1; MyGraphicDriver->ContextStructure (MyCStructure); @@ -2071,6 +2076,7 @@ void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& MyCStructure.ContextLine.Color.b = float (B); MyCStructure.ContextLine.LineType = int (ALType); MyCStructure.ContextLine.Width = float (AWidth); + MyCStructure.ContextLine.ShaderProgram = CTXL->ShaderProgram(); CTXM->Values (AColor, AMType, AScale); AColor.Values (R, G, B, Quantity_TOC_RGB); @@ -2080,6 +2086,7 @@ void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& MyCStructure.ContextMarker.Color.b = float (B); MyCStructure.ContextMarker.MarkerType = AMType; MyCStructure.ContextMarker.Scale = float (AScale); + MyCStructure.ContextMarker.ShaderProgram = CTXM->ShaderProgram(); CTXT->Values (AColor, AFont, AnExpansion, ASpace,AStyleT,ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect); AColor.Values (R, G, B, Quantity_TOC_RGB); @@ -2099,6 +2106,7 @@ void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& MyCStructure.ContextText.TextZoomable = ATextZoomable; MyCStructure.ContextText.TextAngle = float (ATextAngle); MyCStructure.ContextText.TextFontAspect = int (ATextFontAspect); + MyCStructure.ContextText.ShaderProgram = CTXT->ShaderProgram(); @@ -2264,6 +2272,7 @@ void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& MyCStructure.ContextFillArea.Texture.TextureMap = CTXF->TextureMap(); MyCStructure.ContextFillArea.Texture.doTextureMap = CTXF->TextureMapState() ? 1 : 0; + MyCStructure.ContextFillArea.ShaderProgram = CTXF->ShaderProgram(); // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets Standard_Integer aPolyMode; diff --git a/src/OpenGl/OpenGl_AspectFace.cxx b/src/OpenGl/OpenGl_AspectFace.cxx index aaf95eb965..12571ce468 100644 --- a/src/OpenGl/OpenGl_AspectFace.cxx +++ b/src/OpenGl/OpenGl_AspectFace.cxx @@ -226,7 +226,7 @@ void OpenGl_AspectFace::SetAspect (const CALL_DEF_CONTEXTFILLAREA& theAspect) const TCollection_AsciiString& aTextureKey = myTexture.IsNull() ? THE_EMPTY_KEY : myTexture->GetId(); if (aTextureKey.IsEmpty() || myResources.TextureId != aTextureKey) { - myResources.ResetTexture(); + myResources.ResetTextureReadiness(); } // update shader program binding @@ -235,7 +235,7 @@ void OpenGl_AspectFace::SetAspect (const CALL_DEF_CONTEXTFILLAREA& theAspect) const TCollection_AsciiString& aShaderKey = myShaderProgram.IsNull() ? THE_EMPTY_KEY : myShaderProgram->GetId(); if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey) { - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } } @@ -411,7 +411,7 @@ void OpenGl_AspectFace::Release (const Handle(OpenGl_Context)& theContext) myResources.Texture.Nullify(); } myResources.TextureId.Clear(); - myResources.ResetTexture(); + myResources.ResetTextureReadiness(); if (!myResources.ShaderProgram.IsNull() && !theContext.IsNull()) @@ -420,7 +420,7 @@ void OpenGl_AspectFace::Release (const Handle(OpenGl_Context)& theContext) myResources.ShaderProgram); } myResources.ShaderProgramId.Clear(); - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } // ======================================================================= @@ -484,6 +484,8 @@ void OpenGl_AspectFace::Resources::BuildShader (const Handle(OpenGl_Workspace)& if (!ShaderProgram.IsNull()) { aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram); + ShaderProgramId.Clear(); + ShaderProgram.Nullify(); } if (theShader.IsNull()) { diff --git a/src/OpenGl/OpenGl_AspectFace.hxx b/src/OpenGl/OpenGl_AspectFace.hxx index 18b640f4cd..b511d550fa 100644 --- a/src/OpenGl/OpenGl_AspectFace.hxx +++ b/src/OpenGl/OpenGl_AspectFace.hxx @@ -249,8 +249,8 @@ protected: Standard_Boolean IsShaderReady () const { return myIsShaderReady; } void SetTextureReady() { myIsTextureReady = Standard_True; } void SetShaderReady () { myIsShaderReady = Standard_True; } - void ResetTexture() { myIsTextureReady = Standard_False; } - void ResetShader () { myIsShaderReady = Standard_False; } + void ResetTextureReadiness() { myIsTextureReady = Standard_False; } + void ResetShaderReadiness () { myIsShaderReady = Standard_False; } void BuildTexture (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_TextureMap)& theTexture); void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader); diff --git a/src/OpenGl/OpenGl_AspectLine.cxx b/src/OpenGl/OpenGl_AspectLine.cxx index e5b80ba23d..43da8289d4 100644 --- a/src/OpenGl/OpenGl_AspectLine.cxx +++ b/src/OpenGl/OpenGl_AspectLine.cxx @@ -70,7 +70,7 @@ void OpenGl_AspectLine::SetAspect (const CALL_DEF_CONTEXTLINE &theAspect) const TCollection_AsciiString& aShaderKey = myShaderProgram.IsNull() ? THE_EMPTY_KEY : myShaderProgram->GetId(); if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey) { - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } } @@ -96,7 +96,7 @@ void OpenGl_AspectLine::Release (const Handle(OpenGl_Context)& theContext) myResources.ShaderProgram); } myResources.ShaderProgramId.Clear(); - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } // ======================================================================= @@ -116,6 +116,8 @@ void OpenGl_AspectLine::Resources::BuildShader (const Handle(OpenGl_Workspace)& if (!ShaderProgram.IsNull()) { aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram); + ShaderProgramId.Clear(); + ShaderProgram.Nullify(); } if (theShader.IsNull()) { diff --git a/src/OpenGl/OpenGl_AspectLine.hxx b/src/OpenGl/OpenGl_AspectLine.hxx index c192ba7ded..c36308c35b 100644 --- a/src/OpenGl/OpenGl_AspectLine.hxx +++ b/src/OpenGl/OpenGl_AspectLine.hxx @@ -74,8 +74,8 @@ protected: Resources() : myIsShaderReady (Standard_False) {} Standard_Boolean IsShaderReady() const { return myIsShaderReady; } - void SetShaderReady() { myIsShaderReady = Standard_True; } - void ResetShader () { myIsShaderReady = Standard_False; } + void SetShaderReady() { myIsShaderReady = Standard_True; } + void ResetShaderReadiness() { myIsShaderReady = Standard_False; } void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader); diff --git a/src/OpenGl/OpenGl_AspectMarker.cxx b/src/OpenGl/OpenGl_AspectMarker.cxx index 5dbfe52f6d..d02b724d0d 100644 --- a/src/OpenGl/OpenGl_AspectMarker.cxx +++ b/src/OpenGl/OpenGl_AspectMarker.cxx @@ -1482,11 +1482,11 @@ void OpenGl_AspectMarker::SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect) if (aSpriteKey.IsEmpty() || myResources.SpriteKey != aSpriteKey) { - myResources.ResetSprite(); + myResources.ResetSpriteReadiness(); } if (aSpriteAKey.IsEmpty() || myResources.SpriteAKey != aSpriteAKey) { - myResources.ResetSprite(); + myResources.ResetSpriteReadiness(); } // update shader program resource bindings @@ -1494,7 +1494,7 @@ void OpenGl_AspectMarker::SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect) if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey) { - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } } @@ -1535,7 +1535,7 @@ void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx) } myResources.SpriteKey.Clear(); myResources.SpriteAKey.Clear(); - myResources.ResetSprite(); + myResources.ResetSpriteReadiness(); if (!myResources.ShaderProgram.IsNull() && !theCtx.IsNull()) { @@ -1543,7 +1543,7 @@ void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx) myResources.ShaderProgram); } myResources.ShaderProgramId.Clear(); - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } // ======================================================================= @@ -1909,6 +1909,8 @@ void OpenGl_AspectMarker::Resources::BuildShader (const Handle(OpenGl_Workspace) if (!ShaderProgram.IsNull()) { aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram); + ShaderProgramId.Clear(); + ShaderProgram.Nullify(); } if (theShader.IsNull()) { diff --git a/src/OpenGl/OpenGl_AspectMarker.hxx b/src/OpenGl/OpenGl_AspectMarker.hxx index 7477e047df..839aa0832e 100644 --- a/src/OpenGl/OpenGl_AspectMarker.hxx +++ b/src/OpenGl/OpenGl_AspectMarker.hxx @@ -132,8 +132,8 @@ protected: //! @name OpenGl resources Standard_Boolean IsShaderReady() const { return myIsShaderReady; } void SetSpriteReady() { myIsSpriteReady = Standard_True; } void SetShaderReady() { myIsShaderReady = Standard_True; } - void ResetSprite () { myIsSpriteReady = Standard_False; } - void ResetShader () { myIsShaderReady = Standard_False; } + void ResetSpriteReadiness() { myIsSpriteReady = Standard_False; } + void ResetShaderReadiness() { myIsShaderReady = Standard_False; } void BuildSprites (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_MarkerImage)& theMarkerImage, diff --git a/src/OpenGl/OpenGl_AspectText.cxx b/src/OpenGl/OpenGl_AspectText.cxx index 046a07df2d..b10c2f2ec2 100644 --- a/src/OpenGl/OpenGl_AspectText.cxx +++ b/src/OpenGl/OpenGl_AspectText.cxx @@ -88,7 +88,7 @@ void OpenGl_AspectText::SetAspect (const CALL_DEF_CONTEXTTEXT& theAspect) if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey) { - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } } @@ -114,7 +114,7 @@ void OpenGl_AspectText::Release (const Handle(OpenGl_Context)& theContext) myResources.ShaderProgram); } myResources.ShaderProgramId.Clear(); - myResources.ResetShader(); + myResources.ResetShaderReadiness(); } // ======================================================================= @@ -134,6 +134,8 @@ void OpenGl_AspectText::Resources::BuildShader (const Handle(OpenGl_Workspace)& if (!ShaderProgram.IsNull()) { aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram); + ShaderProgramId.Clear(); + ShaderProgram.Nullify(); } if (theShader.IsNull()) { diff --git a/src/OpenGl/OpenGl_AspectText.hxx b/src/OpenGl/OpenGl_AspectText.hxx index e426ae6b2c..c064bb0617 100644 --- a/src/OpenGl/OpenGl_AspectText.hxx +++ b/src/OpenGl/OpenGl_AspectText.hxx @@ -156,8 +156,8 @@ protected: Resources() : myIsShaderReady (Standard_False) {} Standard_Boolean IsShaderReady() const { return myIsShaderReady; } - void SetShaderReady() { myIsShaderReady = Standard_True; } - void ResetShader () { myIsShaderReady = Standard_False; } + void SetShaderReady() { myIsShaderReady = Standard_True; } + void ResetShaderReadiness() { myIsShaderReady = Standard_False; } void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader);