Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
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 occ::handle< Graphic3d_Text > &theTextParams)
 Creates new text in 3D space.
 
 ~OpenGl_Text () override
 Destructor.
 
void Reset (const occ::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.
 
const occ::handle< Graphic3d_Text > & Text () const
 Returns text parameters.
 
void SetText (const occ::handle< Graphic3d_Text > &theText)
 Sets text parameters.
 
bool Is2D () const
 Return true if text is 2D.
 
void Set2D (const bool theEnable)
 Set true if text is 2D.
 
void SetFontSize (const occ::handle< OpenGl_Context > &theContext, const int theFontSize)
 Setup new font size.
 
void Render (const occ::handle< OpenGl_Workspace > &theWorkspace) const override
 
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.
 
size_t EstimatedDataSize () const override
 Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
 
void UpdateDrawStats (Graphic3d_FrameStatsDataTmp &theStats, bool theIsDetailed) const override
 Increment draw calls statistics.
 
- Public Member Functions inherited from OpenGl_Element
 OpenGl_Element ()
 
virtual bool IsFillDrawMode () const
 Return TRUE if primitive type generates shaded triangulation (to be used in filters).
 
virtual void UpdateMemStats (Graphic3d_FrameStatsDataTmp &theStats) const
 Increment memory usage statistics. Default implementation puts EstimatedDataSize() into Graphic3d_FrameStatsCounter_EstimatedBytesGeom.
 
virtual void SynchronizeAspects ()
 Update parameters of the drawable elements.
 

obsolete methods

occ::handle< Graphic3d_TextmyText
 text parameters
 
occ::handle< OpenGl_FontmyFont
 text parameters
 
NCollection_DynamicArray< GLuintmyTextures
 textures' IDs
 
NCollection_DynamicArray< occ::handle< OpenGl_VertexBuffer > > myVertsVbo
 VBOs of vertices.
 
NCollection_DynamicArray< occ::handle< OpenGl_VertexBuffer > > myTCrdsVbo
 VBOs of texture coordinates.
 
occ::handle< OpenGl_VertexBuffermyBndVertsVbo
 VBOs of vertices for bounding box.
 
Font_Rect myBndBox
 text parameters
 
NCollection_Mat4< doublemyProjMatrix
 text parameters
 
NCollection_Mat4< doublemyModelMatrix
 text parameters
 
NCollection_Mat4< doublemyOrientationMatrix
 text parameters
 
NCollection_Vec3< doublemyWinXYZ
 text parameters
 
GLdouble myScaleHeight
 text parameters
 
bool myIs2d
 text parameters
 
Deprecated method Init () with obsolete arguments
 Setup new string and position.
 
Deprecated method use Init() and Text() instead of it") 1 void Init( const occ void SetPosition (const NCollection_Vec3< float > &thePoint)
 Setup new position.
 
void releaseVbos (OpenGl_Context *theCtx)
 Release cached VBO resources.
 

methods for compatibility with layers

Empty constructor

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

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.
 
- 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 occ::handle< Graphic3d_Text > & theTextParams)

Creates new text in 3D space.

◆ ~OpenGl_Text()

OpenGl_Text::~OpenGl_Text ( )
override

Destructor.

◆ OpenGl_Text() [2/2]

OpenGl_Text::OpenGl_Text ( )

Perform rendering.

Member Function Documentation

◆ DumpJson()

void OpenGl_Text::DumpJson ( Standard_OStream & theOStream,
int theDepth = -1 ) const
overridevirtual

Dumps the content of me into the stream.

Reimplemented from OpenGl_Element.

◆ EstimatedDataSize()

size_t 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 occ::handle< OpenGl_Font > OpenGl_Text::FindFont ( const occ::handle< OpenGl_Context > & theCtx,
const OpenGl_Aspects & theAspect,
int theHeight,
unsigned int theResolution,
Font_Hinting theFontHinting,
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,
int theHeight,
unsigned int theResolution,
Font_Hinting theFontHinting )
static

Create key for shared resource.

◆ Init()

Deprecated method OpenGl_Text::Init ( )

Setup new string and position.

Deprecated
(

◆ Is2D()

bool OpenGl_Text::Is2D ( ) const
inline

Return true if text is 2D.

◆ Release()

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]

void OpenGl_Text::Render ( const occ::handle< OpenGl_Context > & theCtx,
const OpenGl_Aspects & theTextAspect,
unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION,
Font_Hinting theFontHinting = Font_Hinting_Off ) const

Perform rendering.

◆ Render() [2/2]

void OpenGl_Text::Render ( const occ::handle< OpenGl_Workspace > & theWorkspace) const
overridevirtual

Implements OpenGl_Element.

◆ Reset()

void OpenGl_Text::Reset ( const occ::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 bool theEnable)
inline

Set true if text is 2D.

◆ SetFontSize()

void OpenGl_Text::SetFontSize ( const occ::handle< OpenGl_Context > & theContext,
const int theFontSize )

Setup new font size.

◆ SetPosition()

Deprecated method use Init() and Text() instead of it") 1 void Init( const occ void OpenGl_Text::SetPosition ( const NCollection_Vec3< float > & thePoint)

Setup new position.

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

◆ SetText()

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

Sets text parameters.

See also
Reset()

◆ StringSize()

static void OpenGl_Text::StringSize ( const occ::handle< OpenGl_Context > & theCtx,
const NCollection_String & theText,
const OpenGl_Aspects & theTextAspect,
const float theHeight,
const unsigned int theResolution,
const Font_Hinting theFontHinting,
float & theWidth,
float & theAscent,
float & theDescent )
static

Compute text width.

◆ Text()

const occ::handle< Graphic3d_Text > & OpenGl_Text::Text ( ) const
inline

Returns text parameters.

See also
Reset()

◆ UpdateDrawStats()

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

occ::handle<OpenGl_VertexBuffer> OpenGl_Text::myBndVertsVbo
mutableprotected

VBOs of vertices for bounding box.

◆ myFont

occ::handle<OpenGl_Font> OpenGl_Text::myFont
mutableprotected

text parameters

◆ myIs2d

bool OpenGl_Text::myIs2d
protected

text parameters

◆ myModelMatrix

NCollection_Mat4<double> OpenGl_Text::myModelMatrix
mutableprotected

text parameters

◆ myOrientationMatrix

NCollection_Mat4<double> OpenGl_Text::myOrientationMatrix
mutableprotected

text parameters

◆ myProjMatrix

NCollection_Mat4<double> OpenGl_Text::myProjMatrix
mutableprotected

text parameters

◆ myScaleHeight

GLdouble OpenGl_Text::myScaleHeight
mutableprotected

text parameters

◆ myTCrdsVbo

NCollection_DynamicArray<occ::handle<OpenGl_VertexBuffer> > OpenGl_Text::myTCrdsVbo
mutableprotected

VBOs of texture coordinates.

◆ myText

occ::handle<Graphic3d_Text> OpenGl_Text::myText
protected

text parameters

◆ myTextures

NCollection_DynamicArray<GLuint> OpenGl_Text::myTextures
mutableprotected

textures' IDs

◆ myVertsVbo

NCollection_DynamicArray<occ::handle<OpenGl_VertexBuffer> > OpenGl_Text::myVertsVbo
mutableprotected

VBOs of vertices.

◆ myWinXYZ

NCollection_Vec3<double> OpenGl_Text::myWinXYZ
mutableprotected

text parameters


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