[vtkusers] texture map to cube

anast.jm at pg.com anast.jm at pg.com
Thu May 6 16:57:54 EDT 2004


Dean,

My code is very similar to yours and I couldn't get this to work either. 
Its not very intuitive. If the cube's origin is correct and the extent 1 
in all directions and Repeat is On, I can get an exact copy of my image on 
all cube faces. If repeat is off, then I get two faces filled, and a very 
light smear on two other faces with the top and bottom blank. I've tried 
zillions of extent combos with origin offsets and can make heads or tails 
out of it. I tried maping to sphere too but I couldn't see anything.

What are you seeing....john





"Dean Inglis" <dean.inglis at camris.ca>
Sent by: vtkusers-admin at vtk.org
05/06/2004 02:25 PM

 
        To:     "vtkusers archive" <vtkusers at vtk.org>
        cc:     (bcc: John Anast-JM/PGI)
        Subject:        [vtkusers] texture map to cube


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

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: 
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040506/3a2373ba/attachment.htm>


More information about the vtkusers mailing list