Jump to content
  • Advertisement

Archived

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

gugu

3d objects in front of sprites

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

Hi everybody. it''s my first post... I use dx9, and I want to draw 3d objects in front of sprites. But the sprites are always in front of the meshes (I use ID3DXSPRITE). there''s my render loop (it''s not c or c++, but easy to understand): g_pd3dDevice\Clear( 0, #NULL, #D3DCLEAR_TARGET | #D3DCLEAR_ZBUFFER, RGB(0,100,0), 1.0, 0 ) g_pd3dDevice\BeginScene() lpSprite\begin(0) lpSprite\Draw(D3DTexture2, 0, 0, 0, $FFFFFFFF ) lpSprite\End() SetupMatrices() g_pMesh\DrawSubset(0) g_pd3dDevice\EndScene() g_pd3dDevice\Present(#NULL, #NULL, #NULL, #NULL) I draw the sprite before the mesh, but sprite are alway in front, on screen. anyone can help me ? thanks.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Have you set a Z-depth for the sprite? Otherwise you might be rendering it in your face?

Share this post


Link to post
Share on other sites
thank you for the reply.

I thought that z coordinate have no importance for sprites (i''m a beginner in dx programming).
But if I do :

lpSprite\Draw(D3DTexture2, 0, 0,@vector, $FFFFFFFF )

with a vector.z=1, the sprite is in back.
thanks

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think the guy above might have been refering to something like point sprites. I am no expert on the 2D uses on sprites, but have you thought of billboarding a textured quad towards the camera?

Share this post


Link to post
Share on other sites
Well, I have found another solution : to clear the ZBUFFER between pSprite->Draw and DrawSubset.

Is it the "correct/best/official" method ?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!