PDA

View Full Version : Texture mapping...help !



Tresher
08-10-2002, 10:16 AM
Hi,
my problem: after having occupied myself to texture mapping for some minutes the first questions occured to me.
I was surprised that the width and height of a texture image must be a power of 2. Why ? Because the first thing i need texture mapping for will be the background. Therefore i need a ratio of 1.33/1.
Of course i could make a image with the right size and put my image data into this new image and fill the rest with the ClearColor,isn`t it ? And now there is another problem: the size will be let`s say 1024 * 1024. Since that might be to big i would have to divide it into smaller parts (e.g. 64 * (128 * 128)).You see the effort is growing bigger and bigger. Is there a better solution ????

Sincerely,
Martin.

P.S. i know that the width and height dont have to be the same -> just an example

d_a_heitbrink
08-10-2002, 10:46 AM
You realy don't have much choice in the matter, usualy you want to keep the background abit on the small side, you only have so much texture memory on the video card, and when you exceed that things realy slow down alot. A 1024*1024*32 texture would take about 4 megs of text memory. But you can add white space to one edge of the texture, and simple set you texture coords when you bind it so that only the part you want is shown.

You can get away with a pretty small texture for a background, and not have it look real grainy. I would just use a smaller texture and stretch it.

One realy convienant thing to use is the devIL API, it will take an odd shapped format and convert it to something you can use for textures. It will also import .jpg,.bmp, .gif and about any other format you can think of.