WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Displaying Text on new Window (https://forum.worldviz.com/showthread.php?t=5023)

chris2307 04-24-2014 09:00 AM

Displaying Text on new Window
 
Hi all,

I have an application which can either run in single screen mode or three screen mode.

Single screen mode uses viz.MainView only and three screen mode, I use three custom windows.

My only problem is when I attempt to display text in the centre of the application. The parent of the text by default is viz.SCREEN. I attempt to reset this if I am in three screen mode to the centre screen.

Unfortunately, I don't see the text. I don't get errors either.

Screen Code:
Code:


# The following is also done for the left window and right window.

centreWindow = viz.add(viz.WINDOW)
centreWindow.setPosition(1.0/3, 1.0)
centreWindow.setSize(1.0/3, 1.0)
centreWindow.visible(0,viz.SCREEN)
centreWindow.fov(fieldOfView,aspectRatio)
centreView = viz.add(viz.VIEWPOINT)
centreWindow.setView(centreView)

def returnScreen():
        if(threeScreen):
                return centreWindow
        else:
                return False

Here is my default text code:
Code:

self.trialInstructions = "TEXT"
self.text = viz.addText(self.trialInstructions, parent=viz.SCREEN)
self.text.color(viz.WHITE)
self.text.setPosition(0.5,0.5)
self.text.alignment(viz.ALIGN_CENTER_CENTER)
self.text.fontSize(40)
self.text.visible(viz.OFF)

During three screen mode, I run this code:
Code:

if not(screen.returnScreen() == False):
        print otherScreen
        self.text.setParent(otherScreen)

self.text.visible(viz.ON)

Can anyone see the mistake I am making?

Thanks

farshizzo 04-25-2014 09:03 AM

If you only want the object to show up on a specific window, then use the renderOnlyToWindows command. Example:
Code:

self.text.renderOnlyToWindows([centreWindow])


All times are GMT -7. The time now is 06:35 AM.

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