简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM