Sign in to follow this  
vprajapa

Sprite aspect ratio??

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
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

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