Jump to content
  • Advertisement
Sign in to follow this  
Juliean

Downscaling sprite -> black screen

This topic is 2226 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:



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));
}


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