View Single Post
  #1  
Old 01-24-2013, 06:38 PM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
Question Loading a 3D Texture

I couldn't find a ton of documentation in the help files on loading 3D textures.

I am interested in loading a series of 2D images into a 3D texture.
From what I read, the <multimedia:image>.load method should allow me to build a 3d texture.

I am trying to use a series of 2d pngs and turn them into a 3d texture for my shader to access. I have everything setup, the problem is when I try and use 'load' I get the following error:

** ERROR: 'BodyScans\FullBodyThresholded\002.png' cannot be loaded into depth 1 of 3D texture. Valid range is 0-0

I get this error for every image I load.

How do I setup the valid range for a texture? I tried making a 'blanktexture' and manually state I wanted a set number of depth images, but I still got the same error.

Here is my load method:

Code:
	def loadImages(self, dir):
		files = os.listdir(dir)
		for num, f in enumerate(files):
			if f[-3:] == 'png':
				print f
				if self.texture3D == None:
					self.texture3D = viz.addTexture(dir + f, type = viz.TEX_3D)
				self.texture3D.load(dir + f, face = num)
		self.texture3D.compression(viz.COMPRESSION_ARB)
		self.texture3D.hint(viz.PRELOAD_HINT)
Thanks,
George
Reply With Quote