WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 11-30-2004, 03:55 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Okay, then the lag is coming from loading the textures. You can do two things. Preload all the textures and save them into a list. Or, when you add the textures, you can tell Vizard to use any existing texture with the same filename.
Code:
newtexture = viz.add(texture,viz.TEX_2D,1)
I would recommend that you simply preload all the textures into a python dictionary. I'm assuming the variable 'emotion' is a string.
Code:
#The following code will cache the emotion textures

#Create a python dictionary
self.emotionMap = {}

#A list of all the different emotion names
emotionNames = ['happy','sad','angry']

#Iterate through emotion names and load texture
for emotion in emotionNames:
	texture = self.prefix + '_Bio_UV_Head' + emotion + '.jpg'
	newtexture = viz.add(texture) 
	newtexture.wrap(viz.WRAP_S,viz.REPEAT) 
	newtexture.wrap(viz.WRAP_T,viz.REPEAT)
	#Save the texture in the emotion map
	self.emotionMap[emotion] = newtexture

#Now your changehead method should look like this
def changehead(self, emotion): 
	self.head.texture(self.emotionMap[emotion], 'geom_0')
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 02:46 AM.


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