Jump to content
  • Advertisement


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


ID3DXSprite and DirectX 8

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

I am using D3DXSprite''s to draw textures to the screen. I am also using D3DXMESH to draw mesh''s to the screen. The problem is I can not get the Sprites to be drawn as a background for the mesh. If I do this sprite.render(); mesh.render(); The entire 50 pixel by 50 pixel sprite is drawn to the screen, even over the mesh. if I do this mesh.render(); sprite.render(); The 50 pixel by 50 pixel sprite is correctly drawn (but with alpha blending enabled) to the screen over the mesh. How can I draw the sprites behind the 3D Objects? Thanks... //Code sample for sprite render D3DXCreateSprite(m_pd3dDevice, &testSprite); testSprite->Begin(); for (int i=128; i<300; i+=5){ testSprite->Draw( m_pTexture, &rectangle, &m_Scaling, &m_RotCenter, m_Rotation, &trans, m_ModulateColor ); testSprite->End(); //Code sample for mesh render for( int i = 0 ; i < m_NumMats ; i++ ) { // Set this material as active pMaterials.Update(); // Set this texture as active Direct3dDevice->SetTexture( 0, pTextures[i] ); // Render this subset of the mesh testMesh->DrawSubset(i); // Reset the vertex shader Direct3dDevice->SetVertexShader( VERTEX_TYPE ); }

Share this post

Link to post
Share on other sites

There is a draw method for ID3DXSprite that takes a matrix as a parameter - I am still not sure if you''ll be able to use this to draw it behind..(when I used it it was for a 2d demo)

HRESULT DrawTransform(

Share this post

Link to post
Share on other sites
I was drawing the sprite before the mesh. The problem was that the Z translation of a id3dxsprite defaults to 0.
I fixed the problem though, you need to use the drawtransform method and set a matrix so that it''s z translation value = 1.


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!