C++ Question

Why changing the Z position of the 'camera' won't show the primitive?

I have an untransformed struct with the vertices coordination that'll form up a triangle:

struct utVertex ut_Vertex[] =
{ 2.5f, -3.0f, 0.0f, D3DCOLOR_XRGB(0, 0, 255), }, //a
{ 0.0f, 3.0f, 0.0f, D3DCOLOR_XRGB(0, 255, 0), }, //b
{ -2.5f, -3.0f, 0.0f, D3DCOLOR_XRGB(255, 0, 0), },//c

enter image description here

The image above should (not sure, because z axis could be inverted, + perhaps should be where - is) be correct according to my code:

&D3DXVECTOR3(0.0f, 0.0f, 10.0f),
&D3DXVECTOR3(0.0f, 0.0f, 0.0f),
&D3DXVECTOR3(0.0f, 1.0f, 0.0f));
d3dDevice->SetTransform(D3DTS_VIEW, &matView);

The blue dot on the image above should be the camera position based on this code. (Please tell me if I'm wrong).

This draws a triangle correctly on screen.

enter image description here

Now, if I change the camera position to
instead of
(I think) this is where the camera should be:

enter image description here

But it should still be looking at
0.0f, 0.0f, 0.0f
If it does, then why changing Z position of the 'camera' won't show the primitive(triangle)?

Nothing shows:
enter image description here

Answer Source

The polygons you're using are single sided, so they are not visible when viewed from behind. To get your triangle to show when you reverse the camera, you'll either need to add another polygon with the same points but listed in the opposite direction - (a,c,b) instead of (a,b,c) - or swap two of these points in your ut_Vertex array.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download