 # Geomtriangles doesn't work but geomlinestrips does

I have code to create a simple square grid using linestrips which works perfectly.

I then tried to create the same thing using triangles and i get a blank screen.

very strange. the problem is that the code is so simple i can’t figure out that i’m doing something wrong. My guess is that i’m doing something wrong in the set-up that should be different from using linestrips vs triangles, but i’m unsure which code to include, so let’s start here.

Keep in mind that other than returning a different primitive the code is exactly the same. i simply add the returned primitive as shown here (notice that i literally switch the commenting to go between the two versions).

``````       geom = Geom(array)
.
.
.
# prim = self.create_linestrips(square)
prim = self.create_triangles(square)
print(prim)
``````

the GeomTriangles generator.

The indexes are the four corners of a square in CCW order, i.e. indexes is the lower right hand corner of the square.

Notice that i am only creating one triangle per primitive right now.

``````
n1 = int(indexes)
n2 = int(indexes)
n3 = int(indexes)
n4 = int(indexes)

print(n1, n2, n3, n4)
prim = GeomTriangles(Geom.UHStatic)

prim.close_primitive()

return prim
``````

Just a face on the other side.

``````    prim.add_vertex(n1)

wut ?!

lol. i was so careful to make sure i put the vertices in so they are counter clockwise, and it turns out they need to be clockwise ?

also, i thought i had tried that, it was the first thing i thought of, but clearly i did not.

so this due to the problem with the normal pointing the wrong way , right ?

Thank you so much !

To confirm this, you can find it using the mouse to view. Although the normal is used to smooth the vertices.

yes, confirmed. i could rotate it around and then see it.

the visual normal has to coincide to the “side” the camera is on.