Sign in to follow this  

[D3D] My sprite is stretched, help!!

This topic is 3675 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

I'm using directX9 and C++. This is a d3dxsprite interface practice program I just wrote. Everything works fine, but the image is weirdly stretched as it is stored as a texture format (does it have to do with mipmap? ex) 256x256 128x128 64x64 512x512) I want my thingies to be printed exactly as shown in pixel size. What can I do to achieve the desired result, except going to mspaint and edit every single images into those mipmap chain sized format? Thanks!

Share this post


Link to post
Share on other sites
Look into D3DXCreateTextureFromFileEx and specify D3DX_DEFAULT_NONPOW2 in the width and height. If the device supports non power of 2 textures it will not be scaled[wink]

Share this post


Link to post
Share on other sites
Quote:
Original post by thallish
Look into D3DXCreateTextureFromFileEx and specify D3DX_DEFAULT_NONPOW2 in the width and height. If the device supports non power of 2 textures it will not be scaled[wink]


Thanks a lot! I found a paragraph about this problem in Frank D. Luna's book, but I did not know where to put D3DX_DEFAULT_NONPOW2. It's working great. :D

D3DXCreateTextureFromFileEx( g_pd3dDevice, TEXT("keen.bmp"), D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2 , D3DX_FROM_FILE,
D3DUSAGE_RENDERTARGET, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, NULL, NULL, NULL, &pKeen);

That's my new function call. =] Thanks again!

Share this post


Link to post
Share on other sites

This topic is 3675 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this