WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 10-12-2006, 10:51 AM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
problem with stereo mode

Hi again,

I'm having a problem getting into stereo mode.

I have two demo's. The first demo runs just fine.

The second demo involves manipulating the camera's location with a game pad. However, whenever I try to use viz.QUAD_BUFFER, I don't get stereo mode.

Here is my code:

Code:
##Name     :George D. Lecakes Jr
##Created  : October 11, 2006
##Modified : October 11, 2006
##Descr    : 	This program creates a viewport that centers around
##				the translational properties of an object similar
##				to that of a video game.
####################################################################

import viz

##############################################
##Game Pad Library Information
##############################################
import sid


viz.go(viz.QUAD_BUFFER)
viz.viewdist(-5)


##############################################
#Global Variables
##############################################

##Height from Interest

H = 0

##X from Interest

R = 0

##Z from Interest

I = 0


##############################################
##Reference Plane
##############################################

envio = viz.add('coords.obj')
envio.translate(0,-3,0)

##############################################
#Model of Interest
##############################################

modelOfInterest = viz.add('templateModel.obj')

##############################################
##Create a new viewpoint
##############################################

objectTracker = viz.add(viz.VIEWPOINT)

###############################################
##Get and set the main window to the viewpoint
###############################################

mainWindow = viz.get(viz.MAIN_WINDOW)
mainWindow.viewpoint(objectTracker)

###############################################
##Initialize Elements
###############################################

######################
##Object Of Interest
######################

interestx = 0 
interesty = 0
interestz = 0

modelOfInterest.translate(interestx,interesty,interestz)

######################
##Viewpoint
######################

viewCoordx = 0
viewCoordy = 10
viewCoordz = 20

objectTracker.translate(viewCoordx,viewCoordy,viewCoordz)

###############################################
#Function Declarations
###############################################
def georgesTimer(timerNum):
	
	## Get the translation information of the desired object
	
	#interest = modelOfInterest.get(viz.POSITION)
	
	## Get the translation information of the viewpoint
	
	#viewCoords = objectTracker.get(viz.POSITION)
	
	## See which gamepad button has been pressed
	
	global H
	global R
	global I
	
	global upCheck
	
	global interestx 
	global interesty
	global interestz
	
	global viewCoordx
	global viewCoordy
	global viewCoordz
	
	upCheck = 0
	
	## Up
	
	if sid.isbuttondown(7):
		
		diff = viewCoordy - interesty
				
		##  If view is above interest

		if  diff > 0:
			H = (H + .1)
			viewCoordy = (interesty + H)
			
		##  If View is below interet
	
		if diff < 0:
			H = (H + .1)
			viewCoordy = (interesty + H)
			
		## If View is equal to interest
	
		if diff == 0:
			viewCoordy = 0
			H = (H + .1)
			viewCoordy = (interesty + H)
						
## Down
	
	if sid.isbuttondown(8):
		
		diff = viewCoordy - interesty
	
		##  If view is above interest

		if  diff > 0:
			H = (H - .1)
			viewCoordy = (interesty + H)

		##  If View is below interest
		
		if diff < 0:
			H = (H - .1)
			viewCoordy = (interesty - abs(H))
		
		## If View is equal to interest
		
		if diff == 0: 
			viewCoordy = 0
			H = (H - .1)	
			viewCoordy = (interesty + H)
			

##Forward
	
	if sid.isbuttondown(3):
		
		diff = viewCoordx - interestx
	
		##  If view is above interest

		if  diff > 0:
			R = (R + .1)
			viewCoordx = (interestx + R)
			
		##  If View is below interet
	
		if diff < 0:
			R = (R + .1)
			viewCoordx = (interestx + R)
			
		## If View is equal to interest
	
		if diff == 0:
			viewCoordx = 0
			R = (R + .1)
			viewCoordx = (interestx + R)
			
##Backward	

	if sid.isbuttondown(2):
		
		diff = viewCoordx - interestx
	
		##  If view is above interest

		if  diff > 0:
			R = (R - .1)
			viewCoordx = (interestx + R)

		##  If View is below interest
		
		if diff < 0:
			R = (R - .1)
			viewCoordx = (interestx - abs(R))
		
		## If View is equal to interest
		
		if diff == 0: 
			viewCoordx = 0
			R = (R - .1)	
			viewCoordx = (interestx + R)

##Left
	
	if sid.isbuttondown(1):
		
		diff = viewCoordz - interestz
	
		##  If view is above interest

		if  diff > 0:
			I = (I + .1)
			viewCoordz = (interestz + I)
			
		##  If View is below interet
	
		if diff < 0:
			I = (I + .1)
			viewCoordz = (interestz + I)
			
		## If View is equal to interest
	
		if diff == 0:
			viewCoordz = 0
			I = (I + .1)
			viewCoordz = (interestz + I)
			
##Right	

	if sid.isbuttondown(4):
		
		diff = viewCoordz - interestz
	
		##  If view is above interest

		if  diff > 0:
			I = (I - .1)
			viewCoordz = (interestz + I)

		##  If View is below interest
		
		if diff < 0:
			I = (I - .1)
			viewCoordz = (interestz - abs(I))
		
		## If View is equal to interest
		
		if diff == 0: 
			viewCoordz = 0
			I = (I - .1)	
			viewCoordz = (interestz + I)



	objectTracker.translate(viewCoordx,viewCoordy,viewCoordz)
	objectTracker.lookat(modelOfInterest.get(viz.POSITION))
	print viewCoordx

###############################################
##CallBack to Functions
###############################################

viz.callback(viz.TIMER_EVENT, georgesTimer)
viz.starttimer(0,0, viz.PERPETUAL)
Reply With Quote
  #2  
Old 10-13-2006, 03:59 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Are you able to get QUAD_BUFFER working with other scripts? QUAD_BUFFER stereo mode only works with specific graphics cards, like the nVidia Quadro. Do you have a capable graphics card?
Reply With Quote
  #3  
Old 10-17-2006, 07:26 AM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
Yes, we are able to get it working with ANY other script we have. As long as we don't start messing with the camera's coordinates directly through scripting things are fine.
But in the code I supplied as well as another camera rig I developed, it will not enter stereo mode. We are were unable to force the 'planets' demo into stereo mode and we were wondering if there might be a similar problem there as well.

~~George
Rowan University
VR Laboratory
Reply With Quote
  #4  
Old 10-17-2006, 09:58 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I tested out your script with Vizard 2.5 and experienced the same problem you described. I tried it out with Vizard 3.0 and it works fine. The problem is not caused by manipulating the viewpoint, but by adding a new viewpoint to the main window. In your script the workaround would be to replace the following code:
Code:
##############################################
##Create a new viewpoint
##############################################

objectTracker = viz.add(viz.VIEWPOINT)

###############################################
##Get and set the main window to the viewpoint
###############################################

mainWindow = viz.get(viz.MAIN_WINDOW)
mainWindow.viewpoint(objectTracker)
with:
Code:
##############################################
##Get the main viewpoint
##############################################

objectTracker = viz.get(viz.MAIN_VIEWPOINT)

###############################################
##Get the main window
###############################################

mainWindow = viz.get(viz.MAIN_WINDOW)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:21 AM.


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