View Single Post
  #1  
Old 01-18-2012, 12:48 PM
EnvisMJ EnvisMJ is offline
Member
 
Join Date: May 2009
Location: Purdue University, West Lafayette, Indiana
Posts: 44
Texturing a quad from within a class

So I'm trying to texture a quad bound to the screen from within a class.

Can anyone explain why this sample code works :

Code:
image = viz.add('Textures/VialLabels/Inventory Image - WHITE.png')
quad = viz.addTexQuad(viz.SCREEN,align=viz.TEXT_LEFT_BOTTOM,pos=(0,0,0))
quad.texture(image)
quad.setScale(6,3,1)
AND this doesn't?

Code:
import viz

class inventory(object):
	global bulkInventoryBins,medicationVials
	def __init__(self,contentsImage=""):
		self.obj = viz.add('box.wrl')
		self.obj.infoImage = contentsImage
	def showInfoImage(self):
		self.infoQuad = viz.addTexQuad(viz.SCREEN,align=viz.TEXT_LEFT_BOTTOM,pos=(0,0,0))
		self.infoQuad.texture(self.obj.infoImage)
		self.infoQuad.setScale(6,3,1)
	def removeInfoImage(self):
		self.infoQuad.remove()

A = inventory("Textures/VialLabels/Inventory Image - WHITE.png")
A.showInfoImage()
viz.go()
Reply With Quote