Index Buffer Issues
Members - Reputation: 436
Posted 21 October 2012 - 11:50 AM
This is it rendered with out wire frame.
This is the same surface rendered with wire frame.
So you can see that each triangle is not defined with lines, there are these strange gaps that I don't understand and I also don't understand how the surface is rendering correctly but the wire frame is not. with that said I am not using GL_LINE_LOOP or GL_TRIANGLE_LOOP it is just triangle and lines. so what am i missing? Now is this something that would be a result of how my index buffer is set up or am I completely not understanding this. Any light shed on the situation would be awesome.
This is a problem for me when i am trying to create my own file types for storing the vertex info. I am not getting a real number of faces or a full triangle face information.
Members - Reputation: 841
Posted 21 October 2012 - 01:05 PM
GL_LINES draws one line segment between each pair of vertices. GL_TRIANGLES draws triangle between each triplet of vertices. Thus if you have, for example, an index buffer:
It defines two adjacent triangles (sharing edge 2-3), but if drawn with GL_LINES, only two line segments (1-2 and 2-4) will be drawn.
Primitive types (GL_TRIANGLES, GL_LINES, etc.) define the topology of your mesh. In your case the topology is triangles so you have to use GL_TRIANGLES always.
glPolygonMode defines whether you want your triangles to be filled or outlined.
So you have to set glPolygonMode to GL_LINE and use glDrawElements with GL_TRIANGLES in your code for wireframe mode.
First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/
Members - Reputation: 1087
Posted 21 October 2012 - 03:34 PM
My journal: Making a Terrain Generator