yes i use the same vertex and indices as before. What’s the problem with it?? and how can i fix it??
Define another element array with proper line connectivity. GL_TRIANGLE connects every 3 elements to form a triangle, whereas GL_LINE connects each pair to form a line. If you use the triangle element array for lines, you’ll end up with a jumbled tangled of lines which sort of resemble a cube. So for each of the 12 edges in the cube, define a pair of elements to connect - (0,1, 1,2, 2,3, 3,0, 4,5, 5,6, 6,7, 7,4, 0,4, 1,5, 2,6, 3,7 } (depending on the layout of your 8 corner points, which I guessed was 0123 4567 for two opposing faces).
I tried this:
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
and it worked when i made it at the initialisation, but when i made it while runtime EVERYTHING died. Even the QToolbar, Labels, buttons,…
Did you set it back to GL_FILL when you were finished drawing the outline of the box? Note that this solution will outline the triangles and not the quads, which is probably not what you’re looking for.