From 8f2c1d543da2339e366c10e9f4517122d6aab2c9 Mon Sep 17 00:00:00 2001 From: granzuglia Date: Mon, 24 May 2010 14:53:54 +0000 Subject: [PATCH] fixed small visualization bugs (dereferenced empty vertex attributes) --- wrap/gl/trimesh.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wrap/gl/trimesh.h b/wrap/gl/trimesh.h index 2bcc3ec9..59a2c7fd 100644 --- a/wrap/gl/trimesh.h +++ b/wrap/gl/trimesh.h @@ -746,16 +746,19 @@ void DrawPoints() if (nm==NMPerVert) { glEnableClientState (GL_NORMAL_ARRAY); - glNormalPointer(GL_FLOAT,sizeof(typename MESH_TYPE::VertexType),&(m->vert.begin()->N()[0])); + if (m->vert.size() != 0) + glNormalPointer(GL_FLOAT,sizeof(typename MESH_TYPE::VertexType),&(m->vert.begin()->N()[0])); } if (cm==CMPerVert) { glEnableClientState (GL_COLOR_ARRAY); - glColorPointer(4,GL_UNSIGNED_BYTE,sizeof(typename MESH_TYPE::VertexType),&(m->vert.begin()->C()[0])); + if (m->vert.size() != 0) + glColorPointer(4,GL_UNSIGNED_BYTE,sizeof(typename MESH_TYPE::VertexType),&(m->vert.begin()->C()[0])); } glEnableClientState (GL_VERTEX_ARRAY); - glVertexPointer(3,GL_FLOAT,sizeof(typename MESH_TYPE::VertexType),&(m->vert.begin()->P()[0])); + if (m->vert.size() != 0) + glVertexPointer(3,GL_FLOAT,sizeof(typename MESH_TYPE::VertexType),&(m->vert.begin()->P()[0])); glDrawArrays(GL_POINTS,0,m->vn);