[Sidefx-houdini-list] Drawing text in the viewport

Michael Scarpa michael at scarpa.name
Tue Sep 13 05:54:49 EDT 2011

Hello there,

I'm writing a render hook that is supposed to draw some geometry (lines) and some text in the viewport.

I am using RE_OGLRender::textMove3W() to get to the correct position in 3D space, where I want my text to appear, and then RE_Render::putString() to draw a string.  This works fine.

I am having two issues though, which I cannot figure out, so if anyone with experience with this could shed some light on the situation, that would be much appreciated.

Houdini version is 11.0.535 and I am stuck with this version for production.

ISSUE #1: RE_Render::putMultiLineString()
This does not work.  It draws the first line correctly, but all other lines do not appear.  I have resorted to converting the string into an UT_String, tokenising it to split out the different lines into a UT_WorkArgs object, and then looping over the items and passing each line to a separate call to RE_Render::putString(), while using RE_OGLRender::setViewportFontOffset() to offset the separate lines, so they appear underneath each other (RE_Font::getHeight() gives me the amount of pixels to use for the offset).  

Additionally, I found that before drawing each line, I have to call RE_OGLRender::textMove3W() again, even though the coordinates do not change.  If I omit that, again, only the first line of text appears (I suspect the rest of the lines are drawn at completely different positions in space).  Why do I need to call textMove3W() each time, and why does putMultiLineString() only draw the first line?

ISSUE #2: Flying point numbers
While testing variable expansion in the string I was using to display in my custom render hook, I found that, when I move my geometry such that some of its points are not in view anymore, and at the same time point number display is turned on, the text of these points  starts flying over the viewport in the opposite direction.

For example: I move the geometry towards the left edge of the screen.  The moment the first point goes off screen, its number starts flying towards the right, at a higher speed than I am panning the point, until it goes off screen to the right.

At first I thought I was doing something wrong with the drawing instructions in my code, so I started commenting out various sections of my code in an attempt to find the offender.  This resulted in me eventually commenting out my entire code, resulting in empty GR_RenderHook::renderWire() and RE_RenderHook::renderShaded() implementations, and yet the problem still occurs.  So it seems I am missing to do something important rather than doing something I should not, but what is it?

As I said: any help would be much appreciated.  Thanks.

With kind regards,


More information about the Sidefx-houdini-list mailing list