• Advertisement
Sign in to follow this  

Clock count wise doesn't work

This topic is 2224 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have:
pDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW);

and I have vertex and index buffer as below:

NormalVertex2 vertsProstokat[] =
{
NormalVertex2(0.0f, 0.0f, 0.0f, 0.0f, 1.0f), //0 (x,y,z,u,v)
NormalVertex2(0.0f, 1.0f, 0.0f, 0.0f, 0.0f), //1
NormalVertex2(1.0f, 0.0f, 0.0f, 1.0f, 1.0f), //2
NormalVertex2(1.0f, 1.0f, 0.0f, 1.0f, 0.0f), //3
};
u32 faceProstokat[] = {0,1,2, 2,1,3};
Those vertices as we see define rectangular.
When I move my camera around 180 degree I don't see the rectangular. When I don't move camera more than 90 degree on the left or right I see the rectangular. I understand it because I have clock count-wise order, everything is OK, everything works as theory says.:)
But when I redefine indices container:
{1,0,2, 2,3,1}
I don't see rectangular at all no matter how I move my camera (0-360 degree). I don't understand it, because I believe that I should see rectangular if I move my camera around 180 degree and I shouldn't see the rectangular if I don't move camera more than 90 degree left/right.
Could somebody explain why I don't see the rectangular in this case?

Share this post


Link to post
Share on other sites
Advertisement
That's because of winding order. By default D3D will cull triangles that are not specified in clockwise winding order. If you disable culling by setting [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

pDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE); then it should be visible

[/font]

Share this post


Link to post
Share on other sites
Yes, but if I define triangles in the not CCW order it doesn't mean that the triangles are always seen in not CCW order. Because when You turn back Your camera about 180 degree trinagles are in CCW order and they are not seen. This is what I don't understand.
When You define triangles in CCW order they are seen, and when You turn camera around 180 degree they are not seen. This is what is OK.
So I don't understand why triangles in not CCW order are never seen. It should be seen in opposite way to trinagles in CCW order.

Share this post


Link to post
Share on other sites
it's not seen because those triangles are back facing polygons, like I said before if you wanna see those back facing polygons then disable culling

Share this post


Link to post
Share on other sites
Yes, but if You move the camera around more than 90 degree, those triangles aren't back facing polygons. Their order is like CCW order. This is what I don't understand.
Maybe please see the image and You will know about what I was writing:
http://img543.imageshack.us/img543/9561/ordertriangles.jpg

Share this post


Link to post
Share on other sites
OK, thanks, I analysed code once again and I have bug. All vertices are now drawn according to the theory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement