How can I use an 100*100 bitmap for mapping?

I think OpenGL can use 128128 bitmap for mapping, but now I must use the 100100 picture for my goal, and I don’t want to use gluScaleImage() to shrink the picture.
Please tell me the method,thanks!

You can expand the texture to 128x128 or you place the 100x100 image in a 128x128 texture and adjust the texture coordinates accordingly.

use mipmaping - then you can use textures of any width and height

Originally posted by Vlasko:
use mipmaping - then you can use textures of any width and height

Only partly true. If you use gluBuild2DMipMaps, it will resize the images to be dimensions with a power of 2. So you can pass in any size image, but the end result will still be textures with dimensions that are a power of 2.

Thanks for your help!
But my friends tell me that the D3D can map any size of picture easily! So why OpenGL need to shrink the picture to fit??

[This message has been edited by lglabc (edited 04-21-2003).]

If you have an nVidia card you could use the GL_NV_texture_rectangle extension. I think I remember reading about similar ATI extnsion(??)

I think d3dx:s imageloader does he same trick as gluBuildMipMap, that is, it resizes the texture to the nearest higher ^2 factor on load… so if you send in a 100100, the gfxcard will recieve a 128128 filtered image.

You can do it another way if you want to keep your texture exactly 100x100.
Allocate a texture 128x128 in size passing NULL for the pixel data.
Now do a glTexSubImage2D(0,0,100,100,…,data); to put your data into this larger texture.
Finally use texture coordinates such as
{0,0 100/128,0 100/128,100/128 0,100/128} to correctly index to your larger texture.
This should give you your required 100x100 texture data exactly.

ok, I’ll try these methods!