#### Archived

This topic is now archived and is closed to further replies.

# left-hand, right-hand problem with triangles.

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

## Recommended Posts

Hope somebody can clear this up for me. According to all the doc''s and posts i''ve read, the first triangle drawn in a triangle strip sets whether you will drawn clockwise or counter-clockwise for the entirety of that triangle strip. my first 3 vertices are drawn in this order: 1 3 | / | / |/ 2 (note: this may not appear coorectly when posted, it is simply a scalene triangle, 1,2,3, in counter-clock wise motion.) having my culling to be CCW, oddly enough D3D only draws the triangles that are drawn in this way: 2 |\ | \ | \ 3 1 (note: this is still counter-clockwise!) Apparantly, D3D "thinks" that the latter example is CCW, but the former one is not. Anybody know why?

##### Share on other sites
Are the two upper points at exactly same horizontal line?
I''ve seen drivers that incorrectly ''optimize'' the triangle scan out if this is the case (not in a long time, though).

##### Share on other sites
One source of your problem might be that you have it backwards -- "cull" means "remove", so "cull CCW" means "don't draw CCW".

The normal state for D3D is to cull CCW, which means display CW.
The normal state for OpenGL is the opposite -- cull CW and draw CCW.

Tri-strips are generally laid out like this:
   1--3--5--7 ...A. | /| /| /| ... or   2--4--6--8 ...   2--4--6--8 ...B. |\ |\ | \| ...   1--3--5--7 ...
Anything else will have weird results (which are sometimes useful).

If you look at how a tri-strips are laid-out you will see that triangles alternate between CW and CCW. To accomodate this, the renderer alterates culling between CW and CCW for each triangle in the strip. The odd triangles (the first one is 1) are culled using the cull setting and the even triangles are culled using the opposite of the cull setting.

[Edit: Sorry, the above paragraph was incorrect and is now fixed.]

[edited by - JohnBolton on August 13, 2003 1:40:59 AM]

##### Share on other sites
to answer the first reply, the top two vertices are exactly at the same horizontal level.

Now that i know that setting CCW means culling clockwise drawn triangles, i can understand why the drawing/not drawing problem exists now. thanks.

But that does not explain this problem that i will try to explain now.
Using one single triangle strip, i created a plain. starting from the top left and going down ultimately to the bottom right, in a zig zag fashion. i start out in a CCW fashion.

So here is the thing: every other row of triangles are drawn, but every other row inbetween the drawn ones, well, they''re not drawn. So why is this a problem..? Well, since the whole thing is drawn by a single triangle strip and a single drawprimitive call, the whole thing should be theoretically CCW!

so far im drawing it all using no culling at all.
but i would like to know what is the bug/problem because i keep coming back to this just because it bothers me.

##### Share on other sites
quote:
Original post by GekkoCube
... Well, since the whole thing is drawn by a single triangle strip and a single drawprimitive call, the whole thing should be theoretically CCW!

First, see the correction to my previous post about culling triangles in a strip. My first explanation was wrong/misleading.

How do you connect the end of one row to the beginning of the next row? Are you using degenerate triangles? If so, then don''t forget that the renderer still alternates culling through those even though they aren''t drawn. If not, then that is probably part of your problem -- you can''t draw multiple strips with one DrawPrimitive call.

• ### Forum Statistics

• Total Topics
628732
• Total Posts
2984437

• 25
• 11
• 10
• 16
• 14