Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


ID3DXSprite and DrawPrimitive


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Xandev   Members   -  Reputation: 119

Like
0Likes
Like

Posted 17 September 2012 - 11:30 AM

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.

Sponsor:

#2 turch   Members   -  Reputation: 590

Like
0Likes
Like

Posted 18 September 2012 - 07:54 AM

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.

d3ddevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);


#3 Xandev   Members   -  Reputation: 119

Like
0Likes
Like

Posted 18 September 2012 - 08:12 AM

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.

d3ddevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);


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);
}

Still not working.

Edited by Xandev, 18 September 2012 - 10:37 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS