The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Draw more complex 3D Models using Triangle Fans in WebGL

Draw more complex 3D Models using Triangle Fans in WebGL

3:49
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](https://egghead.io/lessons/javascript-drawing-triangle-fans-in-webgl?course=intermediate-webgl) to creating complex models.
Watch this lesson now
Avatar
egghead.io

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.

Avatar
Bojan

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?

Avatar
Keith

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.

In reply to Bojan
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?