From bbb53f06c6f48d4c675d250829032e09f4065a86 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 10 Aug 2019 16:06:35 +0000 Subject: asy 2.52 sources git-svn-id: svn://tug.org/texlive/trunk@51856 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/bezierpatch.cc | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'Build/source/utils/asymptote/bezierpatch.cc') 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& 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& Vertexbuffer, std::vector& 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); } -- cgit v1.2.3