Render Meshes with Quads Instead of Triangles

Hi,

I’m studying Metal from Metal by Tutorials but I have a very basic question. OpenGL supports drawing objects with quad instead of triangles. e.q the train in the Blender drawn with quad but when obj is imported in Metal application, it is drawn with triangles.
How can we draw objects with quad like OpenGL? I know it may be not efficient but is necessary.

Thanks.

Hi @unibodydesignn and welcome to the forums :blush:!

I believe that modern OpenGL has removed GL_QUADS, but you can still use it with a compatibility profile context. GPUs always render triangles - even if you use GL_QUADS, the GPU cuts them in half to use triangles.

However, if you’re wanting to draw quad wireframe like Blender does, that’s a very interesting question. You can’t do it natively (and this is the case for all GPU hardware, not just Metal), but you fudge anything in shaders. With the native wireframe, you also have the 1 pixel line width GPU limitation too.

I don’t know how to do it, but I thought the answers here are the most interesting Google find:

with the white paper from Nvidia:

Metal/A14 now supports primitive id and barycentric coordinates, which I haven’t used, but may make your task easier, as you can more easily find edges using barycentric coordinates.