bjgold
07-21-2006, 02:04 PM
All:
Some time ago, you wrote us some code to display and capture data from a 5DT DataGlove 5 Ultra. I am now experimenting with the code, and would like to be able to center the viewport around the glove initially (the glove and viewport will not move subsequent to the initial centering), but cannot figure out how to accomplish this. Attached is some sample code.
Thanks,
Brian
# MAIN Start
#
viz.go()
viz.fov(65,1.3)
#viz.fov(114,1.3)
#viz.get(viz.MAIN_VIEWPOINT).translate( STARTING_VIEWPOINT_POS )
#viz.get(viz.MAIN_VIEWPOINT).lookat(0,.3,0)
phase = SHOULDER_CALIBRATION
#Setup instructions
instructions = viz.add( viz.TEXT3D, SHOULDER_CALIBRATION_INSTRUCT, viz.SCREEN )
instructions.translate( .5, .5 )
instructions.scale( INSTRUCTION_SIZE, INSTRUCTION_SIZE )
instructions.alignment( viz.TEXT_CENTER_CENTER )
#Setup videoObject
#Create a texture quad to display video texture
videoQuad = viz.add( viz.TEXQUAD, viz.SCREEN )
videoQuad.translate( .5, .5 )
videoQuad.scale( VIDEO_SCREEN_SIZE, VIDEO_SCREEN_SIZE )
#Create a transform to scale coordinates to size of video
xform = viz.Transform()
xform.setScale(640,480,1)
#Apply texture matrix to quad
videoQuad.texmat(xform)
videoQuad.visible( viz.OFF )
view = viz.get(viz.MAIN_VIEWPOINT)
#Add sensors
handSensor = viz.add('patriot.dls')
armSensor = viz.add('patriot.dls')
#Add 5DT glove
PORT_5DT_USB = 0
gloveSensor = viz.add('5dt.dls')
#viz.gloveSensor()
#gloveSensor.reset()
print gloveSensor.get()
Some time ago, you wrote us some code to display and capture data from a 5DT DataGlove 5 Ultra. I am now experimenting with the code, and would like to be able to center the viewport around the glove initially (the glove and viewport will not move subsequent to the initial centering), but cannot figure out how to accomplish this. Attached is some sample code.
Thanks,
Brian
# MAIN Start
#
viz.go()
viz.fov(65,1.3)
#viz.fov(114,1.3)
#viz.get(viz.MAIN_VIEWPOINT).translate( STARTING_VIEWPOINT_POS )
#viz.get(viz.MAIN_VIEWPOINT).lookat(0,.3,0)
phase = SHOULDER_CALIBRATION
#Setup instructions
instructions = viz.add( viz.TEXT3D, SHOULDER_CALIBRATION_INSTRUCT, viz.SCREEN )
instructions.translate( .5, .5 )
instructions.scale( INSTRUCTION_SIZE, INSTRUCTION_SIZE )
instructions.alignment( viz.TEXT_CENTER_CENTER )
#Setup videoObject
#Create a texture quad to display video texture
videoQuad = viz.add( viz.TEXQUAD, viz.SCREEN )
videoQuad.translate( .5, .5 )
videoQuad.scale( VIDEO_SCREEN_SIZE, VIDEO_SCREEN_SIZE )
#Create a transform to scale coordinates to size of video
xform = viz.Transform()
xform.setScale(640,480,1)
#Apply texture matrix to quad
videoQuad.texmat(xform)
videoQuad.visible( viz.OFF )
view = viz.get(viz.MAIN_VIEWPOINT)
#Add sensors
handSensor = viz.add('patriot.dls')
armSensor = viz.add('patriot.dls')
#Add 5DT glove
PORT_5DT_USB = 0
gloveSensor = viz.add('5dt.dls')
#viz.gloveSensor()
#gloveSensor.reset()
print gloveSensor.get()