draw text in 3d view

draw text in 3d view

lcavallero
Enthusiast Enthusiast
93 Views
2 Replies
Message 1 of 3

draw text in 3d view

lcavallero
Enthusiast
Enthusiast

[ FlexSim 19.0.4 ]

Hi,

I need to draw a lot of text into a 3d view into a drawtrigger. Using multiple call to "drawtext" command take a lot of time.
There are other way like opengl or mesh api?

Thanks

Luciano

Accepted solutions (1)
94 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

Yes, drawtext() has quite slow performance. It is designed to be flexible and easy, not fast.

If you are drawing static text that doesn't change very much (such as real words instead of variable number values), then you could create the text in a 3D modeling software, such as AC3D, and import entire strings of 3D text as shapes. Rendering an entire static string of text as a 3D shape is fast.

If you are trying to optimize for performance, I'd suggest doing that for as much text as you can and only using drawtext() for text that you know changes frequently and unpredictably (such as numbers).

In 19.2, we added a C++ class called a TextMesh that we use for rendering text very quickly. It generates a texture atlas for its characters within a single texture and then uses texture coordinates for mapping each character to its location in the texture atlas.

We added it so that we could render dynamic text such as label values on Rack slots very quickly:

22003-text-mesh.png

We didn't make the TextMesh accessible in FlexScript, but in 19.2, you should be able to use it in C++ code, such as in the Module SDK.



Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 3 of 3

lcavallero
Enthusiast
Enthusiast

Hi Phil,

Ok, I agree that drawtext() is designed to be flexible and easy.
I could try to use a 3d shape.
For the TextMesh I'll wait a future FlexScript version because in my library I trying use onyl FS.

Thanks

Luciano

0 Likes