PDA

View Full Version : how to texture mapping by an image of 450*500



yqs2002
11-13-2002, 03:33 AM
I have to texure mapping by an image of 450*500 , and the size is not standard and
I mustn't zoom it,how can I do ?thank you!

Gavin
11-13-2002, 03:54 AM
You have to load the image then pad it with saay zero's to make it 2^n dimensions and then when you texture map it you just alter your texture coords appropriately so that your image fits nicely on your quad without showing your padding.

vladk
11-13-2002, 11:04 PM
I will take the liberty and supplement what Gavin said.

For 450*500 your nearest ^2 dimension is 512x512. So, pad the rest with zeroes.

Then, draw a quad with SAME proportions
(0,9 : 1), and use scaled texture coordinates:

0.0, 0.0 for upper left corner
0.88, 0.0. for upper right corner
0.0, 0.976 for lower left corner
0.88, 0.976 for lower right corner

If this precision is not enough, just divide
450 by 512 for X scale and 500 by 512 for Y scale.

Gavin
11-14-2002, 02:09 AM
Ooops forgot, look at mipmaps as well, you may find it easier.