Sprite Draw order

Started by
15 comments, last by BloodLust666 18 years, 7 months ago
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...
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Advertisement
Are you sure the depth buffer is enabled?
depth buffer? in the IDirect3D9 object?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
// 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
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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?
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"
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
know what i mean?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

This topic is closed to new replies.

Advertisement