diff options
author | Karl Berry <karl@freefriends.org> | 2019-08-10 16:06:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-08-10 16:06:35 +0000 |
commit | bbb53f06c6f48d4c675d250829032e09f4065a86 (patch) | |
tree | 0583c905a5d67f3e1447456048b2e479311e4e83 /Build/source/utils/asymptote/bezierpatch.cc | |
parent | efd1dbbaa1332a9534c25024a0c295f423714851 (diff) |
asy 2.52 sources
git-svn-id: svn://tug.org/texlive/trunk@51856 c570f23f-e606-0410-a88d-b1316a301751
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); } |