Index: vtkOpenGLTexture.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkOpenGLTexture.cxx,v
retrieving revision 1.66
diff -r1.66 vtkOpenGLTexture.cxx
24c24
< 
---
> #include "vtkOpenGLExtensionManager.h"
39a40
>   this->AllowsNonPowerOfTwoTextures = -1; // don't know until first render
171,174c172,173
<     // xsize and ysize must be a power of 2 in OpenGL
<     xs = static_cast<unsigned short>(xsize);
<     ys = static_cast<unsigned short>(ysize);
<     while (!(xs & 0x01))
---
>     // free any old display lists (from the old context)
>     if (this->RenderWindow)
176c175
<       xs = xs >> 1;
---
>       this->ReleaseGraphicsResources(this->RenderWindow);
178c177,183
<     while (!(ys & 0x01))
---
>     
>      this->RenderWindow = ren->GetRenderWindow();
>      
>     // make the new context current before we mess with opengl
>     this->RenderWindow->MakeCurrent();
> 
>     if (this->AllowsNonPowerOfTwoTextures == -1)
180c185,191
<       ys = ys >> 1;
---
>       // Check to see if this OpenGL implementation 
>       // allows for non-power of two textures
>       vtkOpenGLExtensionManager *extensions = vtkOpenGLExtensionManager::New();
>       extensions->SetRenderWindow(this->RenderWindow);
>       this->AllowsNonPowerOfTwoTextures = 
>         extensions->ExtensionSupported("GL_ARB_texture_non_power_of_two");
>       extensions->Delete();
183d193
<     // -- decide whether the texture needs to be resampled --
185,186c195
<     // if not a power of two then resampling is required
<     if ((xs > 1)||(ys > 1))
---
>     if (this->AllowsNonPowerOfTwoTextures != 1) 
188c197,214
<       resampleNeeded = 1;
---
>       // xsize and ysize must be a power of 2 in OpenGL without the supported extension
>       xs = (unsigned short)xsize;
>       ys = (unsigned short)ysize;
>       while (!(xs & 0x01))
> 	{
> 	xs = xs >> 1;
> 	}
>       while (!(ys & 0x01))
> 	{
> 	ys = ys >> 1;
> 	}
> 
>       // -- decide whether the texture needs to be resampled --
>       // if not a power of two then resampling is required
>       if ((xs > 1)||(ys > 1))
> 	{
> 	resampleNeeded = 1;
> 	}
192c218
<     // if larger than permitted by the graphics library then must resample
---
>     // if larger than permitted by the graphics library then must resample anyway
238,247d263
<     // free any old display lists (from the old context)
<     if (this->RenderWindow)
<       {
<       this->ReleaseGraphicsResources(this->RenderWindow);
<       }
<     
<      this->RenderWindow = ren->GetRenderWindow();
<      
<     // make the new context current before we mess with opengl
<     this->RenderWindow->MakeCurrent();
468a485
>   os << indent << "AllowsNonPowerOfTwoTexture: " << this->AllowsNonPowerOfTwoTextures;
Index: vtkOpenGLTexture.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkOpenGLTexture.h,v
retrieving revision 1.26
diff -r1.26 vtkOpenGLTexture.h
64a65
>   int           AllowsNonPowerOfTwoTextures; // -1=unknown, 0=no, 1=yes.
