More with Two windows, but now same scene

So, I gave up on pixel2d. Turns out using the OrthographicLens is sufficient. You just have to set the film size to the pixel size of your window, and you are pretty much done. Here is some code that opens two windows, puts smileys only on one window, frowney on both. Both windows are using pixels as coordinates (with zero in the center). For the curious, the reason I am using Panda3d in such an unusual way is that I am using it to create a calibration routine for an eye-tracker (my actual calibration task runs on two separate monitors, in which just one plots the eye movements). After the calibration routine, we will run a 3d VR game, in which we can track the players eye movement. As you can see, I can now tell exactly where I am plotting stuff and what size in pixels everything is. Woot!

from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject
from panda3d.core import WindowProperties
from panda3d.core import OrthographicLens
from panda3d.core import BitMask32

class World(DirectObject):
def init(self):
base = ShowBase()

    props = WindowProperties.getDefault()
    props.setOrigin(600, 200)
    window2 = base.openWindow(props)
    print base.win.getProperties().getXSize()
    print base.win.getProperties().getYSize()

    lens = OrthographicLens()
    lens.setFilmSize(800, 600)
    lens.setNearFar(-100,100)
    camera = base.camList[0]
    camera.node().setLens(lens)
    camera.reparentTo( render )

    camera2 = base.camList[1]
    camera2.node().setLens(lens)
    camera2.reparentTo( render )

    camera.node().setCameraMask(BitMask32.bit(0))
    camera2.node().setCameraMask(BitMask32.bit(1))
    base.disableMouse()

    smiley = base.loader.loadModel('smiley')
    smiley.setScale(30)
    smiley.setPos(0.5, 55, 0.5)
    smiley.reparentTo( render )
    min, max = smiley.getTightBounds()                                                             
    size = max - min                                                                                    
    print size[0], size[2]                                 
    print smiley.getPos()     
    
    smiley.hide(BitMask32.bit(0))
    smiley.show(BitMask32.bit(1))
    
    root = base.render.attachNewNode("Root")  
    smiley2 = smiley.copyTo(root)                                                        
    smiley2.setPos(-300, 0, -200) 
    smiley2.setScale(30)
    min, max = smiley2.getTightBounds()                                                             
    size = max - min                                                                                    
    print size[0], size[2]                                                                               
    print smiley2.getPos()     
    
    frowney = base.loader.loadModel('frowney')
    frowney.setScale(30)
    frowney.setPos(300, 55, 200)
    frowney.reparentTo( render )
    min, max = frowney.getTightBounds()                                                             
    size = max - min                                                                                    
    print size[0], size[2]                                                                               
    print frowney.getPos()     

if name == “main”:
W = World()
run()