Open CASCADE Technology  7.4.1.dev
Public Member Functions
OpenGl_Text Class Reference

Text rendering. More...

#include <OpenGl_Text.hxx>

Inheritance diagram for OpenGl_Text:
Inheritance graph
[legend]

Public Member Functions

 OpenGl_Text (const Handle< Graphic3d_Text > &theTextParams)
 Creates new text in 3D space. More...
 
virtual ~OpenGl_Text ()
 Destructor. More...
 
void Reset (const Handle< OpenGl_Context > &theCtx)
 Release cached VBO resources and the previous font if height changed. Cached structures will be refilled by the next render. Call Reset after modifying text parameters. More...
 
const Handle< Graphic3d_Text > & Text () const
 Returns text parameters. More...
 
void SetText (const Handle< Graphic3d_Text > &theText)
 Sets text parameters. More...
 
Standard_Boolean Is2D () const
 Return true if text is 2D. More...
 
void Set2D (const Standard_Boolean theEnable)
 Set true if text is 2D. More...
 
void SetFontSize (const Handle< OpenGl_Context > &theContext, const Standard_Integer theFontSize)
 Setup new font size. More...
 
virtual void Render (const Handle< OpenGl_Workspace > &theWorkspace) const override
 
virtual void Release (OpenGl_Context *theContext) override
 Release GPU resources. 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. More...
 
virtual Standard_Size EstimatedDataSize () const override
 Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules. More...
 
virtual void UpdateDrawStats (Graphic3d_FrameStatsDataTmp &theStats, bool theIsDetailed) const override
 Increment draw calls statistics. More...
 
- Public Member Functions inherited from OpenGl_Element
 OpenGl_Element ()
 
virtual Standard_Boolean IsFillDrawMode () const
 Return TRUE if primitive type generates shaded triangulation (to be used in filters). More...
 
virtual void UpdateMemStats (Graphic3d_FrameStatsDataTmp &theStats) const
 Increment memory usage statistics. Default implementation puts EstimatedDataSize() into Graphic3d_FrameStatsCounter_EstimatedBytesGeom. More...
 
virtual void SynchronizeAspects ()
 Update parameters of the drawable elements. More...
 

methods for compatibility with layers

 OpenGl_Text ()
 Empty constructor. More...
 
void Render (const Handle< OpenGl_Context > &theCtx, const OpenGl_Aspects &theTextAspect, unsigned int theResolution=Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION) const
 Perform rendering. More...
 
virtual void DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const override
 Dumps the content of me into the stream. More...
 
static TCollection_AsciiString FontKey (const OpenGl_Aspects &theAspect, Standard_Integer theHeight, unsigned int theResolution)
 Create key for shared resource. More...
 
static Handle< OpenGl_FontFindFont (const Handle< OpenGl_Context > &theCtx, const OpenGl_Aspects &theAspect, Standard_Integer theHeight, unsigned int theResolution, const TCollection_AsciiString &theKey)
 Find shared resource for specified font or initialize new one. More...
 
static void StringSize (const Handle< OpenGl_Context > &theCtx, const NCollection_String &theText, const OpenGl_Aspects &theTextAspect, const Standard_ShortReal theHeight, const unsigned int theResolution, Standard_ShortReal &theWidth, Standard_ShortReal &theAscent, Standard_ShortReal &theDescent)
 Compute text width. More...
 

obsolete methods

Handle< Graphic3d_TextmyText
 text parameters More...
 
Handle< OpenGl_FontmyFont
 text parameters More...
 
NCollection_Vector< GLuint > myTextures
 textures' IDs More...
 
NCollection_Vector< Handle< OpenGl_VertexBuffer > > myVertsVbo
 VBOs of vertices. More...
 
NCollection_Vector< Handle< OpenGl_VertexBuffer > > myTCrdsVbo
 VBOs of texture coordinates. More...
 
Handle< OpenGl_VertexBuffermyBndVertsVbo
 VBOs of vertices for bounding box. More...
 
Font_Rect myBndBox
 text parameters More...
 
OpenGl_Mat4d myProjMatrix
 text parameters More...
 
OpenGl_Mat4d myModelMatrix
 text parameters More...
 
OpenGl_Mat4d myOrientationMatrix
 text parameters More...
 
OpenGl_Vec3d myWinXYZ
 text parameters More...
 
GLdouble myScaleHeight
 text parameters More...
 
Standard_Boolean myIs2d
 text parameters More...
 
void Init (const Handle< OpenGl_Context > &theCtx, const Standard_Utf8Char *theText, const OpenGl_Vec3 &thePoint)
 Setup new string and position. More...
 
void SetPosition (const OpenGl_Vec3 &thePoint)
 Setup new position. More...
 
void releaseVbos (OpenGl_Context *theCtx)
 Release cached VBO resources. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenGl_Element
template<typename theResource_t >
static void Destroy (OpenGl_Context *theContext, theResource_t *&theElement)
 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. More...
 
- Protected Member Functions inherited from OpenGl_Element
virtual ~OpenGl_Element ()
 

Detailed Description

Text rendering.

Constructor & Destructor Documentation

◆ OpenGl_Text() [1/2]

OpenGl_Text::OpenGl_Text ( const Handle< Graphic3d_Text > &  theTextParams)

Creates new text in 3D space.

◆ ~OpenGl_Text()

virtual OpenGl_Text::~OpenGl_Text ( )
virtual

Destructor.

◆ OpenGl_Text() [2/2]

OpenGl_Text::OpenGl_Text ( )

Empty constructor.

Member Function Documentation

◆ DumpJson()

virtual void OpenGl_Text::DumpJson ( Standard_OStream theOStream,
Standard_Integer  theDepth = -1 
) const
overridevirtual

Dumps the content of me into the stream.

Reimplemented from OpenGl_Element.

◆ EstimatedDataSize()

virtual Standard_Size OpenGl_Text::EstimatedDataSize ( ) const
overridevirtual

Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.

Reimplemented from OpenGl_Element.

◆ FindFont()

static Handle< OpenGl_Font > OpenGl_Text::FindFont ( const Handle< OpenGl_Context > &  theCtx,
const OpenGl_Aspects theAspect,
Standard_Integer  theHeight,
unsigned int  theResolution,
const TCollection_AsciiString theKey 
)
static

Find shared resource for specified font or initialize new one.

◆ FontKey()

static TCollection_AsciiString OpenGl_Text::FontKey ( const OpenGl_Aspects theAspect,
Standard_Integer  theHeight,
unsigned int  theResolution 
)
static

Create key for shared resource.

◆ Init()

void OpenGl_Text::Init ( const Handle< OpenGl_Context > &  theCtx,
const Standard_Utf8Char theText,
const OpenGl_Vec3 thePoint 
)

Setup new string and position.

Deprecated:
("Deprecated method Init() with obsolete arguments, use Init() and Text() instead of it")

◆ Is2D()

Standard_Boolean OpenGl_Text::Is2D ( ) const
inline

Return true if text is 2D.

◆ Release()

virtual void OpenGl_Text::Release ( OpenGl_Context theContext)
overridevirtual

Release GPU resources. 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.

Implements OpenGl_Element.

◆ releaseVbos()

void OpenGl_Text::releaseVbos ( OpenGl_Context theCtx)
protected

Release cached VBO resources.

◆ Render() [1/2]

virtual void OpenGl_Text::Render ( const Handle< OpenGl_Workspace > &  theWorkspace) const
overridevirtual

Implements OpenGl_Element.

◆ Render() [2/2]

void OpenGl_Text::Render ( const Handle< OpenGl_Context > &  theCtx,
const OpenGl_Aspects theTextAspect,
unsigned int  theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION 
) const

Perform rendering.

◆ Reset()

void OpenGl_Text::Reset ( const Handle< OpenGl_Context > &  theCtx)

Release cached VBO resources and the previous font if height changed. Cached structures will be refilled by the next render. Call Reset after modifying text parameters.

◆ Set2D()

void OpenGl_Text::Set2D ( const Standard_Boolean  theEnable)
inline

Set true if text is 2D.

◆ SetFontSize()

void OpenGl_Text::SetFontSize ( const Handle< OpenGl_Context > &  theContext,
const Standard_Integer  theFontSize 
)

Setup new font size.

◆ SetPosition()

void OpenGl_Text::SetPosition ( const OpenGl_Vec3 thePoint)

Setup new position.

Deprecated:
("Deprecated method SetPosition(), use Graphic3d_Text for it")

◆ SetText()

void OpenGl_Text::SetText ( const Handle< Graphic3d_Text > &  theText)
inline

Sets text parameters.

See also
Reset()

◆ StringSize()

static void OpenGl_Text::StringSize ( const Handle< OpenGl_Context > &  theCtx,
const NCollection_String theText,
const OpenGl_Aspects theTextAspect,
const Standard_ShortReal  theHeight,
const unsigned int  theResolution,
Standard_ShortReal theWidth,
Standard_ShortReal theAscent,
Standard_ShortReal theDescent 
)
static

Compute text width.

◆ Text()

const Handle< Graphic3d_Text >& OpenGl_Text::Text ( ) const
inline

Returns text parameters.

See also
Reset()

◆ UpdateDrawStats()

virtual void OpenGl_Text::UpdateDrawStats ( Graphic3d_FrameStatsDataTmp theStats,
bool  theIsDetailed 
) const
overridevirtual

Increment draw calls statistics.

Reimplemented from OpenGl_Element.

Field Documentation

◆ myBndBox

Font_Rect OpenGl_Text::myBndBox
mutableprotected

text parameters

◆ myBndVertsVbo

Handle< OpenGl_VertexBuffer > OpenGl_Text::myBndVertsVbo
mutableprotected

VBOs of vertices for bounding box.

◆ myFont

Handle< OpenGl_Font > OpenGl_Text::myFont
mutableprotected

text parameters

◆ myIs2d

Standard_Boolean OpenGl_Text::myIs2d
protected

text parameters

◆ myModelMatrix

OpenGl_Mat4d OpenGl_Text::myModelMatrix
mutableprotected

text parameters

◆ myOrientationMatrix

OpenGl_Mat4d OpenGl_Text::myOrientationMatrix
mutableprotected

text parameters

◆ myProjMatrix

OpenGl_Mat4d OpenGl_Text::myProjMatrix
mutableprotected

text parameters

◆ myScaleHeight

GLdouble OpenGl_Text::myScaleHeight
mutableprotected

text parameters

◆ myTCrdsVbo

NCollection_Vector<Handle< OpenGl_VertexBuffer > > OpenGl_Text::myTCrdsVbo
mutableprotected

VBOs of texture coordinates.

◆ myText

Handle< Graphic3d_Text > OpenGl_Text::myText
protected

text parameters

◆ myTextures

NCollection_Vector<GLuint> OpenGl_Text::myTextures
mutableprotected

textures' IDs

◆ myVertsVbo

NCollection_Vector<Handle< OpenGl_VertexBuffer > > OpenGl_Text::myVertsVbo
mutableprotected

VBOs of vertices.

◆ myWinXYZ

OpenGl_Vec3d OpenGl_Text::myWinXYZ
mutableprotected

text parameters


The documentation for this class was generated from the following file: