Draw more complex 3D Models using Triangle Fans in WebGL

Share this video with your friends

Send Tweet

This time we look at the last drawing mode, triangle fan, which can be useful for drawing different types of 3d forms. Combine this mode with triangle strip to creating complex models.

Bojan
Bojan
~ 8 years ago

Hi Keith,

I love your tutorials and have been following them very closely. In your tutorial you copied the last point underneath the for loop. Wouldn't it be better to write i <= Math.PI * 2 in the loop itself?

Keith Peters
Keith Peters(instructor)
~ 8 years ago

The thing is, you are adding a small amount to a variable over time. It's unlikely that it's every going to exactly equal Math.PI * 2 which is 6.283185307179586. In fact, I can almost guarantee that your incremented variable will never come out to exactly that value. If you were using whole numbers like a loop from 0 to >= 10 and incrementing by 1, then yeah, you'd reach 10. It's different with floating point numbers.