• Advertisement
Sign in to follow this  

Sprite aspect ratio??

This topic is 4561 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 loaded the sprite in photoshop and took the exact pixel pos and width of the sprite I wanted to load. I used the same pixel point in Directx. It gives all weird result. It does not match. Although the sprite is square I have to read more pixel in width than height to get complete sprite. I thought aspect ratio might fix it so, I did this. height = 32; width = 32 * (SCREEN_WIDTH/SCREEN_HEIGHT); Isn't this correct or am I doing something wrong?? This does not work either. Somebody HELP

Share this post


Link to post
Share on other sites
Advertisement
If the sprite is square then it's width and height should be the same.
Maybe the bottleneck lies in your projection matrix?
Be sure to make the projection matrix's aspect ratio match backbuffer_width/backbuffer_height, unless you're using an orthogonal matrix [smile]
Also, make sure it's not your backbuffer that's being streched or something.

Share this post


Link to post
Share on other sites
D3DXMatrixPerspectiveFovLH(
&proj, // result
D3DX_PI * 0.25f, // 45 - degrees
(float)Width / (float)Height, // aspect ratio
1.0f, // near plane
1000.0f);

This is how I set my projection matrix. Is this wrong?

Share this post


Link to post
Share on other sites
It isn't as long as Width and Height correspond to the size of the backbuffer, and to the destination rect of your window.

Share this post


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

  • Advertisement