I have simple drawn a 3d Triangle or a pyramid with four faces. There
1 - Front Face
2 - Left Face
3- Back Face
4- Right Face
Pyramid is drawn right … my problem is I can see through it. After
ananlyzing it I came to the following observations :
How come I am seeing through surfaces.
There is something I am missing, right?
Please log in or register to post a reply.
hmm, depth-buffer enabled ?
setup the projection matrix in the right way ?
backface culling enabled ?
Depth Buffer is enabled, lighting is off and Back Face Culling is off.
Here is the code :
Graphics->SetRenderState (D3DRS_LIGHTING, false); // Set Lights Off
Graphics->SetRenderState (D3DRS_CULLMODE, D3DCULL_NONE); // Do not cull Back Faces
Graphics->SetRenderState (D3DRS_ZENABLE, D3DZB_TRUE); // Enable Depth Buffering
And for the Projection Matrix :
float AspectRatio = (float)Width / (float)Height; // Ratio between Width & Height
// Initialize Perspective View for the Screen
D3DXMatrixPerspectiveFovLH (&Projection, // Projection Matrix
1.0f, // Field of View
AspectRatio, // Aspect Ratio of the Screen
0.0f, // Nearest Clipping Plane
100.0f); // Farthest Clipping Plane
// Setup Projection Matrix for the Screen
Graphics->SetTransform (D3DTS_PROJECTION, &Projection);
Is there anything to do with nearest clipping plane or the Field Of
It was nearest clipping plane … thanks :lol: !
i was going to tell you just that…