No One in Particular
No One in Particular

Reputation: 2894

OpenGL: Which is faster - GL_POLYGON or GL_TRIANGLE_FAN?

I am going to draw a regular hexagon with one fill color. I can do it with a sequence of glVertex2*() calls. However, the glBegin() call is what I am asking about. Is there any benefit to using GL_POLYGON or GL_TRIANGLE_FAN? If it matters, drawing hexes will be the main work of the program. If you have another idea, I am all ears.

Upvotes: 6

Views: 3033

Answers (2)

Ben Voigt
Ben Voigt

Reputation: 283614

GL_POLYGON is deprecated in OpenGL 3.x. I think most drivers convert GL_POLYGON to a bunch of triangles, you can save the conversion by providing triangles in the first place.

Upvotes: 9

Andrew White
Andrew White

Reputation: 53496

Usually that are very very close but at that point it's going to be down to the hardware. Don't worry about such minor details and only revisit it once you are sure that you indeed have a bottleneck in that area.

Upvotes: 4

Related Questions