Open CASCADE Technology 7.8.2.dev
|
Text rendering. More...
#include <OpenGl_Text.hxx>
Public Member Functions | |
OpenGl_Text (const Handle< Graphic3d_Text > &theTextParams) | |
Creates new text in 3D space. | |
virtual | ~OpenGl_Text () |
Destructor. | |
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. | |
const Handle< Graphic3d_Text > & | Text () const |
Returns text parameters. | |
void | SetText (const Handle< Graphic3d_Text > &theText) |
Sets text parameters. | |
Standard_Boolean | Is2D () const |
Return true if text is 2D. | |
void | Set2D (const Standard_Boolean theEnable) |
Set true if text is 2D. | |
void | SetFontSize (const Handle< OpenGl_Context > &theContext, const Standard_Integer theFontSize) |
Setup new font size. | |
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. | |
virtual Standard_Size | EstimatedDataSize () const override |
Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules. | |
virtual void | UpdateDrawStats (Graphic3d_FrameStatsDataTmp &theStats, bool theIsDetailed) const override |
Increment draw calls statistics. | |
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). | |
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 | |
Handle< Graphic3d_Text > | myText |
text parameters | |
Handle< OpenGl_Font > | myFont |
text parameters | |
NCollection_Vector< GLuint > | myTextures |
textures' IDs | |
NCollection_Vector< Handle< OpenGl_VertexBuffer > > | myVertsVbo |
VBOs of vertices. | |
NCollection_Vector< Handle< OpenGl_VertexBuffer > > | myTCrdsVbo |
VBOs of texture coordinates. | |
Handle< OpenGl_VertexBuffer > | myBndVertsVbo |
VBOs of vertices for bounding box. | |
Font_Rect | myBndBox |
text parameters | |
OpenGl_Mat4d | myProjMatrix |
text parameters | |
OpenGl_Mat4d | myModelMatrix |
text parameters | |
OpenGl_Mat4d | myOrientationMatrix |
text parameters | |
OpenGl_Vec3d | myWinXYZ |
text parameters | |
GLdouble | myScaleHeight |
text parameters | |
Standard_Boolean | myIs2d |
text parameters | |
void | Init (const Handle< OpenGl_Context > &theCtx, const Standard_Utf8Char *theText, const OpenGl_Vec3 &thePoint) |
Setup new string and position. | |
void | SetPosition (const OpenGl_Vec3 &thePoint) |
Setup new position. | |
void | releaseVbos (OpenGl_Context *theCtx) |
Release cached VBO resources. | |
methods for compatibility with layers | |
OpenGl_Text () | |
Empty constructor. | |
void | Render (const 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. | |
virtual void | DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const override |
Dumps the content of me into the stream. | |
static TCollection_AsciiString | FontKey (const OpenGl_Aspects &theAspect, Standard_Integer theHeight, unsigned int theResolution, Font_Hinting theFontHinting) |
Create key for shared resource. | |
static Handle< OpenGl_Font > | FindFont (const Handle< OpenGl_Context > &theCtx, const OpenGl_Aspects &theAspect, Standard_Integer 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 Handle< OpenGl_Context > &theCtx, const NCollection_String &theText, const OpenGl_Aspects &theTextAspect, const Standard_ShortReal theHeight, const unsigned int theResolution, const Font_Hinting theFontHinting, Standard_ShortReal &theWidth, Standard_ShortReal &theAscent, Standard_ShortReal &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 () |
Text rendering.
OpenGl_Text::OpenGl_Text | ( | const Handle< Graphic3d_Text > & | theTextParams | ) |
Creates new text in 3D space.
|
virtual |
Destructor.
OpenGl_Text::OpenGl_Text | ( | ) |
Empty constructor.
|
overridevirtual |
Dumps the content of me into the stream.
Reimplemented from OpenGl_Element.
|
overridevirtual |
Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
Reimplemented from OpenGl_Element.
|
static |
Find shared resource for specified font or initialize new one.
|
static |
Create key for shared resource.
void OpenGl_Text::Init | ( | const Handle< OpenGl_Context > & | theCtx, |
const Standard_Utf8Char * | theText, | ||
const OpenGl_Vec3 & | thePoint ) |
Setup new string and position.
|
inline |
Return true if text is 2D.
|
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.
|
protected |
Release cached VBO resources.
void OpenGl_Text::Render | ( | const 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.
|
overridevirtual |
Implements OpenGl_Element.
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.
|
inline |
Set true if text is 2D.
void OpenGl_Text::SetFontSize | ( | const Handle< OpenGl_Context > & | theContext, |
const Standard_Integer | theFontSize ) |
Setup new font size.
void OpenGl_Text::SetPosition | ( | const OpenGl_Vec3 & | thePoint | ) |
Setup new position.
|
inline |
Sets text parameters.
|
static |
Compute text width.
|
inline |
Returns text parameters.
|
overridevirtual |
Increment draw calls statistics.
Reimplemented from OpenGl_Element.
|
mutableprotected |
text parameters
|
mutableprotected |
VBOs of vertices for bounding box.
|
mutableprotected |
text parameters
|
protected |
text parameters
|
mutableprotected |
text parameters
|
mutableprotected |
text parameters
|
mutableprotected |
text parameters
|
mutableprotected |
text parameters
|
mutableprotected |
VBOs of texture coordinates.
|
protected |
text parameters
|
mutableprotected |
textures' IDs
|
mutableprotected |
VBOs of vertices.
|
mutableprotected |
text parameters