PDA

View Full Version : texture mappng....



sudhanshu
03-03-2009, 10:43 PM
i making a square using QUAD_STRIP...by closely drawing multiple quads...(1200X1200 small quads to make one big square)

n i need to map one texture file on which only have 337X277 pixels information into it(4 bytes for each pixel)

pls help me wid this...taxture mappin really gettin into me :(

scratt
03-03-2009, 11:04 PM
Your texture coords go from 0.0 to 1.0 in x and y.

(You might find it easier to do this to start with with normal QUADs and then cut out the extra data in sets to make the QUAD_STRIP setup.)

So divide 1.0 by 1200 and then give your quads vertices texture coordinates in that increment, starting at 0 and ending at 1.0 in both x and y. Do remember that each vertex requires a texture coord which corresponds to it's position on the QUAD, so texture coords in each QUAD will be bordering with almost identical texture coords in the next QUAD and so on..

Do also be aware that depending on your GPU you may have to use different ways to load your non-Power-Of-Two texture.

What might be better is to modify that texture so that it is properly square and has POT dimensions.