mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
0024228: TKOpenGL - destroy GL context at view close
- OpenGl_Display - release GL resources correctly on closing views - OpenGl_AspectFace, OpenGl_AspectText, OpenGl_AspectLine, OpenGl_AspectMarker - initialize OpenGl resources on demand, when context is available. - Graphic3d_TextureRoot - use const modifier for GetId method to avoid asynchronous resource state at OpenGl. - Do not call OpenGL functions if no active GL context has been left - Reset thread's context before deletion for Mesa WNT
This commit is contained in:
@@ -36,29 +36,87 @@ public:
|
||||
|
||||
OpenGl_AspectMarker();
|
||||
|
||||
void Init (const Handle(OpenGl_Context)& theContext,
|
||||
const CALL_DEF_CONTEXTMARKER& theAspect);
|
||||
//! Copy parameters
|
||||
void SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect);
|
||||
|
||||
const TEL_COLOUR& Color() const { return myColor; }
|
||||
Aspect_TypeOfMarker Type() const { return myType; }
|
||||
Standard_ShortReal Scale() const { return myScale; }
|
||||
Standard_ShortReal MarkerSize() const { return myMarkerSize; }
|
||||
const Handle(OpenGl_PointSprite)& Sprite() const { return mySprite; }
|
||||
const Handle(OpenGl_PointSprite)& SpriteHighlight() const { return mySpriteA; }
|
||||
//! @return marker color
|
||||
const TEL_COLOUR& Color() const
|
||||
{
|
||||
return myColor;
|
||||
}
|
||||
|
||||
//! @return maker type
|
||||
Aspect_TypeOfMarker Type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
|
||||
//! @return marker scale
|
||||
Standard_ShortReal Scale() const
|
||||
{
|
||||
return myScale;
|
||||
}
|
||||
|
||||
//! @return marker size
|
||||
Standard_ShortReal MarkerSize() const
|
||||
{
|
||||
return myMarkerSize;
|
||||
}
|
||||
|
||||
//! Init and return OpenGl point sprite resource.
|
||||
//! @return point sprite texture.
|
||||
const Handle(OpenGl_PointSprite)& Sprite (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
if (!myIsSpriteInit)
|
||||
{
|
||||
buildSprites (theWorkspace);
|
||||
myIsSpriteInit = Standard_True;
|
||||
}
|
||||
|
||||
return mySprite;
|
||||
}
|
||||
|
||||
//! Init and return OpenGl highlight point sprite resource.
|
||||
//! @return point sprite texture for highlight.
|
||||
const Handle(OpenGl_PointSprite)& SpriteHighlight (const Handle(OpenGl_Workspace)& theWorkspace) const
|
||||
{
|
||||
if (!myIsSpriteInit)
|
||||
{
|
||||
buildSprites (theWorkspace);
|
||||
myIsSpriteInit = Standard_True;
|
||||
}
|
||||
|
||||
return mySpriteA;
|
||||
}
|
||||
|
||||
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
virtual void Release (const Handle(OpenGl_Context)& theContext);
|
||||
|
||||
protected:
|
||||
|
||||
TEL_COLOUR myColor;
|
||||
Aspect_TypeOfMarker myType;
|
||||
Standard_ShortReal myScale;
|
||||
Standard_ShortReal myMarkerSize;
|
||||
TCollection_AsciiString mySpriteKey; //!< shared resource ID
|
||||
TCollection_AsciiString mySpriteAKey; //!< shared resource ID
|
||||
Handle(OpenGl_PointSprite) mySprite; //!< normal sprite
|
||||
Handle(OpenGl_PointSprite) mySpriteA; //!< extra alphs-only sprite for RGB sprites
|
||||
void buildSprites (const Handle(OpenGl_Workspace)& theWorkspace) const;
|
||||
void resourceKeys (const Handle(Graphic3d_MarkerImage)& theMarkerImage,
|
||||
const Aspect_TypeOfMarker theType,
|
||||
const Standard_ShortReal theScale,
|
||||
const TEL_COLOUR& theColor,
|
||||
TCollection_AsciiString& theKey,
|
||||
TCollection_AsciiString& theKeyA) const;
|
||||
|
||||
protected: //! @name ordinary aspect properties
|
||||
|
||||
TEL_COLOUR myColor;
|
||||
Aspect_TypeOfMarker myType;
|
||||
Standard_ShortReal myScale;
|
||||
Handle(Graphic3d_MarkerImage) myMarkerImage;
|
||||
|
||||
protected: //! @name OpenGl resources
|
||||
|
||||
mutable Standard_ShortReal myMarkerSize;
|
||||
mutable TCollection_AsciiString mySpriteKey;
|
||||
mutable TCollection_AsciiString mySpriteAKey;
|
||||
mutable Standard_Boolean myIsSpriteInit;
|
||||
mutable Handle(OpenGl_PointSprite) mySprite; //!< normal sprite
|
||||
mutable Handle(OpenGl_PointSprite) mySpriteA; //!< extra alpha-only sprite for RGB sprites
|
||||
|
||||
public:
|
||||
|
||||
|
Reference in New Issue
Block a user