screenshot plz.
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:
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.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 }
So can anyone help me?
-SCHiM
screenshot plz.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
Oops it seems like I'm a real idiot :O
I was fooled by my own program. The triangle doesn't disappear behind the 2nd triangle because it never goes there It's just hanging in front of the bigger triangle
But that raises another question, how can I make the 2nd triangle disappear behind the 1st??
Here's the video BTW: (I thought making a video would be clearer since my triangles are in a constant motion)
[YOUTUBE]Byc_iCQ1khA[/YOUTUBE]
The I thought about using:But then my 1st triangle would be cut in half tooCode:d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
Last edited by schim; 06-11-2010 at 11:55 PM.
//Solved
My question is solved in the next page of the tutorial
I ended up using a zbuffer wich is a buffer that keeps track of the distance between the camera and the screen
Here is an in depth explaination
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower