Sprite Draw order
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...
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?
// 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
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
Quote:Original post by EvilKnuckles666If you have the debug runtime installed, with the debug output level pumped up enough, it'll say why it fails.
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?
Are you setting the EnableAutoDepthStencil member of your presentation parameters to true and chosing a depth format?
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"
Edit: nv/md, i found the right format: "D3DFMT_D16"
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
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
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?
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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement