WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Positioning text with ORTHO parent (https://forum.worldviz.com/showthread.php?t=5543)

chris2307 11-06-2015 09:31 AM

Positioning text with ORTHO parent
 
I am trying to display some text on a black screen in Vizard. On single screen applications, this is very easy; I just turn the world off and display my text with the screen as the parent, i.e.:

Code:

text1 = viz.addText(txt, parent=viz.SCREEN)
My problem is when I create a three-screen application. To do so, I am creating three viz.WINDOW objects and offsetting the left and right windows by +/- 60-deg. I have to set the parent to viz.ORTHO if I wish to see text on these windows. However, they are being positioned to the default location of the bottom left of the specified window which is not where I want to see them.

Code:

text1 = viz.addText(txt, parent=viz.SCREEN, parent=viz.ORTHO, scene = screen.leftWindow)
The setPosition() function no longer works so I'm not really sure what I need to be doing in order to correctly position the text relative to the window.

Jeff 11-06-2015 12:42 PM

You can specify pixel coordinates or link to a window location:

Code:

import viz
viz.go()

#set position in pixel coordinates
text1 = viz.addText('text1',parent=viz.ORTHO)
text1.setScale([100,100,0])
text1.setPosition([300,200,0])

#link to center top
text2 = viz.addText('text2',parent=viz.ORTHO)
text2.setScale([100,100,0])
text2.alignment(viz.ALIGN_CENTER_TOP)
viz.link(viz.CenterTop,text2)

#link to upper left with offset
text3 = viz.addText('text3',parent=viz.ORTHO)
text3.setScale([100,100,0])
text3.alignment(viz.ALIGN_LEFT_TOP)
link = viz.link(viz.LeftTop,text3)
link.setOffset([20,-20,0])


chris2307 11-07-2015 05:59 AM

Ah!

It was pixel coordinates. I was attempting to use the same normalised screen units that worked when I was using viz.SCREEN as the parent so this makes much more sense now.

Thanks :-)


All times are GMT -7. The time now is 01:01 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC