differences solid and wireframe

Hi,

i just wonder about the differences between solid and wireframe painted. Not what it mean, but the way it is painted.

[ATTACH=CONFIG]1433[/ATTACH]

glDrawElements(wireframe? GL_LINES : GL_TRIANGLES, it.size, GL_UNSIGNED_INT, (void*)(it.offset * sizeof(GLuint)));

As you can see the solid one is exactly painted, whereas the wireframe looks crazy

You use the same vertex array for both ? In that case, this is normal.

yes i use the same vertex and indices as before. What’s the problem with it?? and how can i fix it??

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,…

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.

i’d be fine if all triangle outlines are painted. And yes i set it back to GL_FILL, when the button is pressed a 2nd time. but since after the first press, everything died, i couldn’t press another time