diff options
Diffstat (limited to 'Build/source/utils/asymptote/bezierpatch.cc')
-rw-r--r-- | Build/source/utils/asymptote/bezierpatch.cc | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/Build/source/utils/asymptote/bezierpatch.cc b/Build/source/utils/asymptote/bezierpatch.cc index 5bf73d194b4..b2201754687 100644 --- a/Build/source/utils/asymptote/bezierpatch.cc +++ b/Build/source/utils/asymptote/bezierpatch.cc @@ -15,11 +15,7 @@ using ::orient3d; #ifdef HAVE_GL - -//FIXME: Find a nicer way to pass the shader program number, -// preferably without global variables... - -extern GLint noColorShader; +extern GLint materialShader; extern GLint colorShader; extern void setUniforms(GLint shader); @@ -893,7 +889,7 @@ void bounds(const std::vector<GLuint>& I) void BezierPatch::drawMaterials() { - if(nvertices == 0) + if(indices.size() == 0) return; static const size_t size=sizeof(GLfloat); @@ -901,7 +897,7 @@ void BezierPatch::drawMaterials() GLuint vertsBufferIndex; GLuint elemBufferIndex; - + GLuint vao; glGenVertexArrays(1,&vao); @@ -913,11 +909,11 @@ void BezierPatch::drawMaterials() registerBuffer(vertexbuffer,vertsBufferIndex); registerBuffer(indices,elemBufferIndex); - camp::setUniforms(noColorShader); + camp::setUniforms(materialShader); - const GLint posAttrib=glGetAttribLocation(noColorShader,"position"); - const GLint normalAttrib=glGetAttribLocation(noColorShader,"normal"); - const GLint materialAttrib=glGetAttribLocation(noColorShader,"material"); + const GLint posAttrib=glGetAttribLocation(materialShader,"position"); + const GLint normalAttrib=glGetAttribLocation(materialShader,"normal"); + const GLint materialAttrib=glGetAttribLocation(materialShader,"material"); glBindBuffer(GL_ARRAY_BUFFER,vertsBufferIndex); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,elemBufferIndex); @@ -947,10 +943,6 @@ void BezierPatch::drawMaterials() glBindVertexArray(0); glDeleteVertexArrays(1,&vao); - nvertices=0; - vertexbuffer.clear(); - indices.clear(); - glDeleteBuffers(1,&vertsBufferIndex); glDeleteBuffers(1,&elemBufferIndex); } @@ -959,7 +951,7 @@ void BezierPatch::drawColors(GLuint& Nvertices, std::vector<VertexData>& Vertexbuffer, std::vector<GLuint>& Indices) { - if(Nvertices == 0) + if(Indices.size() == 0) return; static const size_t size=sizeof(GLfloat); @@ -1020,10 +1012,6 @@ void BezierPatch::drawColors(GLuint& Nvertices, glBindVertexArray(0); glDeleteVertexArrays(1,&vao); - Nvertices=0; - Vertexbuffer.clear(); - Indices.clear(); - glDeleteBuffers(1,&vertsBufferIndex); glDeleteBuffers(1,&elemBufferIndex); } |