Hej!
Uden at ane noget om C programmering og DirectX, vil jeg forsøge at give dig dette, som jeg fandt ved en søgning på google:
Fra
http://www.mvps.org/directx/faq/dx8gr_faq.htmQ. When I draw an image using ID3DXSprite::Draw() with 1:1 scaling, the sprite is different than the original image size. Why?
Since the image file is loaded into a texture, the bitmap is scaled to match the capabilities of the hardware. In general, this means that images that have dimensions that are not powers of 2 will be scaled up to the nearest power of 2.
When loading an image with D3DXCreateTextureFromFileEx(), you can pass a pointer to a D3DXIMAGE_INFO structure, which will be filled with information about the source image. You can then get the size of the texture using IDirect3DTexture::GetLevelDesc() and calculate the required scaling factor for 1:1 rendering:
LPDIRECT3DTEXTURE8 pText;
D3DXIMAGE_INFO info;
D3DXCreateTextureFromFileEx(....,&info,....,&pText);
D3DSURFACE_DESC desc;
pText->GetLevelDesc(0,&desc);
D3DXVECTOR2 vScaling;
vScaling.x=info.Width/desc.Width;
vScaling.y=info.Height/desc.Height;