PDA

View Full Version : Bitmap Scaling for texture mapping



tsk
04-03-2003, 10:10 AM
I have a bitmap of 352*288, and I want to make use of it for texture mapping. Since I know how to Scale it to 2^n square size, but I want to texure it with its original ratio. I want to ask can I make use of any method to copy those pixels in my bmp and paste them in a blank white image under openGL?

roffe
04-03-2003, 10:24 AM
A simple solution if you are on NVIDIA hardware and don't care about mipmapping is
GL_NV_texture_rectangle. Check the registry for more info.

Bob
04-03-2003, 10:37 AM
Or if you can't use the texture rectangle extension, you can use glTexSubImage to upload the data as a part of a texture. This only works if you don't need to repeat the texture.

But you should also ask yourself if you really need to keep the aspect ratio of the original image. Scaling the original image with non-uniform scaling does not change the way it appears once textures on the model. You can try to map it onto a quad and see for yourself. Scale it to a power of two in both dimesions (say 512x256) and map it onto the quad. Then scale the image even more, but now only in one direction (say to 512x512), and compare the result.

The image appears the same. You only get different resolution along different axes, but the image appears the same.