<div class="gmail_quote">On Fri, Nov 6, 2009 at 11:02 AM, Luca Pamparana <span dir="ltr">&lt;<a href="mailto:luca.pamparana@gmail.com">luca.pamparana@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<br>
I have a question about vertex ordering. I am creating a cube where<br>
one of the faces is created by various polygons and they will have<br>
alternate colours.<br>
<br>
An example list of points are as follows:<br>
<br>
-1.5 0 -3 // point ID 0<br>
-1.5 4 -3 // point ID 1<br>
-1.5 0 -2.2 // point ID 2<br>
-1.5 4 -2.2 // point ID 3<br>
<br>
-1.5 0 -2.2<br>
-1.5 4 -2.2<br>
-1.5 0 -1.4<br>
-1.5 4 -1.4<br>
<br>
-1.5 0 -1.4<br>
-1.5 4 -1.4<br>
-1.5 0 -0.6<br>
-1.5 4 -0.6<br>
<br>
-1.5 0 -0.6<br>
-1.5 4 -0.6<br>
-1.5 0 0.2<br>
-1.5 4 0.2<br>
<br>
-1.5 0 0.2<br>
-1.5 4 0.2<br>
-1.5 0 1<br>
-1.5 4 1<br>
<br>
And I fill each of these polygons with various colours using a<br>
vtkActor As you can see they represent the left wall of a cube<br>
(constant in x). Now, when I arrange the points in clockwise direction<br>
(when viewing from inside the room) as (0, 2, 3, 1). I do not see the<br>
colours. The panels get drawn as black boxes. However, when I arrange<br>
them counterclockwise (0, 1, 3, 2), the colours show up fine.<br>
<br>
Can someone tell me why this is the case??<br>
<br>
Thanks,<br>
<br>
Luca<br>
</blockquote><div><br></div><div>I believe this is because the lighting calculation OpenGL is doing depends on the direction of the normal. If you specify the points in one order, the normal of the polygon is facing one direction, but if you specify the points in the reverse order, the normal gets flipped. If the normal is not pointing towards the light source it will show up as black. I&#39;m certain their is a VTK call to say &quot;render back faces&quot; or something similar? Or maybe someone can show you how to add an ambient light source / another light source?</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Good luck,</div><br clear="all">Thanks,<br><br>David</div>