Original Post
🔒 Locked
Texture Mapping
Advertisement
Which tutorials are you learning from? There are quite a few out there. Lesson 6 isn't enough info.
Anyway, if you're trying to texture something, the image you're using must have dimensions that are powers of 2.
128 * 128 is fine
64 * 64 works too
32 * 512 will work
32 * 31 will not
Anyway, if you're trying to texture something, the image you're using must have dimensions that are powers of 2.
128 * 128 is fine
64 * 64 works too
32 * 512 will work
32 * 31 will not
Do you mean how to tell if the image has a power-of-two size? Then you'd just find log(dimension)/log(2) and then if that's an integer value, it's a power of two. There are likely better ways to do this though.
Do you mean fixing an image if it's not power-of-two? Without a lot of code or an image library, no. It's easier to just open the image in an editor and resize it to a proper size. You can either resize the whole image (which can make it look really ugly depending on the image) or just pad the image with black on one side to be the appropriate width/height. Then you'd just adjust your texture coordinates appropriately. For example, if the image was originally 230 pixels wide and you padded 26 pixels onto the right, you would just change the texture coordinates referring to the right side of the image from 1.0 to (230.0/256.0).
-Auron
Do you mean fixing an image if it's not power-of-two? Without a lot of code or an image library, no. It's easier to just open the image in an editor and resize it to a proper size. You can either resize the whole image (which can make it look really ugly depending on the image) or just pad the image with black on one side to be the appropriate width/height. Then you'd just adjust your texture coordinates appropriately. For example, if the image was originally 230 pixels wide and you padded 26 pixels onto the right, you would just change the texture coordinates referring to the right side of the image from 1.0 to (230.0/256.0).
-Auron
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement