PDA

View Full Version : addText problems with 3 windows


Ravi
08-24-2008, 04:55 AM
Hi

I have some problems with sowing text via viz.addTest() in a Setup with three windows. The text isn't displayed.

creating the Windows:
# Create a new window on the left side
self.LeftWindow = viz.add(viz.WINDOW)
self.LeftWindow.position(0, 1)
self.LeftWindow.size(1.0/3, 1.0)
self.LeftWindow.visible(0,viz.SCREEN)
self.LeftWindow.fov(FOV,ASPECT_RATIO)

#print self.LeftWindow
#self.CenterWindow = viz.add(viz.WINDOW)
#self.CenterWindow.position(1.0/3, 1.0)
#self.CenterWindow.size(1.0/3, 1.0)
#self.CenterWindow.visible(0,viz.SCREEN)
#self.CenterWindow.fov(FOV,ASPECT_RATIO)
self.CenterWindow = viz.MainWindow
self.CenterWindow.position(1.0/3, 1.0)
self.CenterWindow.size(1.0/3, 1.0)
self.CenterWindow.visible(0,viz.SCREEN)
self.CenterWindow.fov(FOV,ASPECT_RATIO)


#Create a new window on the right side
self.RightWindow = viz.add(viz.WINDOW)
self.RightWindow.position(2.0/3, 1.0)
self.RightWindow.size(1.0/3, 1.0)
self.RightWindow.visible(0,viz.SCREEN)
self.RightWindow.fov(FOV,ASPECT_RATIO)

# Create new viewports
self.LeftView = viz.add(viz.VIEWPOINT)
self.RightView = viz.add(viz.VIEWPOINT)
self.CenterView = viz.add(viz.VIEWPOINT)

#Attach the the viewports to the windows
self.LeftWindow.viewpoint(self.LeftView)
self.RightWindow.viewpoint(self.RightView)
self.CenterWindow.viewpoint(self.CenterView)

#Rotate the view so that it looks down


#set the viewing angle for the windows
self.LeftView.rotate(1,LEFT_ANGLE,0,0)
self.RightView.rotate(1,RIGHT_ANGLE,0,0)

creating the text:
self.anweisung = viz.addText("",viz.SCREEN,self.CenterWindow)
self.anweisung.translate(0.5,0.5)
self.anweisung.color(viz.RED)

later the anweisung.message("...") command is used to show and to change the text.
Unfortunately there is no text displayed, since we changed to the 3 window setup. With one it is working poperly.
Any idea why this isn't working?

farshizzo
08-25-2008, 05:51 PM
If you specify a window object as the scene of a text, then you need to specify viz.ORTHO as the parent, not viz.SCREEN. Also, when adding object to the viz.ORTHO layer, the position units are in pixels, not normalized coordinates. Here is sample code:self.anweisung = viz.addText("hello",viz.ORTHO,self.CenterWindow,fontSize=32)
self.anweisung.translate(50,50) #50 pixel from bottom left corner of window