WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-08-2008, 09:00 AM
aznan aznan is offline
Member
 
Join Date: Apr 2008
Posts: 11
Prioritize Director thread

Hi!
I have some custom stereo code that runs in an eternal loop in a Director thread like so:
Code:
def updateView():
	eye = False
	IPD = 0.064
	while True:
		eye = not eye
		pos = PPT.getPosition()
		
		if eye: #right eye
			pos[0] += IPD/2
		else: #left eye
			pos[0] -= IPD/2
		
		window.update(viewpos = pos) #updates perspective
		viz.waitframe(1)

viz.director(updateView)
This produces a fine stereo effect.

I have another function, newLayout(), that removes the objects in the world and replaces them with new objects in random locations. This function is called at the push of a button.

Problems arise when newLayout() is run however, as the adding of new objects demands quite a bit of CPU time. This keeps the stereo loop from executing, which might cause the stereo to be reversed - the right-eye image gets shown to the left eye and vice versa. But this shouldn't happen since updateView() is run in its own thread, right?

Is there a way to ensure that the stereo loop will always execute?
Reply With Quote
 


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:54 PM.


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