[vtkusers] texture map to cube
Dean Inglis
dean.inglis at camris.ca
Thu May 6 14:25:01 EDT 2004
I am trying to texture map a set of 6 face labels
to a cube. So far I am just trying to map 4 of
the faces with +/- coordinate face labels. The input
image looks like this:
---------------------
| -X | -Y | +X | +Y |
---------------------
The unsuccessful pipeline is:
package require vtk
package require vtkinteraction
vtkCubeSource cube
cube SetBounds -1 1 -1 1 -1 1
vtkTextureMapToPlane tmap
#vtkTextureMapToCylinder tmap
tmap SetInput [cube GetOutput]
#tmap AutomaticPlaneGenerationOn
vtkPolyDataMapper pmap
pmap SetInput [tmap GetOutput]
vtkPNGReader reader
reader SetFileName "testwrap.png"
vtkTexture texture
texture SetQualityTo32Bit
texture InterpolateOn
#texture RepeatOn
texture RepeatOff
texture SetInput [reader GetOutput]
vtkActor tact
tact SetMapper pmap
tact SetTexture texture
# Create graphics stuff
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background and size
ren1 AddActor tact
ren1 ResetCameraClippingRange
ren1 SetBackground 0 .5 .4
renWin SetSize 800 800
iren Initialize
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
# prevent the tk window from showing up then start the event loop
wm withdraw .
any hints? thanks,
Dean
More information about the vtkusers
mailing list