[D3D] My sprite is stretched, help!!
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!
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]
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!
You are welcome. For further understanding of the method check the DirectX SDK. It is worth the read[wink]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement