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:
parent
5a29f57e9b
commit
18e8557466
@ -1542,8 +1542,8 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!aNewKey.IsEmpty()
|
if (!aNewKey.IsEmpty()
|
||||||
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, mySprite)
|
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, mySpriteA) // alpha sprite could be shared
|
||||||
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, mySpriteA))
|
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, mySprite))
|
||||||
{
|
{
|
||||||
// reuse shared resource
|
// reuse shared resource
|
||||||
if (!mySprite->IsDisplayList())
|
if (!mySprite->IsDisplayList())
|
||||||
@ -1553,12 +1553,19 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool hadAlreadyAlpha = !mySpriteA.IsNull();
|
||||||
|
if (!hadAlreadyAlpha)
|
||||||
|
{
|
||||||
|
mySpriteA = new OpenGl_PointSprite();
|
||||||
|
}
|
||||||
mySprite = new OpenGl_PointSprite();
|
mySprite = new OpenGl_PointSprite();
|
||||||
mySpriteA = new OpenGl_PointSprite();
|
|
||||||
if (!aNewKey.IsEmpty())
|
if (!aNewKey.IsEmpty())
|
||||||
{
|
{
|
||||||
theCtx->ShareResource (aNewKey, mySprite);
|
theCtx->ShareResource (aNewKey, mySprite);
|
||||||
theCtx->ShareResource (aNewKeyA, mySpriteA);
|
if (!hadAlreadyAlpha)
|
||||||
|
{
|
||||||
|
theCtx->ShareResource (aNewKeyA, mySpriteA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theCtx.IsNull()
|
if (!theCtx.IsNull()
|
||||||
@ -1691,15 +1698,18 @@ void OpenGl_AspectMarker::Init (const Handle(OpenGl_Context)& theCtx,
|
|||||||
myMarkerSize = Max ((Standard_ShortReal )anImage->Width(),(Standard_ShortReal )anImage->Height());
|
myMarkerSize = Max ((Standard_ShortReal )anImage->Width(),(Standard_ShortReal )anImage->Height());
|
||||||
|
|
||||||
mySprite->Init (theCtx, *anImage.operator->(), Graphic3d_TOT_2D);
|
mySprite->Init (theCtx, *anImage.operator->(), Graphic3d_TOT_2D);
|
||||||
if (anImageA.IsNull()
|
if (!hadAlreadyAlpha)
|
||||||
&& mySprite->GetFormat() != GL_ALPHA8
|
|
||||||
&& !aNewMarkerImage.IsNull())
|
|
||||||
{
|
{
|
||||||
anImageA = aNewMarkerImage->GetImageAlpha();
|
if (anImageA.IsNull()
|
||||||
}
|
&& mySprite->GetFormat() != GL_ALPHA8
|
||||||
if (!anImageA.IsNull())
|
&& !aNewMarkerImage.IsNull())
|
||||||
{
|
{
|
||||||
mySpriteA->Init (theCtx, *anImageA.operator->(), Graphic3d_TOT_2D);
|
anImageA = aNewMarkerImage->GetImageAlpha();
|
||||||
|
}
|
||||||
|
if (!anImageA.IsNull())
|
||||||
|
{
|
||||||
|
mySpriteA->Init (theCtx, *anImageA.operator->(), Graphic3d_TOT_2D);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1843,8 +1853,8 @@ void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx)
|
|||||||
{
|
{
|
||||||
mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call
|
mySprite.Nullify(); // we need nullify all handles before ReleaseResource() call
|
||||||
mySpriteA.Nullify();
|
mySpriteA.Nullify();
|
||||||
theCtx->ReleaseResource (mySpriteKey);
|
theCtx->ReleaseResource (mySpriteKey, Standard_True);
|
||||||
theCtx->ReleaseResource (mySpriteAKey);
|
theCtx->ReleaseResource (mySpriteAKey, Standard_True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mySprite.Nullify();
|
mySprite.Nullify();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user