DisplayPipeline.Draw2dText in V6

unhandled

#1

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.


#2

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.


(Nathan 'jesterKing' Letwory) #4

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


(Steve Baer) #5

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

which I fixed last night


#6

@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.


#7

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.


#8

@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.


(Steve Baer) #9

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?


#10

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.


#11

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.