[vtkusers] Cube with textures

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Mon Mar 18 07:04:11 EST 2002


> I would like to make a cube, with on each side a different texture, like a
dice.
>
> If I use the the vtkCubeSource to generate the cube, I can attach only 1
texture.

true.

> Do I have to make 6 planes and put them in an vtkAssembly or is there a
better/smarter
> way to do this?

Method 1 is as above. 6 actors, each a different texture.


> Is it possible to make a single texture and use some kind of texture
coordinates to tell
> which piece of the image goes where?


Method 2 is to make a big texture containing all 6 images in one larger
image.(as above)

Then generate texture coordinates which are like
0-1/6, 1/6-2/6, 2/6-3/6 etc etc. But vtkTextureMapToCube won't generate the
texture coords for you. You'll have to create your own
vtkCubeFacesTextureMapper or similar. Probably easier to just stuff the
coords into a TextureCoords Dataarray. (Unless you're going to need lots of
them).

JB






More information about the vtkusers mailing list