Ok, so I'm still planning on making game hacks sometime in the future and I'm following a Direct3D tutorial
here but now I'm stuck.
I have already done everything that the guy on the tutorial page has done and the programs compiles just right no problems at all.
But, now I want to go a bit further. I want to draw 2 Triangles to the screen which are rotating. This isn't the problem either the problem is that I can see my 2nd smaller triangle through the other triangle :O
I think I know why, because I use a rather noob way of drawing these 2 triangles:
Code:
void render_frame(void)
{ //D3DCOLOR_XRGB(r, g, b)
// clear the window to a deep blue D3DCOLOR_ARGB(136, r, g, b);
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->BeginScene(); // begins the 3D scene
// select which vertex format we are using
d3ddev->SetFVF(CUSTOMFVF);
// SET UP THE PIPELINE
D3DXMATRIX matRotateY; // a matrix to store the rotation information
static float index = 0.0f; index+=0.05f; // an ever-increasing float value
// build a matrix to rotate the model based on the increasing float value
D3DXMatrixRotationY(&matRotateY, index);
// tell Direct3D about our matrix
d3ddev->SetTransform(D3DTS_WORLD, &matRotateY);
D3DXMATRIX matView; // the view transform matrix
D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3 (0.0f, 0.0f, 10.0f), // the camera position
&D3DXVECTOR3 (0.0f, 0.0f, 0.0f), // the look-at position
&D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); // the up direction
d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the view transform to matView
D3DXMATRIX matProjection; // the projection transform matrix
D3DXMatrixPerspectiveFovLH(&matProjection,
D3***oRadian(45), // the horizontal field of view
(FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio
1.0f, // the near view-plane
100.0f); // the far view-plane
d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection); // set the projection
d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX) ); //Drawing my 1st triangle here
// copy the vertex buffer to the back buffer
d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); //Drawing my 1st triangle here
d3ddev->SetStreamSource(0, v_buffer1, 0, sizeof(CUSTOMVERTEX1)); //Drawing my 2nd triangle here
d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); //Drawing my 2nd triangle here
d3ddev->EndScene(); // ends the 3D scene
d3ddev->Present(NULL, NULL, NULL, NULL); // displays the created frame on the screen
}
Yes, I did C&P this right out of the tutorial, that's how I learn, I read the tutorial copy the code and start playing around with the functions until I think I got it.
So can anyone help me?
-SCHiM