mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0032117: Visualization, TKOpenGl - assert in OpenGl_AspectsSprite due to implicit destruction of existing resource
RGBA and Alpha markers are now handled independently within OpenGl_AspectsSprite::build().
This commit is contained in:
parent
00a72254dc
commit
665dc9e50b
@ -206,9 +206,16 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
Handle(OpenGl_PointSprite)& aSprite = mySprite;
|
||||
Handle(OpenGl_PointSprite)& aSpriteA = mySpriteA;
|
||||
if (!aNewKey.IsEmpty()
|
||||
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, aSpriteA) // alpha sprite could be shared
|
||||
&& theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, aSprite))
|
||||
if (!aNewKey.IsEmpty())
|
||||
{
|
||||
theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKeyA, aSpriteA); // alpha sprite could be shared
|
||||
theCtx->GetResource<Handle(OpenGl_PointSprite)> (aNewKey, aSprite);
|
||||
}
|
||||
|
||||
const bool hadAlreadyRGBA = !aSprite.IsNull();
|
||||
const bool hadAlreadyAlpha = !aSpriteA.IsNull();
|
||||
if (hadAlreadyRGBA
|
||||
&& hadAlreadyAlpha)
|
||||
{
|
||||
// reuse shared resource
|
||||
if (!aSprite->IsDisplayList())
|
||||
@ -218,15 +225,20 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx,
|
||||
return;
|
||||
}
|
||||
|
||||
const bool hadAlreadyAlpha = !aSpriteA.IsNull();
|
||||
if (!hadAlreadyAlpha)
|
||||
{
|
||||
aSpriteA = new OpenGl_PointSprite (aNewKeyA);
|
||||
}
|
||||
aSprite = new OpenGl_PointSprite (aNewKey);
|
||||
if (!hadAlreadyRGBA)
|
||||
{
|
||||
aSprite = new OpenGl_PointSprite (aNewKey);
|
||||
}
|
||||
if (!aNewKey.IsEmpty())
|
||||
{
|
||||
theCtx->ShareResource (aNewKey, aSprite);
|
||||
if (!hadAlreadyRGBA)
|
||||
{
|
||||
theCtx->ShareResource (aNewKey, aSprite);
|
||||
}
|
||||
if (!hadAlreadyAlpha)
|
||||
{
|
||||
theCtx->ShareResource (aNewKeyA, aSpriteA);
|
||||
@ -249,7 +261,10 @@ void OpenGl_AspectsSprite::build (const Handle(OpenGl_Context)& theCtx,
|
||||
Handle(Image_PixMap) anImage = aNewMarkerImage->GetImage();
|
||||
theMarkerSize = Max ((Standard_ShortReal )anImage->Width(),(Standard_ShortReal )anImage->Height());
|
||||
|
||||
aSprite->Init (theCtx, *anImage, Graphic3d_TOT_2D, true);
|
||||
if (!hadAlreadyRGBA)
|
||||
{
|
||||
aSprite->Init (theCtx, *anImage, Graphic3d_TOT_2D, true);
|
||||
}
|
||||
if (!hadAlreadyAlpha)
|
||||
{
|
||||
if (Handle(Image_PixMap) anImageA = aSprite->GetFormat() != GL_ALPHA ? aNewMarkerImage->GetImageAlpha() : Handle(Image_PixMap)())
|
||||
|
Loading…
x
Reference in New Issue
Block a user