Xandev

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

119 Neutral

About Xandev

  • Rank
    Newbie
  1. [quote name='turch' timestamp='1347976440' post='4981251'] Disable depth writing before drawing the sprites and reenable afterwards. The sprites will be drawn as normal, but their depth position won't be written to the z-buffer so everything else will draw over them. [code]d3ddevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);[/code] [/quote] [CODE]void XRendererDX9::DrawTexture(XTexture* Texture, float X, float Y, XRect<int> Rect) { if(!Texture || Texture->Color.Alpha <= 0) return; static RECT rect; static D3DXVECTOR3 Position; Position.x = X; Position.y = Y; Position.z = 0.0f; rect.left = Rect.X; rect.top = Rect.Y; rect.right = Rect.X + Rect.Width; rect.bottom = Rect.Y + Rect.Height; Direct3D9Device->SetRenderState(D3DRS_ZWRITEENABLE, 0); Direct3D9Sprite->Draw(static_cast<IDirect3DTexture9*>(Texture->Get()), &rect, 0, &Position, D3DCOLOR_ARGB(Texture->Color.Alpha, Texture->Color.Red, Texture->Color.Green, Texture->Color.Blue)); Direct3D9Device->SetRenderState(D3DRS_ZWRITEENABLE, 1); }[/CODE] Still not working.
  2. Hi, i need to draw primitive between 2 sprites, but sprites rendered with ID3DXSprite are always on top. I tried to flush sprite interface before drawing primitive and after, but it doesn't work. I don't care if I have to use a vertex buffer or DrawPrimitiveUp function. Important for me is that it need to work. Thanks in advance for your help.