1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0025133: TKOpenGl - Crash on closing a view containing presentations with capping

OpenGl_Element destruction and resource deallocation methods now accept
a pointer to OpenGl_Context instead of a handle to avoid double deletion
of the context.
This commit is contained in:
san 2014-08-28 11:55:06 +04:00 committed by bugmaster
parent 4769a39529
commit 10b9c7dfc0
48 changed files with 95 additions and 88 deletions

View File

@ -42,7 +42,7 @@ public:
void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext)
virtual void Release (OpenGl_Context* theContext)
{
//
}

View File

@ -387,11 +387,11 @@ void OpenGl_AspectFace::Render (const Handle(OpenGl_Workspace)& theWorkspace) co
// function : Release
// purpose :
// =======================================================================
void OpenGl_AspectFace::Release (const Handle(OpenGl_Context)& theContext)
void OpenGl_AspectFace::Release (OpenGl_Context* theContext)
{
if (!myResources.Texture.IsNull())
{
if (!theContext.IsNull())
if (theContext)
{
if (myResources.TextureId.IsEmpty())
{
@ -409,7 +409,7 @@ void OpenGl_AspectFace::Release (const Handle(OpenGl_Context)& theContext)
myResources.ResetTextureReadiness();
if (!myResources.ShaderProgram.IsNull()
&& !theContext.IsNull())
&& theContext)
{
theContext->ShaderManager()->Unregister (myResources.ShaderProgramId,
myResources.ShaderProgram);

View File

@ -212,7 +212,7 @@ public:
}
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theContext);
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
protected:

View File

@ -83,10 +83,10 @@ void OpenGl_AspectLine::Render (const Handle(OpenGl_Workspace) &theWorkspace) co
// function : Release
// purpose :
// =======================================================================
void OpenGl_AspectLine::Release (const Handle(OpenGl_Context)& theContext)
void OpenGl_AspectLine::Release (OpenGl_Context* theContext)
{
if (!myResources.ShaderProgram.IsNull()
&& !theContext.IsNull())
&& theContext)
{
theContext->ShaderManager()->Unregister (myResources.ShaderProgramId,
myResources.ShaderProgram);

View File

@ -54,7 +54,7 @@ public:
}
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theContext);
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
protected:

View File

@ -1505,11 +1505,11 @@ void OpenGl_AspectMarker::Render (const Handle(OpenGl_Workspace)& theWorkspace)
// function : Release
// purpose :
// =======================================================================
void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx)
void OpenGl_AspectMarker::Release (OpenGl_Context* theCtx)
{
if (!myResources.Sprite.IsNull())
{
if (!theCtx.IsNull())
if (theCtx)
{
if (myResources.SpriteKey.IsEmpty())
{
@ -1531,7 +1531,7 @@ void OpenGl_AspectMarker::Release (const Handle(OpenGl_Context)& theCtx)
myResources.SpriteAKey.Clear();
myResources.ResetSpriteReadiness();
if (!myResources.ShaderProgram.IsNull() && !theCtx.IsNull())
if (!myResources.ShaderProgram.IsNull() && theCtx)
{
theCtx->ShaderManager()->Unregister (myResources.ShaderProgramId,
myResources.ShaderProgram);

View File

@ -100,7 +100,7 @@ public:
}
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theContext);
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
protected: //! @name ordinary aspect properties

View File

@ -101,10 +101,10 @@ void OpenGl_AspectText::Render (const Handle(OpenGl_Workspace)& theWorkspace) co
// function : Release
// purpose :
// =======================================================================
void OpenGl_AspectText::Release (const Handle(OpenGl_Context)& theContext)
void OpenGl_AspectText::Release (OpenGl_Context* theContext)
{
if (!myResources.ShaderProgram.IsNull()
&& !theContext.IsNull())
&& theContext)
{
theContext->ShaderManager()->Unregister (myResources.ShaderProgramId,
myResources.ShaderProgram);

View File

@ -130,7 +130,7 @@ public:
}
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theContext);
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
protected:

View File

@ -56,7 +56,7 @@ void OpenGl_CappingPlaneResource::Update (const Handle(OpenGl_Context)& theConte
// function : Release
// purpose :
// =======================================================================
void OpenGl_CappingPlaneResource::Release (const OpenGl_Context* theContext)
void OpenGl_CappingPlaneResource::Release (OpenGl_Context* theContext)
{
OpenGl_Element::Destroy (theContext, myAspect);
myEquationMod = (unsigned int )-1;
@ -83,7 +83,7 @@ void OpenGl_CappingPlaneResource::UpdateAspect (const Handle(OpenGl_Context)& th
// no more used
if (myAspect != NULL && aCappingAsp.IsNull())
{
OpenGl_Element::Destroy (theContext, myAspect);
OpenGl_Element::Destroy (theContext.operator->(), myAspect);
myAspectMod = myPlaneRoot->MCountAspect();
return;
}

View File

@ -50,7 +50,7 @@ public:
//! Release associated OpenGl resources.
//! @param theContext [in] the resource context.
Standard_EXPORT void Release (const OpenGl_Context* theContext);
Standard_EXPORT void Release (OpenGl_Context* theContext);
//! @return aspect face for rendering capping surface.
inline const OpenGl_AspectFace* AspectFace() const { return myAspect; }

View File

@ -30,10 +30,16 @@ public:
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const = 0;
//! Release GPU resources.
virtual void Release (const Handle(OpenGl_Context)& theContext) = 0;
//! Pointer to the context is used because this method might be called
//! when the context is already being destroyed and usage of a handle
//! would be unsafe
virtual void Release (OpenGl_Context* theContext) = 0;
//! Pointer to the context is used because this method might be called
//! when the context is already being destroyed and usage of a handle
//! would be unsafe
template <typename theResource_t>
static void Destroy (const Handle(OpenGl_Context)& theContext,
static void Destroy (OpenGl_Context* theContext,
theResource_t*& theElement)
{
if (theElement == NULL)

View File

@ -53,7 +53,7 @@ OpenGl_Flipper::OpenGl_Flipper (const gp_Ax2& theReferenceSystem)
// function : Release
// purpose :
// =======================================================================
void OpenGl_Flipper::Release (const Handle(OpenGl_Context)& )
void OpenGl_Flipper::Release (OpenGl_Context*)
{
//
}

View File

@ -41,7 +41,7 @@ public:
void SetOptions (const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
public:

View File

@ -54,7 +54,7 @@ OpenGl_Font::~OpenGl_Font()
// function : Release
// purpose :
// =======================================================================
void OpenGl_Font::Release (const OpenGl_Context* theCtx)
void OpenGl_Font::Release (OpenGl_Context* theCtx)
{
if (myTextures.IsEmpty())
{

View File

@ -57,7 +57,7 @@ public:
Standard_EXPORT virtual ~OpenGl_Font();
//! Destroy object - will release GPU memory if any
Standard_EXPORT virtual void Release (const OpenGl_Context* theCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
//! @return key of shared resource
inline const TCollection_AsciiString& ResourceKey() const

View File

@ -108,7 +108,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlCo
// function : Release
// purpose :
// =======================================================================
void OpenGl_FrameBuffer::Release (const OpenGl_Context* theGlCtx)
void OpenGl_FrameBuffer::Release (OpenGl_Context* theGlCtx)
{
if (isValidFrameBuffer())
{

View File

@ -41,7 +41,7 @@ public:
Standard_EXPORT virtual ~OpenGl_FrameBuffer();
//! Destroy object - will release GPU memory if any.
Standard_EXPORT virtual void Release (const OpenGl_Context* theGlCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx);
//! Textures width.
GLsizei GetSizeX() const

View File

@ -189,7 +189,7 @@ static void drawArrow(float x1, float y1, float z1,
// function : Release
// purpose :
// =======================================================================
void OpenGl_GraduatedTrihedron::Release (const Handle(OpenGl_Context)& theCtx)
void OpenGl_GraduatedTrihedron::Release (OpenGl_Context* theCtx)
{
myLabelX.Release (theCtx);
myLabelY.Release (theCtx);

View File

@ -37,7 +37,7 @@ public:
OpenGl_GraduatedTrihedron (const Graphic3d_CGraduatedTrihedron& theData);
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theCtx);
virtual void Release (OpenGl_Context* theCtx);
protected:

View File

@ -402,7 +402,7 @@ void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
aStruct->ReleaseGlResources (aCtx);
}
myTempText->Release (aCtx);
myTempText->Release (aCtx.operator->());
myDeviceLostFlag = !myMapOfStructure.IsEmpty();
}

View File

@ -378,14 +378,14 @@ void OpenGl_Group::Release (const Handle(OpenGl_Context)& theGlCtx)
while (myFirst != NULL)
{
OpenGl_ElementNode* aNext = myFirst->next;
OpenGl_Element::Destroy (theGlCtx, myFirst->elem);
OpenGl_Element::Destroy (theGlCtx.operator->(), myFirst->elem);
delete myFirst;
myFirst = aNext;
}
myLast = NULL;
OpenGl_Element::Destroy (theGlCtx, myAspectLine);
OpenGl_Element::Destroy (theGlCtx, myAspectFace);
OpenGl_Element::Destroy (theGlCtx, myAspectMarker);
OpenGl_Element::Destroy (theGlCtx, myAspectText);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectLine);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectFace);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectMarker);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectText);
}

View File

@ -517,7 +517,7 @@ OpenGl_LineAttributes::~OpenGl_LineAttributes()
// function : Release
// purpose :
// =======================================================================
void OpenGl_LineAttributes::Release (const OpenGl_Context* theGlCtx)
void OpenGl_LineAttributes::Release (OpenGl_Context* theGlCtx)
{
// Delete line styles
if (myLinestyleBase != 0)

View File

@ -33,7 +33,7 @@ public:
virtual ~OpenGl_LineAttributes();
void Init (const Handle(OpenGl_Context)& theGlCtx);
virtual void Release (const OpenGl_Context* theGlCtx);
virtual void Release (OpenGl_Context* theGlCtx);
void SetTypeOfLine (const Aspect_TypeOfLine theType) const;

View File

@ -49,7 +49,7 @@ OpenGl_PointSprite::~OpenGl_PointSprite()
// function : Release
// purpose :
// =======================================================================
void OpenGl_PointSprite::Release (const OpenGl_Context* theGlCtx)
void OpenGl_PointSprite::Release (OpenGl_Context* theGlCtx)
{
if (myBitmapList != 0)
{

View File

@ -32,7 +32,7 @@ public:
Standard_EXPORT virtual ~OpenGl_PointSprite();
//! Destroy object - will release GPU memory if any.
Standard_EXPORT virtual void Release (const OpenGl_Context* theCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
//! @return true if this is display list bitmap
inline Standard_Boolean IsDisplayList() const

View File

@ -778,11 +778,11 @@ OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray()
// function : Release
// purpose :
// =======================================================================
void OpenGl_PrimitiveArray::Release (const Handle(OpenGl_Context)& theContext)
void OpenGl_PrimitiveArray::Release (OpenGl_Context* theContext)
{
if (!myVboIndices.IsNull())
{
if (!theContext.IsNull())
if (theContext)
{
theContext->DelayedRelease (myVboIndices);
}
@ -790,7 +790,7 @@ void OpenGl_PrimitiveArray::Release (const Handle(OpenGl_Context)& theContext)
}
if (!myVboAttribs.IsNull())
{
if (!theContext.IsNull())
if (theContext)
{
theContext->DelayedRelease (myVboAttribs);
}

View File

@ -50,7 +50,7 @@ public:
//! Render primitives to the window
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext);
virtual void Release (OpenGl_Context* theContext);
//! @return primitive type (GL_LINES, GL_TRIANGLES and others)
GLint DrawMode() const { return myDrawMode; }

View File

@ -45,7 +45,7 @@ public:
//! Notice that implementation should be SAFE for several consecutive calls
//! (thus should invalidate internal structures / ids to avoid multiple-free errors).
//! @param theGlCtx - bound GL context, shouldn't be NULL.
Standard_EXPORT virtual void Release (const OpenGl_Context* theGlCtx) = 0;
Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx) = 0;
private:

View File

@ -125,7 +125,7 @@ Standard_Boolean OpenGl_ShaderObject::Create (const Handle(OpenGl_Context)& theC
// function : Release
// purpose : Destroys shader object
// =======================================================================
void OpenGl_ShaderObject::Release (const OpenGl_Context* theCtx)
void OpenGl_ShaderObject::Release (OpenGl_Context* theCtx)
{
if (myShaderID == NO_SHADER)
{

View File

@ -57,7 +57,7 @@ public:
Standard_EXPORT Standard_Boolean Create (const Handle(OpenGl_Context)& theCtx);
//! Destroys shader object.
Standard_EXPORT virtual void Release (const OpenGl_Context* theCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
//! Returns type of shader object.
GLenum Type() const { return myType; }

View File

@ -1245,7 +1245,7 @@ Standard_Boolean OpenGl_ShaderProgram::Create (const Handle(OpenGl_Context)& the
// function : Release
// purpose : Destroys shader program
// =======================================================================
void OpenGl_ShaderProgram::Release (const OpenGl_Context* theCtx)
void OpenGl_ShaderProgram::Release (OpenGl_Context* theCtx)
{
if (myProgramID == NO_PROGRAM)
{

View File

@ -157,7 +157,7 @@ public:
Standard_EXPORT Standard_Boolean Create (const Handle(OpenGl_Context)& theCtx);
//! Destroys shader program.
Standard_EXPORT virtual void Release (const OpenGl_Context* theCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
//! Attaches shader object to the program object.
Standard_EXPORT Standard_Boolean AttachShader (const Handle(OpenGl_Context)& theCtx,

View File

@ -42,7 +42,7 @@ void OpenGl_StencilTest::Render (const Handle(OpenGl_Workspace)&) const
// function : Release
// purpose :
// =======================================================================
void OpenGl_StencilTest::Release (const Handle(OpenGl_Context)&)
void OpenGl_StencilTest::Release (OpenGl_Context*)
{
//
}

View File

@ -28,7 +28,7 @@ public:
//! Render primitives to the window
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext);
virtual void Release (OpenGl_Context* theContext);
void SetOptions (const Standard_Boolean theIsEnabled);

View File

@ -93,7 +93,7 @@ public:
}
//! Release graphical resources
virtual void Release (const Handle(OpenGl_Context)& )
virtual void Release (OpenGl_Context*)
{
//
}
@ -818,10 +818,10 @@ void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
{
// Release groups
Clear (theGlCtx);
OpenGl_Element::Destroy (theGlCtx, myAspectLine);
OpenGl_Element::Destroy (theGlCtx, myAspectFace);
OpenGl_Element::Destroy (theGlCtx, myAspectMarker);
OpenGl_Element::Destroy (theGlCtx, myAspectText);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectLine);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectFace);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectMarker);
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectText);
clearHighlightColor (theGlCtx);
// Remove from connected list of ancestor
@ -840,23 +840,23 @@ void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCt
}
if (myAspectLine != NULL)
{
myAspectLine->Release (theGlCtx);
myAspectLine->Release (theGlCtx.operator->());
}
if (myAspectFace != NULL)
{
myAspectFace->Release (theGlCtx);
myAspectFace->Release (theGlCtx.operator->());
}
if (myAspectMarker != NULL)
{
myAspectMarker->Release (theGlCtx);
myAspectMarker->Release (theGlCtx.operator->());
}
if (myAspectText != NULL)
{
myAspectText->Release (theGlCtx);
myAspectText->Release (theGlCtx.operator->());
}
if (!myHighlightBox.IsNull())
{
myHighlightBox->Release (theGlCtx);
myHighlightBox->Release (theGlCtx.operator->());
}
}

View File

@ -192,7 +192,7 @@ void OpenGl_Text::SetFontSize (const Handle(OpenGl_Context)& theCtx,
{
if (myParams.Height != theFontSize)
{
Release (theCtx);
Release (theCtx.operator->());
}
myParams.Height = theFontSize;
}
@ -205,7 +205,7 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
const Standard_Utf8Char* theText,
const OpenGl_Vec3& thePoint)
{
releaseVbos (theCtx);
releaseVbos (theCtx.operator->());
myIs2d = false;
myPoint = thePoint;
myString.FromUnicode (theText);
@ -222,11 +222,11 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
{
if (myParams.Height != theParams.Height)
{
Release (theCtx);
Release (theCtx.operator->());
}
else
{
releaseVbos (theCtx);
releaseVbos (theCtx.operator->());
}
myIs2d = false;
myParams = theParams;
@ -245,11 +245,11 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
{
if (myParams.Height != theParams.Height)
{
Release (theCtx);
Release (theCtx.operator->());
}
else
{
releaseVbos (theCtx);
releaseVbos (theCtx.operator->());
}
myIs2d = true;
myParams = theParams;
@ -271,14 +271,14 @@ OpenGl_Text::~OpenGl_Text()
// function : releaseVbos
// purpose :
// =======================================================================
void OpenGl_Text::releaseVbos (const Handle(OpenGl_Context)& theCtx)
void OpenGl_Text::releaseVbos (OpenGl_Context* theCtx)
{
for (Standard_Integer anIter = 0; anIter < myVertsVbo.Length(); ++anIter)
{
Handle(OpenGl_VertexBuffer)& aVerts = myVertsVbo.ChangeValue (anIter);
Handle(OpenGl_VertexBuffer)& aTCrds = myTCrdsVbo.ChangeValue (anIter);
if (!theCtx.IsNull())
if (theCtx)
{
theCtx->DelayedRelease (aVerts);
theCtx->DelayedRelease (aTCrds);
@ -297,7 +297,7 @@ void OpenGl_Text::releaseVbos (const Handle(OpenGl_Context)& theCtx)
// function : Release
// purpose :
// =======================================================================
void OpenGl_Text::Release (const Handle(OpenGl_Context)& theCtx)
void OpenGl_Text::Release (OpenGl_Context* theCtx)
{
releaseVbos (theCtx);
if (!myFont.IsNull())
@ -305,6 +305,7 @@ void OpenGl_Text::Release (const Handle(OpenGl_Context)& theCtx)
Handle(OpenGl_Context) aCtx = theCtx;
const TCollection_AsciiString aKey = myFont->ResourceKey();
myFont.Nullify();
if (aCtx)
aCtx->ReleaseResource (aKey, Standard_True);
}
}
@ -637,7 +638,7 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx,
&& !myFont->ResourceKey().IsEqual (aFontKey))
{
// font changed
const_cast<OpenGl_Text* > (this)->Release (theCtx);
const_cast<OpenGl_Text* > (this)->Release (theCtx.operator->());
}
if (myFont.IsNull())

View File

@ -59,7 +59,7 @@ public:
const Standard_Integer theFontSize);
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theContext);
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
public: //! @name methods for compatibility with layers
@ -107,7 +107,7 @@ protected:
private:
//! Release cached VBO resources
void releaseVbos (const Handle(OpenGl_Context)& theCtx);
void releaseVbos (OpenGl_Context* theCtx);
//! Setup matrix.
void setupMatrix (const Handle(OpenGl_PrinterContext)& thePrintCtx,

View File

@ -115,7 +115,7 @@ bool OpenGl_Texture::Create (const Handle(OpenGl_Context)& )
// function : Release
// purpose :
// =======================================================================
void OpenGl_Texture::Release (const OpenGl_Context* theGlCtx)
void OpenGl_Texture::Release (OpenGl_Context* theGlCtx)
{
if (myTextureId == NO_TEXTURE)
{

View File

@ -206,7 +206,7 @@ public:
Standard_EXPORT bool Create (const Handle(OpenGl_Context)& theCtx);
//! Destroy object - will release GPU memory if any.
Standard_EXPORT virtual void Release (const OpenGl_Context* theCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
//! Bind this Texture to specified unit.
Standard_EXPORT void Bind (const Handle(OpenGl_Context)& theCtx,

View File

@ -54,7 +54,7 @@ GLenum OpenGl_TextureBufferArb::GetTarget() const
// function : Release
// purpose :
// =======================================================================
void OpenGl_TextureBufferArb::Release (const OpenGl_Context* theGlCtx)
void OpenGl_TextureBufferArb::Release (OpenGl_Context* theGlCtx)
{
if (myTextureId != NO_TEXTURE)
{

View File

@ -56,7 +56,7 @@ public:
}
//! Destroy object - will release GPU memory if any.
Standard_EXPORT virtual void Release (const OpenGl_Context* theGlCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx);
//! Creates VBO and Texture names (ids) if not yet generated.
//! Data should be initialized by another method.

View File

@ -640,7 +640,7 @@ OpenGl_Trihedron::~OpenGl_Trihedron()
// function : Release
// purpose :
// =======================================================================
void OpenGl_Trihedron::Release (const Handle(OpenGl_Context)& theCtx)
void OpenGl_Trihedron::Release (OpenGl_Context* theCtx)
{
myLabelX.Release (theCtx);
myLabelY.Release (theCtx);

View File

@ -43,7 +43,7 @@ public:
const Standard_Boolean theAsWireframe);
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theCtx);
virtual void Release (OpenGl_Context* theCtx);
protected:

View File

@ -69,7 +69,7 @@ bool OpenGl_VertexBuffer::Create (const Handle(OpenGl_Context)& theGlCtx)
// function : Release
// purpose :
// =======================================================================
void OpenGl_VertexBuffer::Release (const OpenGl_Context* theGlCtx)
void OpenGl_VertexBuffer::Release (OpenGl_Context* theGlCtx)
{
if (myBufferId == NO_BUFFER)
{

View File

@ -70,7 +70,7 @@ public:
Standard_EXPORT bool Create (const Handle(OpenGl_Context)& theGlCtx);
//! Destroy object - will release GPU memory if any.
Standard_EXPORT virtual void Release (const OpenGl_Context* theGlCtx);
Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx);
//! Bind this VBO.
Standard_EXPORT void Bind (const Handle(OpenGl_Context)& theGlCtx) const;

View File

@ -104,8 +104,8 @@ OpenGl_View::~OpenGl_View ()
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
{
OpenGl_Element::Destroy (theCtx, myTrihedron);
OpenGl_Element::Destroy (theCtx, myGraduatedTrihedron);
OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron);
OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron);
if (!myTextureEnv.IsNull())
{
@ -233,7 +233,7 @@ void OpenGl_View::TriedronDisplay (const Handle(OpenGl_Context)& theCtx,
const Standard_Real theScale,
const Standard_Boolean theAsWireframe)
{
OpenGl_Element::Destroy (theCtx, myTrihedron);
OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron);
myTrihedron = new OpenGl_Trihedron (thePosition, theColor, theScale, theAsWireframe);
}
@ -241,7 +241,7 @@ void OpenGl_View::TriedronDisplay (const Handle(OpenGl_Context)& theCtx,
void OpenGl_View::TriedronErase (const Handle(OpenGl_Context)& theCtx)
{
OpenGl_Element::Destroy (theCtx, myTrihedron);
OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron);
}
/*----------------------------------------------------------------------*/
@ -249,7 +249,7 @@ void OpenGl_View::TriedronErase (const Handle(OpenGl_Context)& theCtx)
void OpenGl_View::GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_CGraduatedTrihedron& theData)
{
OpenGl_Element::Destroy (theCtx, myGraduatedTrihedron);
OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron);
myGraduatedTrihedron = new OpenGl_GraduatedTrihedron (theData);
}
@ -257,7 +257,7 @@ void OpenGl_View::GraduatedTrihedronDisplay (const Handle(OpenGl_Context)&
void OpenGl_View::GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx)
{
OpenGl_Element::Destroy (theCtx, myGraduatedTrihedron);
OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron);
}
/*----------------------------------------------------------------------*/

View File

@ -103,7 +103,7 @@ public:
myIObj->Render(theWorkspace);
}
virtual void Release (const Handle(OpenGl_Context)&)
virtual void Release (OpenGl_Context*)
{
//
}