hi , i am using this to draw triangles in my project :
LPDIRECT3DDEVICE9 pd3dDev;
pd3dDev = (LPDIRECT3DDEVICE9)draw_begin();
if (!pd3dDev) return;
// set some render and stage states
pd3dDev->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE);
pd3dDev->SetRenderState(D3DRS_ZENABLE,TRUE);
pd3dDev->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE);
pd3dDev->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG2);
//..
for(i=0;i<tcount;i++)
{
MD3DVERTEX v[3];
v[0].x=vbuf[tbuf[i*3]*3];
v[0].z=vbuf[tbuf[i*3]*3+1];
v[0].y=vbuf[tbuf[i*3]*3+2];
v[1].x=vbuf[tbuf[i*3+1]*3];
v[1].z=vbuf[tbuf[i*3+1]*3+1];
v[1].y=vbuf[tbuf[i*3+1]*3+2];
v[2].x=vbuf[tbuf[i*3+2]*3];
v[2].z=vbuf[tbuf[i*3+2]*3+1];
v[2].y=vbuf[tbuf[i*3+2]*3+2];
pd3dDev->SetFVF(MD3DFVF_D3DVERTEX);
pd3dDev->DrawPrimitiveUP(D3DPT_TRIANGLELIST,1,(LPVOID)v,sizeof(MD3DVERTEX));
}
it draws fine ,except for somethings i have difficilty with:
the triangles are drawn over other draw_box3d and draw_line3d calls , this is the thing that bothers me the most ,why would this happen , i tried enabling z buffer,it happens with line drawing still.
i don't know if its me or a bug?