[vtk-developers] Texture handling: display subtexture vs. resample to power of two

David Gobbi dgobbi at imaging.robarts.ca
Mon Sep 8 10:02:10 EDT 2003


Hi All,

I'm looking for an efficient way to deal with textures that aren't
a power of two for use in image visualization software.

Over the weekend I patched vtkOpenGLImageActor to use glTexSubImage2D,
so that the second time around only the image-size region of the texture
is loading, eliminating the need to pad to a power of two.  This improves
the performance enormously for non-power-of-two images.

I'd like to do the same with vtkOpenGLTexture.  The semantics would be
as follows:
- if Repeat=1, then follow the current behaviour, i.e. resample to a power
  of two
- if Repeat=0, then if the image size is not a power of two,
  1) load just the sub-region of the texture corresponding to the image size
  2) scale texture coordinates in order to stretch the texture so the
     sub-region covers the same geometry that full texture did previously

The other option would be to make the change more explicit, for example
by adding a new method  SetLoadRegion()  to allow the user to specifically
set the sub-region of the texture to be reloaded each time rather than
automatically adjusting the texture coords.

What do people think?

 - David

--
  David Gobbi, PhD                dgobbi at imaging.robarts.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario





More information about the vtk-developers mailing list