Please help, I think I am going crazy. A while back, I figured out the recipe for drawing a text with a fixed size regardless of the size of the object. I tried to do the same thing right now, from a C++ module, and it didn't work. So I tried to draw a simple sphere and it didn't work. Then I put the same code in the OnDraw trigger in FlexSim and .. it worked!
As far as I was able to figure out, the FlexScript trigger and the C++ method are called from the same OpenGL state (there is no intermediate transformation going on) so the code should have the same result.
Expected result
The red sphere and the "FlexSim" text as shown in the screenshot below (as produced by FlexScript's OnDraw)
Actual result
The green sphere and the "Module!" text in the screenshot below (the current output of the module's OnDraw).
Both are produced using (the FlexScript and C++ equivalent, respectively, of)
fglPushMatrix(); drawtomodelscale( current ); drawsphere( 0, 0, 0, 0.5, 255, 0, 0, 0.5 ); spacetranslate( 0, 0, current.size.z ); spacescale( current.size.x, current.size.y, current.size.z ); drawtext( view, "FlexSim", /* loc: */ 0, 0, 0, /* size: */ 0, /* textSize: */ 0.75, 0, /* rot: */ 0, 0, 0, /* rgba: */ 0, 0, 0, 1 ); fglPopMatrix();
A Minimal Complete Reproducible Example including the module and a test model is here: Test.zip