D3d Draw Triangle
@flamswor10
cool story bro
cool story bro
I could of made this for u... and mine would of been a little less ...... useless code.
I JUST EDITED HIS FUNCTION REMOVED A LOT OF UN-NEEDED CODE WHAT WOULD OF BEEN JUST THERE TO WASTE MEMORY LIKE THE 4th VERTEX, THE TEXTURE FVF FLAG AND ALSO REMOVE A LOT OF THE DEFINE CODE WITH THIS.
[php]void FillARGBTriangle(int x1, int y1, int x2, int y2, int x3, int y3, D3DCOLOR color, IDirect3DDevice9 *pDevice)
{
struct Vertex
{
float x,y,z,ht;
DWORD Color;
enum FVF
{
FVF_Flags = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
};
} V[3] = {
{(float)x1,(float)y1,0.0f, 0.0f, color},
{(float)x2,(float)y2,0.0f, 0.0f, color},
{(float)x3,(float)y3,0.0f, 0.0f, color},
}
// I am not going to add render states because.. I DONT WANT TO.
pDevice->SetTexture(0, NULL);// No need for the texture u have this auto NULL
pDevice->SetFVF( Vertex::FVF_Flags ); //No need for the texture there.. U dont have the parts for texture mapping.
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Ve rtex));
}[/php]
I JUST EDITED HIS FUNCTION REMOVED A LOT OF UN-NEEDED CODE WHAT WOULD OF BEEN JUST THERE TO WASTE MEMORY LIKE THE 4th VERTEX, THE TEXTURE FVF FLAG AND ALSO REMOVE A LOT OF THE DEFINE CODE WITH THIS.
[php]void FillARGBTriangle(int x1, int y1, int x2, int y2, int x3, int y3, D3DCOLOR color, IDirect3DDevice9 *pDevice)
{
struct Vertex
{
float x,y,z,ht;
DWORD Color;
enum FVF
{
FVF_Flags = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
};
} V[3] = {
{(float)x1,(float)y1,0.0f, 0.0f, color},
{(float)x2,(float)y2,0.0f, 0.0f, color},
{(float)x3,(float)y3,0.0f, 0.0f, color},
}
// I am not going to add render states because.. I DONT WANT TO.
pDevice->SetTexture(0, NULL);// No need for the texture u have this auto NULL
pDevice->SetFVF( Vertex::FVF_Flags ); //No need for the texture there.. U dont have the parts for texture mapping.
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Ve rtex));
}[/php]
This thread is closed for replies.

..
i want to see you trying...
.