Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nPawn

D3DXSprite acting strange, stretching in windowed mode

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

Whenever I Reset my screen size in windowed mode my positions seem to get skewed to be bigger or stretched for some reason when I draw a D3DXSprite. Say I start out at windowed 800x600, then switch to 1024x768, if i start drawing my sprites then, they get stretched badly. If i start in 1024x768 and stay in 1024x768 they draw just fine. I load my sprite *after* the screen size adjustment so I shouldn''t need to call OnResetDevice(); for the sprite. If however I am full screen, the sprites draw exactly where they''re supposed to, no matter how often i change screen sizes. Here''s some pics: My line sprites here draw just fine in fullscreen mode But for some reason they get stretched out or something in windowed mode, using the exact same x,y and scaling values as fullscreen mode. My sprite drawing function is pretty straight forward: void CSprite::Draw(float x, float y, float fScaleX, float fScaleY, DWORD dwColor) { D3DXVECTOR2 vector_position(x,y) ; D3DXVECTOR2 vector_scale(fScaleX,fScaleY); HRESULT hr; if (!m_pSprite || !m_pTexture) { DXUtil_Trace("%s CSprite is trying to Draw but it''s NULL", m_szName); return; } hr = m_pSprite->Draw(m_pTexture, NULL, &vector_scale, NULL, 0.0f, &vector_position, dwColor); } Any ideas why this is just occuring if i change windowed mode screensize and not in fullscreen?

Share this post


Link to post
Share on other sites
Advertisement
I had this happen once. When you set your Direct3D video mode, it needs to be same dimensions as the ones you passed to CreateWindow, otherwise everthing will be scaled, stretched, whatever. Double check that.

-----------------------------
kevin@mayday-anime.com
http://games.mayday-anime.com

Share this post


Link to post
Share on other sites
Ahh, that seemed to work. On my Reset call I was using 0's for my backbuffer width and height, which I assumed I needed to do like the DX documentation says - If Windowed is TRUE and these values are zero, then the corresponding dimension of the client area of the hDeviceWindow is taken. Changing the backbuffer width and height in the Reset call to the same values as SetWindowPos seemed to work. Thanks for the help.

[edited by - nPawn on June 1, 2002 11:06:19 AM]

Share this post


Link to post
Share on other sites

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