Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Sprite Draw order

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

Ok, i have 2 sprites, one covers the entire screen and one is small. When i call draw, i'm calling "order_fronttoback" the sprite that covers the screen is at 1.0f and the other is at 0.0f, but i only see the bigger one... when i don't draw it, then i see the smaller one, so i know both are being drawn but for some reason the bigger one is one TOP of the smaller one... even though i have the "order_fronttoback" flag triggered...

Share this post


Link to post
Share on other sites
Advertisement
// init code
m_pD3dDeviceCOM->SetRenderState( D3DRS_ZENABLE, m_bZBuffer);

// frame code
m_pD3dDeviceCOM->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0f, 0)

the Clear function is what breaks the program

Share this post


Link to post
Share on other sites
Quote:
Original post by EvilKnuckles666
ok, i just enabled depth buffer... wasn't there b4 (ha..) but now whenever i try to clear the screen with "targetzbuffer" it fails.. y's this?
If you have the debug runtime installed, with the debug output level pumped up enough, it'll say why it fails.
Are you setting the EnableAutoDepthStencil member of your presentation parameters to true and chosing a depth format?

Share this post


Link to post
Share on other sites
ohhhh, i thought the depth stencil was for stencilling not the Zbuffer.. and what's the format for? like A8R8G8B8?

Edit: nv/md, i found the right format: "D3DFMT_D16"

Share this post


Link to post
Share on other sites
wow... ok, it works know, BUT the bigger texture isn't drawing... what should i clear the screen with?

Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 0.0f, 0)
or
Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0f, 0)
or what?

i'm using all sprites (it's a 2D game) so all my Z's are between 0.0f and 1.0f

Share this post


Link to post
Share on other sites
also, does this matter? instead of doing Draw(pTex, pRect, pCenter, pPos, Color)
pPos is NULL. the way i'm moving the sprites is by storing the XYZ coordinates in floats, then having a transform matrix and SetTransform()'ing the sprite, then drawing it with a NULL pointer to the position.. does that matter?

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!