[vtkusers] Re: Texture Mapping in OpenGL

Randall Hopper aa8vb at yahoo.com
Fri Aug 4 12:22:34 EDT 2000


     Sorry, my fault.  Due to RPATH precidence, I wasn't linking in all the
VTK 3.1.2 libraries I thought I was (some were and some weren't 3.1.2).
I'll get my admin to remove those old VTK libs from the system lib dir.

     With that problem fixed, TIF texture-mapped OBJ files with stored
texture coords seems to work fine, and with odd-sized textures.  

     FWIW, I was putting together a quick viewer for the texture-mapped
head scans many of us brought back from SIGGRAPH this year.

     There was one other problem I hit with VTK 3.1.2 in writing the script:

   > show-face randalh1.obj randalh1.tif
   Loading randalh1.obj with texture randalh1.tif

   Warning: In vtkTIFFReader.cxx, line 259
   vtkTIFFReader (0x1016eec8):  vtkTIFFReader only supports one strip!

Despite the error, the texture map loads and displays coregistered with the
mesh, but it is about half intensity (versus a PPM created from the TIF
using 'xv').  No idea why.

Randall

-- 
Randall Hopper
aa8vb at yahoo.com

Bill Lorensen:
 |
 |Randall,
 |
 |You should not have to pad. The OpenGLTexture class does that (at least
 |since May, 1999). Hoever, looking at the coverage of vtkOBJReader, I see
 |that we do not have any tests that exercise the texture coordinate
 |reading of obj files. I suspect that the code is wrong, especially since
 |it's not tested.
 |
 |If you can provide an obj model with a texture, I 'll correct the problem
 |and add a test for this condition.
 |
 |Also, the tcl script graphics/examplesTcl/clipArt.tcl does padding to
 |power of 2 with adjusted tcoords.
 |
 |Bill
 |
 |At 08:21 AM 8/2/00 -0400, Randall Hopper wrote:
 |>      I have a texture map (.TIF) and an object file (.OBJ) with texture
 |>coordinates.  If I bring up the OBJ with the texture map in Maya it
 |>displays fine, but in VTK the texture doesn't display correctly.
 |>
 |>      In the file, the 450x512 texture is correct.  In VTK, half of the
 |>texture is missing (black), and the other half is shifted on the dataset.
 |>I'm using vtkImageConstantPad to pad up to 512x512, and using
 |>vtkTransformTextureCoords to scale the texture coordinates for this pad.
 |>
 |>      Any other VTKer's padding textures for OpenGL and gotten their
 |>textures to sync-up correctly?  If you have a code snippet for the pad and
 |>tcoords transform you could post I'd appreciate it.
 |>
 |>Thanks,
 |>
 |>Randall




More information about the vtkusers mailing list