rendered paste bodyvoid TriangeTwo()
{
CUSTOMVERTEX g_Vertices[] =
{
{ 200, 400.0f, 0.0f, 0.0f, D3DCOLOR_XRGB(0,255,0), }, // x, y, z, color
{ 200.0f, -1.0f, 0.0f, 0.0f, D3DCOLOR_XRGB(255,0,0), },
{ 140.0f, -1.0f, 0.0f, 0.0f, D3DCOLOR_XRGB(255,0,0), },
};
IDirect3DVertexBuffer9* pVertexBuf = NULL;
HRESULT hR = g_pDirect3DDevice->CreateVertexBuffer(3*sizeof(CUSTOMVERTEX),0 , D3DFVF_XYZRHW | D3DFVF_DIFFUSE, D3DPOOL_DEFAULT , &pVertexBuf , NULL);
VOID* pVertices;
hR = pVertexBuf->Lock(0, 0, (void**)&pVertices, 0);
memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );
pVertexBuf->Unlock();
//Some variables to help with the rotation
static int iRotationDegrees = 0; //variable that will hold the degrees
D3DXMATRIX matRotation; //rotation matrix
D3DXMatrixRotationX(&matRotation,D3DXToRadian(iRotationDegrees));
g_pDirect3DDevice->SetTransform(D3DTS_WORLD, &matRotation); //set the device's world transformation matrix
iRotationDegrees++;
wsprintf(buffer , "%d" ,iRotationDegrees);
SetWindowText(g_hWnd , buffer);
if(iRotationDegrees == 360)
iRotationDegrees = 0;
g_pDirect3DDevice->SetStreamSource( 0, pVertexBuf, 0 , sizeof(CUSTOMVERTEX) );
g_pDirect3DDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
g_pDirect3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );
}