'Opengl draw cube edges

I'm able to draw a simple cube with modern opengl, but I would like to be able to draw a line cube from the same data I draw my current cube with (vertices):

image

currently I'm drawing a cube and using glPolygonMode to draw the lines, but I would like to get rid of the lines going though each quad face (essentially just drawing the edges of the cube)

I wasn't able to get any further than this, I don't know how to tackle this topic (shaders, or some other opengl method)

how can I draw a cube in such a way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source