Archived

This topic is now archived and is closed to further replies.

D3DXCreateTextureFromFileEx

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so ive loaded my texture from a file right? well the first thing i noticed was that the aspect seemed off (im rendering useing ID3DXSprite::Draw() with NULL for the source rect) second, the image info for it was wrong, the Height value was wrong, about 2/3 of what it actually was... the only reason for this i can think of is that most of the image is translucent magenta, and im loading it with magenta as the transparent color, but shouldnt it still give me a valid value for my height? ugh... -Dan

Share this post


Link to post
Share on other sites
Most graphics cards can only use textures that have dimensions of a power of 2 (like 2, 4, 8, 16, 32, 64... ect.) so if you''re loading an image using D3DXCreateTextureFromFile that has a width and/or height that is not a power of 2, it will round up the dimensions of the texture to the next power of 2 and stretch the image to fit.

Example: you load an image that is 100 x 40, the texture you create will be stretched to 128 x 64

Some graphics cards also have to restriction that the texture must be a square, so that could cause issues too.

Share this post


Link to post
Share on other sites
quote:
Original post by Subconscious
Most graphics cards can only use textures that have dimensions of a power of 2 (like 2, 4, 8, 16, 32, 64... ect.)
That could definetly be what this is, although most new graphics cards support textures with dimensions that aren''t of a power of 2. You commonly hear about that in the older cards.

Share this post


Link to post
Share on other sites
Ok, sounds valid... but... i mean, 2/3? doesnt seem right...
and it still loads, its just screwed up.... but ill mess with taht idea, thanx
yup that fixed it... i hadta tack on a lot of extra transparent area to do it, but it works now, thanx


[edited by - Ademan555 on February 22, 2004 2:10:49 AM]

Share this post


Link to post
Share on other sites