Sign in to follow this  

Downscaling sprite -> black screen

This topic is 1974 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

Hello,

I've tested out a scale thats smaller than 1.0f for the first time, and when I do so things won't get rendered. I'm using the lpd3dxsprite-interface. Well, according to the output of Nvidia PerfHUD (see attached screen). When applying a scale like 0.5f, the rendered geometry is reduced to a line oO. So obivously its no mipmapping-issue or anything like that.

Thats how I apply the scale:


[code]
void D3DSprite::DrawEx(LPDIRECT3DTEXTURE9 lpTexture, D3DXVECTOR3 vPosition, D3DXVECTOR3 vOrigin, RECT rSourceRect, D3DXVECTOR2 vScale, float fAngle)
{
//dummy variables to spare constructor calls
m_vDummyCenter.x = vOrigin.x;
m_vDummyCenter.y = vOrigin.y;
m_vDummyScaleCenter.x = vPosition.x;
m_vDummyScaleCenter.y = vPosition.y;
//apply transform
D3DXMatrixTransformation2D(&m_mxTransform,&m_vDummyScaleCenter,0.0f,&vScale,&m_vDummyCenter,fAngle,NULL);
m_lpD3DSprite->SetTransform(&m_mxTransform);
//draw the sprite
m_lpD3DSprite->Draw(lpTexture,&rSourceRect,&vOrigin,&vPosition,D3DCOLOR_ARGB(255, 255, 255, 255));
}
[/code]

Is there anything obviously wrong with this? Upscaling works fine so I don't see why downscaling shouldn't.. Edited by The King2

Share this post


Link to post
Share on other sites
Try taking this into PIX and see what exactly is happening to the geometry. I see you have a scissor rect enabled, that could be clipping it, or your scale may end up evaluating to 0, or any of those matrices created by the transform could be evaluating to 0.0f. Good luck!

Share this post


Link to post
Share on other sites
Thanks for the hint,

the scaling indeed was 0, I noticed when playing around in PIX and setting both the X and Y scale to 0.5, now there wasn't even a line anymore. I defined the SetScale-method to accept an integer, so no wonder scale was 0.. problem solved :)

Share this post


Link to post
Share on other sites

This topic is 1974 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.

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