Jump to content
  • Advertisement

Archived

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

johan_swe

ID3DXSprite problem

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

m_pD3DXSprite->Begin(D3DXSPRITE_ALPHABLEND); D3DXMATRIX matScaling; D3DXMatrixScaling(&matScaling, m_Scaling.x, m_Scaling.y, 1.0f); m_pD3DXSprite->SetTransform(&matScaling); m_pD3DXSprite->Draw(m_pTexture, NULL, NULL, D3DXVECTOR3(m_Pos.x, m_Pos.y, 0.0f), 0xFFFFFFFF); m_pD3DXSprite->End(); The problem is that the sprite is not being drawn on position (m_Pos.x, m_Pos.y). What is wrong? (poor use of english language, sorry)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
It did not work for me either. Since you are using a transform just put your position information in the matrix along with the scaling.

D3DXMATRIX matScaling, matTransform;
D3DXMatrixScaling( &matScaling, m_Scaling.x, m_scaling.y,1.0f);
D3DXMatrixTranslation( &matTransform, m_Pos.x, m_Pos.y, 0.0f );

D3DXMatrixMultiply( &transform, &transform, &matScaling );
m_pD3DXSprite->SetTransform( &transform );

m_pD3DXSprite->Draw(m_pTexture, NULL, NULL, NULL, 0xFFFFFFFF);

I''d like to know what others are doing?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Try changing your Z value to soemthinmg greater than 0;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Is it because the values are in the range 0 to 1?

Share this post


Link to post
Share on other sites
I changed D3DXMatrixMultiply(&matTrans, &matTrans, &matScale) to D3DXMatrixMultiply(&matTrans, &matScale, &matTrans). It works =)

[edited by - johan_swe on October 11, 2003 7:18:33 AM]

Share this post


Link to post
Share on other sites
Generally, the order of combinations for the world and view matricies, as defined in first Jims Book (book plug) on page 183, is as follows:

World Matrix
quote:

matWorld = matScale * matRotateX * matRotateY * matRotateZ * matTranslate



view Matrix
quote:

matView = matTranslate * matRotateX * matRotateY * matRotateZ




Please note that you don''t need all these matrices and the order to the rotation matrices can be changed to eliminate Gimbal lock depending on you situation.

Understanding is a three edged sword...

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!