Jump to content
  • Advertisement
Sign in to follow this  
Muzzy A

Sprites are scaled and not full drawn

This topic is 2378 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 dont know why, this is what is going on in my code.

IDirect3D9 *d3dDevice;

class Sprite
Matrix matrix;
IDirect3DTexture 9 *texture;
RECT srcRect;

float scale = 1;

srcRect = { 0,0,148,133 };

Matrix scaling;

// Set the location of the sprite
d3dManager->spriteManager->Draw(texture, &srcRect, &Vector3(0,0,0), &Vector3(0,0,0) ,D3DCOLOR_ARGB(alpha,255,255,255));

The image is 148 x 133. And it shows that it's rendering 148 x 133 like it's supposed to when im drawing it.
but it's scaled and cut off.


I dont really know what's causing it, any help would be appreciated. If you need more code i'll put more up.

Share this post

Link to post
Share on other sites
D3DX rounds the texture dimensions up to 256x256 for you in that case. Powers of two are beneficial in texture dimensions for multiple reasons (performance, mipmap sensibility, tidy physical memory allocation...). Some older hardware doesn't support non-power-of-two texture sizes at all.

You can force D3DX to load the texture in its original dimensions by using the [color="#000000"]D3DXCreateTextureFromFileEX function and supplying an appropriate flag to it.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!