Skip to main content
GameDev.net gamedev.net
🔒 Locked

LPD3DXSPRITE scaling problem =(

Started by neurokaotix Jul 31, 2002 at 8:31 PM 8 replies 400+ views
neurokaotix
neurokaotix
Nope, the image sizes range between 640x480, 640x100, 420x80, etc... Are you suggesting that perhaps if the image dimensions are in powers of two (e.g. 256x256, 512x256, etc...) that the scaling would work properly? At the moment I can get them all to scale into their proper proportions if I multiply the width by 0.625 (this number is consistant with all the images, regardless of width) and then another number representing the Y or height (this number is never consistant)
grasshopa55
grasshopa55
I''ve seen this problem discussed before, but the answer escapes me at the moment. Try a quick search here in the DirectX Forum. I know the answer is in there, I just can''t remember it.

-----------------------------
kevin@mayday-anime.com
http://games.mayday-anime.com
-----------------------------kevin@mayday-anime.comhttp://www.mayday-anime.com
DrunkenHyena
DrunkenHyena
If you use D3DX to load your textures it will resize them to a power of 2, that''s why your textures are getting munged.

The hardware needs them in powers of 2. There are a lot of ways to work around it though. One is to load them the way you are, and adjust the scaling factors when you draw.

Or you can resize your base image so the extra bits aren''t used and use the Source Rect in D3DXSprite to draw just what you want.

You can combine multiple sprites onto a larger (power of 2) texture page, so there''s no loss of space.

Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.