diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 24aba1a5a97cd337518391dee17e6bdeb74c25ab..793b851988e5a207265d8edbf01017216fff14f2 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -190,13 +190,12 @@ class drawGFace { void _drawVertexArray(VertexArray *va, bool useNormalArray, int forceColor=0, unsigned int color=0) { - if(!va) return; + if(!va || !va->getNumVertices()) return; glVertexPointer(3, GL_FLOAT, 0, va->getVertexArray()); - glNormalPointer(GL_BYTE, 0, va->getNormalArray()); - glColorPointer(4, GL_UNSIGNED_BYTE, 0, va->getColorArray()); glEnableClientState(GL_VERTEX_ARRAY); if(useNormalArray){ glEnable(GL_LIGHTING); + glNormalPointer(GL_BYTE, 0, va->getNormalArray()); glEnableClientState(GL_NORMAL_ARRAY); } else @@ -206,6 +205,7 @@ class drawGFace { glColor4ubv((GLubyte *) & color); } else{ + glColorPointer(4, GL_UNSIGNED_BYTE, 0, va->getColorArray()); glEnableClientState(GL_COLOR_ARRAY); } if(CTX.polygon_offset) glEnable(GL_POLYGON_OFFSET_FILL); diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index efe9b7bde6ab6c88266bdb4d69689d2d3f60ad15..e547f3934d23b2f6d686cc60900e87b2e8ae6edf 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -985,7 +985,7 @@ static void addElementsInArrays(PView *p, bool preprocessNormalsOnly) static void drawArrays(PView *p, VertexArray *va, GLint type, bool useNormalArray) { - if(!va) return; + if(!va || !va->getNumVertices()) return; PViewOptions *opt = p->getOptions(); @@ -1033,15 +1033,15 @@ static void drawArrays(PView *p, VertexArray *va, GLint type, bool useNormalArra } else{ glVertexPointer(3, GL_FLOAT, 0, va->getVertexArray()); - glNormalPointer(GL_BYTE, 0, va->getNormalArray()); - glColorPointer(4, GL_UNSIGNED_BYTE, 0, va->getColorArray()); glEnableClientState(GL_VERTEX_ARRAY); if(useNormalArray){ glEnable(GL_LIGHTING); + glNormalPointer(GL_BYTE, 0, va->getNormalArray()); glEnableClientState(GL_NORMAL_ARRAY); } else glDisableClientState(GL_NORMAL_ARRAY); + glColorPointer(4, GL_UNSIGNED_BYTE, 0, va->getColorArray()); glEnableClientState(GL_COLOR_ARRAY); glDrawArrays(type, 0, va->getNumVertices()); glDisableClientState(GL_VERTEX_ARRAY);