0

Why is it so important that polygons you push through the pipeline be "simple" and "convex"?

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • Are you referring specifically to OpenGL? I would assume that it makes life for the graphics engine a lot easier and more efficient. You can break down a complex and/or non-convex polygon into several simple, convex polygons. – lurker Dec 03 '18 at 01:56
  • Yes specifically to OpenGL – Kaylie Tess Dec 03 '18 at 03:25
  • 1
    @KaylieTess Probably because a convex polygon be broken down into triangles with ease. If the polygon is concave this is more complicated. – Rabbid76 Dec 03 '18 at 06:12
  • Convex polygons are directly renderable ... see [how to rasterize rotated rectangle (in 2d by setpixel)](https://stackoverflow.com/a/19078088/2521214) on the other hand convex polygons are not as that would lead to wrong output ... – Spektre Dec 03 '18 at 08:27
  • 1
    @Rabbid76 convex polygons do not need to be broken to triangles ... they can be rendered directly with the same scanline interpolation algorithm ... however highly parallel implementations might prefer triangles as they can be done in parallel using barycentric coordinates and inside 2D BBOX test instead – Spektre Dec 03 '18 at 14:42
  • 1
    @KaylieTess what exactly do you mean by "simple" polygon? – Spektre Dec 03 '18 at 14:43

1 Answers1

-1

In the OpenGL compatibility profile (as modern OpenGL no longer has a GL_POLYGON primitive), polygons other than convex polygons are not guaranteed to be rendered correctly (10.1.16) because an implementation is required only to store "at least two processed vertices" per polygon primitive — "a convex polygon can be rasterized as its vertices arrive, before all of them can be specified" (10.1.5). This goes back to the client-server nature of OpenGL (2.1).

Peter O.
  • 32,158
  • 14
  • 82
  • 96