<p>Things like that are usually done using an <a href="https://www.opengl.org/wiki/Vertex_Specification#Index_buffers">index buffer</a>. The idea is that you have you have two buffers: One for all the vertices and one that determines the topology of what to draw. Then you can draw all the lines at once with a single <a href="https://www.opengl.org/wiki/GLAPI/glDrawElements">glDrawElements</a> call, using GL_LINES as mode.</p>

CC BY-SA 3.0
2015-10-28T16:46:49.410Z
Amazing, just finished implementing it and Element Buffers are the way to go.
BRabbit27
CC BY-SA 3.0
2015-10-27T22:11:26.847Z
2015-10-27T22:11:26.847Z
Wumpf
<p>I'm developing with OpenGL 4.1 and have good understanding of the modern pipeline. I was thinking on doing it with GL_LINE_LOOP for each face, but I think this will require several draw calls which certainly is not optimal. What could be a better approach?</p>

<opengl>
How to render the wireframe of a cube without the diagonals on the faces?
BRabbit27
# How to render the wireframe of a cube without the diagonals on the faces?

(Asked by: username_0 on 2015-10-27)

I'm developing with OpenGL 4.1 and have good understanding of the modern pipeline. I was thinking on doing it with GL\_LINE\_LOOP for each face, but I think this will require several draw calls which certainly is not optimal. What could be a better approach?

**Tags:** opengl


---

## 1 answers

### Answer by username_1 on 2015-10-27. Score: 5 | Accepted answer

Things like that are usually done using an [index buffer](https://www.opengl.org/wiki/Vertex_Specification#Index_buffers). The idea is that you have you have two buffers: One for all the vertices and one that determines the topology of what to draw. Then you can draw all the lines at once with a single [glDrawElements](https://www.opengl.org/wiki/GLAPI/glDrawElements) call, using GL\_LINES as mode.

> **Comments:**
> **username_0**: Amazing, just finished implementing it and Element Buffers are the way to go.  

---

