WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-09-2013, 11:48 PM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Thanks for your reply!

Do you think the problem might also be reduced when I call the timer function in a new thread (i.e. viz. director(function))? Or would the vizard rendering loop still delay the output?
Reply With Quote
  #2  
Old 07-10-2013, 09:47 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
For high resolution timing values, you should use either viz.tick() or time.clock(). These functions will provide the number of seconds since the application started. If you need a high resolution representation of the actual time, then you can capture the current time at the beginning of your script and then add on the high resolution seconds to it at runtime. Here is an example:
Code:
import viz
import vizact
import datetime

viz.go()

# Get starting time and tick
startTime = datetime.datetime.now()
startTick = viz.tick()

def LogTime():

	# Add elapsed seconds to starting time
	curTime = startTime + datetime.timedelta(0,viz.tick()-startTick)
	print curTime.strftime('%H:%M:%S:%f')

vizact.ontimer(0.1, LogTime)
Keep in mind that writing to a file in the main rendering loop can cause drops in your framerate. You might want to consider moving your file writing code to a different thread.
Reply With Quote
  #3  
Old 07-15-2013, 06:03 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Thank you farshizzo for your detailed reply! I will try out your code as soon as possible and report back on the matter.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Head tracking logging & realtime data tmcw Vizard 2 08-18-2007 10:31 AM


All times are GMT -7. The time now is 12:22 AM.


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