DisplayPipeline.Draw2dText in V6

Hi @dale, @stevebaer,

i have a custom conduit using DisplayPipeline.Draw2dText method in the PostDrawObjects event. In V5 it works, but in V6 nothing is drawn. I use this one which allows to pass a Point3d. Tries various overloads but none of them work in V6, if i draw in DrawForeground it works.
_
c.

Found one more thing, probably related to Measure2dText. The following code:

rec = e.Display.Measure2dText(text, pt2d, True, 0, 12, "Arial")
rec.Inflate(4,4)
e.Display.Draw2dRectangle(rec, Color.Black, 1, Color.Black)
e.Display.Draw2dText(text, Color.White, pt2d, True, 12, "Arial")

produced this in RH5:

grafik

In V6 it looks like this:

grafik

In regards to my first question, there seem no real order in which the elements are drawn using the DrawForeground event eg. an arrow drawn using DrawArrow before the rectangle and the text, shines through the rectangle and the text.

grafik

How can i prevent that ?

_
c.

I’m guessing @stevebaer knows best what’s going on here.

This looks like https://mcneel.myjetbrains.com/youtrack/issue/RH-45226

which I fixed last night

@stevebaer, i can see changes for GH, TextTag is working now. I also see that i can use Draw2dText in the PostDrawObjects event of a conduit . But the Measure2dText is not working like in V5 unless i inflate the rectangle. Please compare this example in V5 and V6:

DrawTest.py (1.1 KB)

If you uncomment line 19 it works in V6, and the rectangle correctly obsures the arrow line which is what i want. How can i get this working in V5 ? There the arrow line shines through the rectangle and text, making it unreadable.

Also please note what happens to the text aliasing when you change it to DrawOverlay.

_
c.

Hi @stevebaer, bewlow is an example image with the text aliasing. In V5 everyting is crystal sharp. In V6, i get different results. The left column shows how it looks while i rotate the view using RMB. Once i release the mouse it turns into the right column:

grafik

The text is drawn in a DrawForeground event.

_
c.

@stevebaer, anything i can do to fix the aliasing issue ? I’ve tried to use DrawOverlay instead but it behaves the same with all 2d text:

grafik

The line drop in the right image is caused by the bug mentioned above with Measure2dText.
_
c.

Hmm… this is bizarre. I can’t repeat the aliased text at all with the python script sample you posted. There really shouldn’t be any degradation in how text is drawn based on if you are in what we consider a dynamic mode or not. What is the OpenGL version that your driver says it supports? This can be found on Rhino’s OpenGL settings page or by running the SystemInfo command.

Also, do you have any anti-aliasing turned on?

Hi @stevebaer, these are my settings:

If i draw my 2d text in the DrawOverlay event of my conduit, when AA is set to None, i get the ugly version of the 2d text always, and it does not alias it in dynamic mode as well. If i have AA enabled, either at 2x, 4x or 8x, the text looks ugly and only is aliased in dynamic mode (while i navigate).

If i draw my 2d text in the DrawForeground event, when AA is enabled in Rhino, the text looks aliased and stays aliased even in dynamic mode.

_
c.

The example above uses PostDrawObjects, do you see it if you change the event name to DrawOverlay ? (please uncomment line 19 too). Looks like this here:

_
c.

Hey Clement,
I’m just revisiting this topic to see if this is still happening in SR11

Hi @stevebaer, thank you for looking at this. I can confirm that both bugs reported above are still in 6.12.18316.2251, 12.11.2018.

Everything i draw in a DrawOverlay event is drawn without aliasing unless i navigate the view. Once i start navigation it is displayed properly aliased. If i release my mouse, it is drawn unaliased. I’ve shown this in the video above.

The Measure2dText still gives different results compared to V5. If i measure 2D Text and use the boundary to draw a filled rectangle using Draw2dRectangle, the size of the rectangle is smaller than the bounds of the text. It seems that this only applies to the height of the rectangle as shown in post #2

c.

Hello,
maybe it can help you with the height of Measure2dText :

jmv

Thank you @kitjmv, i’ve seen this. But why does it work in V5 and not in V6 ? Imho the method should give identical results in both Rhino versions.

_
c.

i’m agree…

Hi @stevebaer, i still have the unaliased text problem in DrawOverlay with SR13, the text is drawn aliased while i navigate the view and is drawn unaliased when i stop navigation. Once i switch the function name to DrawForeground the text stays aliased regardless of navigation.

_
c.