KhronosGroup/WebGL

consider glPolygonMode

Closed this issue · 5 comments

consider glPolygonMode

at least with GL_LINE

glPolygonMode does not exist in OpenGL ES

Although it does not exist in OpenGL ES core specs, there is a GL_NV_polygon_mode extension. It's not fully portable, though:

  1. Implementing GL_POINT polygon mode on top of Direct 3D or Metal would be very difficult.
  2. Among native OpenGL ES drivers, only NVIDIA supports this feature.
  3. Among Vulkan mobile drivers, only NVIDIA and Adreno support this feature.

That said, a subset of this extension with only GL_LINE and GL_FILL (default) modes seems implementable.

At some point we have to stop adding features to WebGL, and given that both points and lines are already problematic in WebGL implementations (uninitialized gl_PointSize has undefined behavior, and many implementations don't support line width greater than 1), I don't think this feature makes the cut.

  • This feature (aka FillMode) allows triangle primitives to be rendered as edges; it's not related to point and line primitive types and their limitations.
  • Engines usually build an extra index buffer in JS and use line primitives to render a wireframe of a model made of triangles. Having this toggle would allow reusing the original VAO state thus reducing CPU work and data uploads for such cases.
  • Although mobile support is very limited, desktop support is nearly universal (assuming that GL_POINT is removed).