View Full Version : Rectangular textures

09-06-2004, 06:34 AM

I want to user rectangular textures and managed that
using gluBuildMipmaps2d. But their quality is very
bad, even when I use bilinear or trilinear filtering. Can somebody please help me.


PS: Please excuse me for my bad English, I am from Austria.

09-07-2004, 08:29 AM
gluBuild2DMipMaps will support rectangular textures however it will resize textures to be 2^n dimensions on each side, i.e. 1,2,4,8,16,32,64,128,256, etc. So if you feed in an image of arbitrary size to the MIP map builder before it does anything it will resize the texture to the nearest 2^n (probably truncating down). So for example if you have a 500x200 texture into gluBuild2DMipMaps you'll end up with a 256x128 texture + MIP maps in texture memory.

The correct way to use this function without resizing is to feed it texture images that are 2^n on a side to start with and only the MIP map levels will have lower resolution than the original image data you feed in.

09-07-2004, 11:36 PM
I have support for rect textures in my app because most of our users came from CPU-driven world and they were used to use 155x227 textures.

My first suggestion is to carefully evaluate this problem. It really takes some time to make this work.

Second suggestion is to write your own resize func. While most people is happy with glu, I also read it's pretty slow.

Third and last, check out:
NV_texture_rectangle aka EXT_texture_rectangle: very basic, often not good enough support, widely supported.
"ARB_npot": very beautiful. I don't think there's a widespread support for it.