1
\$\begingroup\$

Is it possible to render a "true" quad in OpenGL? By that I mean a square which is not made out of two triangles.

\$\endgroup\$
1
  • \$\begingroup\$ What you mean is usually referred to as "quad" in rendering terms not "square". \$\endgroup\$ Dec 17 '14 at 12:30
5
\$\begingroup\$

No.

You can use the GL_QUADS primitive type instead of GL_TRIANGLES and draw four vertices instead of three.

But even with this, OpenGL will internally render with triangles.

\$\endgroup\$
8
  • \$\begingroup\$ Will it even increase performance then? \$\endgroup\$
    – KaareZ
    Dec 17 '14 at 12:58
  • \$\begingroup\$ If you render a lot of triangles, it may reduce bandwidth consumption. Depending on the driver implementation, it could also slow down the render, especially on old graphics cards. \$\endgroup\$
    – Toun
    Dec 17 '14 at 13:08
  • \$\begingroup\$ If I want to render 50k squares. Would you recommend 50k quads or 100k triangles? \$\endgroup\$
    – KaareZ
    Dec 17 '14 at 13:14
  • \$\begingroup\$ I would try quads first but the best solution is to benchmark, on different computers if possible. \$\endgroup\$
    – Toun
    Dec 17 '14 at 13:20
  • 1
    \$\begingroup\$ @Toun Data in a vertex buffer can be interpreted as any kind of primitive. It's perfectly fine to have both quad and triangle primitive data in a vertex buffer, as long as you match the right primitive type when drawing the subsets. \$\endgroup\$ Dec 17 '14 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .