diff --git a/include/pangolin/gl/glvbo.h b/include/pangolin/gl/glvbo.h index c989dfa2a..18cbce0ed 100644 --- a/include/pangolin/gl/glvbo.h +++ b/include/pangolin/gl/glvbo.h @@ -127,7 +127,12 @@ inline void RenderVboIbo(GlBuffer& vbo, GlBuffer& ibo, bool draw_mesh) if(draw_mesh) { ibo.Bind(); - glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0); + if(ibo.count_per_element==1) { + glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0); + } + else { + glDrawElements(GL_TRIANGLES,ibo.num_elements*ibo.count_per_element, ibo.datatype, 0); + } ibo.Unbind(); }else{ glDrawArrays(GL_POINTS, 0, vbo.num_elements); @@ -173,7 +178,12 @@ inline void RenderVboIboCboNbo(GlBuffer& vbo, GlBuffer& ibo, GlBuffer& cbo, GlBu if(draw_mesh) { ibo.Bind(); - glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0); + if(ibo.count_per_element==1) { + glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0); + } + else { + glDrawElements(GL_TRIANGLES,ibo.num_elements*ibo.count_per_element, ibo.datatype, 0); + } ibo.Unbind(); }else{ glDrawArrays(GL_POINTS, 0, vbo.num_elements); @@ -207,7 +217,12 @@ inline void RenderVboIboNbo(GlBuffer& vbo, GlBuffer& ibo, GlBuffer& nbo, bool dr if(draw_mesh) { ibo.Bind(); - glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0); + if(ibo.count_per_element==1) { + glDrawElements(GL_TRIANGLE_STRIP,ibo.num_elements, ibo.datatype, 0); + } + else { + glDrawElements(GL_TRIANGLES,ibo.num_elements*ibo.count_per_element, ibo.datatype, 0); + } ibo.Unbind(); }else{ glDrawArrays(GL_POINTS, 0, vbo.num_elements);