1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024158: OpenGl_AspectMarker - debug assert on destruction of Alpha texture shared between multiple RGB texture

In addition - delay marker resources destruction in the similar way as textured fonts
This commit is contained in:
kgv 2013-09-10 15:32:53 +04:00 committed by bugmaster
parent 5a29f57e9b
commit 18e8557466

View File

@ -1542,8 +1542,8 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
}
if (!aNewKey.IsEmpty()
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, mySprite)
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, mySpriteA))
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, mySpriteA) // alpha sprite could be shared
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, mySprite))
{
// reuse shared resource
if (!mySprite->IsDisplayList())
@ -1553,13 +1553,20 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
return;
}
mySprite = new OpenGl_PointSprite();
const bool hadAlreadyAlpha = !mySpriteA.IsNull();
if (!hadAlreadyAlpha)
{
mySpriteA = new OpenGl_PointSprite();
}
mySprite = new OpenGl_PointSprite();
if (!aNewKey.IsEmpty())
{
theCtx->ShareResource (aNewKey, mySprite);
if (!hadAlreadyAlpha)
{
theCtx->ShareResource (aNewKeyA, mySpriteA);
}
}
if (!theCtx.IsNull()
&& theCtx->IsGlGreaterEqual (2, 0)
@ -1691,6 +1698,8 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
myMarkerSize = Max ((Standard_ShortReal )anImage->Width(),(Standard_ShortReal )anImage->Height());
mySprite->Init (theCtx, *anImage.operator->(), Graphic3d_TOT_2D);
if (!hadAlreadyAlpha)
{
if (anImageA.IsNull()
&& mySprite->GetFormat() != GL_ALPHA8
&& !aNewMarkerImage.IsNull())
@ -1702,6 +1711,7 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
mySpriteA->Init (theCtx, *anImageA.operator->(), Graphic3d_TOT_2D);
}
}
}
else
{
// Creating list with bitmap for using it in compatibility mode
@ -1843,8 +1853,8 @@ void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx)
{
mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call
mySpriteA.Nullify();
theCtx->ReleaseResource (mySpriteKey);
theCtx->ReleaseResource (mySpriteAKey);
theCtx->ReleaseResource (mySpriteKey, Standard_True);
theCtx->ReleaseResource (mySpriteAKey, Standard_True);
}
}
mySprite.Nullify();