- removed "glIndexPointer invalid operation" bug

This commit is contained in:
granzuglia 2015-06-10 23:52:50 +00:00
parent 1d9d1e6324
commit 69bc2244d1
1 changed files with 9 additions and 26 deletions

View File

@ -30,6 +30,7 @@
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include<cstdio>
//#include <GL/glew.h>
#include <wrap/gl/space.h>
@ -176,7 +177,7 @@ namespace vcg
_bo[FACECOLORBO] = new GLBufferObject(4,GL_UNSIGNED_BYTE);
_bo[VERTTEXTUREBO] = new GLBufferObject(2,GL_FLOAT);
_bo[WEDGETEXTUREBO] = new GLBufferObject(2,GL_FLOAT);
_bo[VERTINDEXBO] = new GLBufferObject(3,GL_INT);
_bo[VERTINDEXBO] = new GLBufferObject(3,GL_UNSIGNED_INT);
}
~GLMeshAttributesFeeder()
@ -282,11 +283,7 @@ namespace vcg
std::vector<bool> importattribute(_bo.size());
std::vector<bool> attributestobeupdated;
attributesToBeImportedInPointBasedPipeline(importattribute, nm, cm);
GLenum err = glGetError();
assert(err == GL_NO_ERROR);
bool immediatemode = !(buffersAllocationFunction(vaohandlespecificperopenglcontext,nm,cm,TX_NONE,importattribute,attributestobeupdated));
err = glGetError();
assert(err == GL_NO_ERROR);
std::vector<GLuint> textureindex;
if (immediatemode)
immediateMode(nm,cm,TX_NONE,textureindex);
@ -296,18 +293,8 @@ namespace vcg
for(size_t hh = 0;hh < attributestobeupdated.size();++hh)
somethingtoupdate = somethingtoupdate || attributestobeupdated[hh];
if (somethingtoupdate)
{
GLenum err = glGetError();
assert(err == GL_NO_ERROR);
updateBuffersIndexedPipeline(attributestobeupdated);
err = glGetError();
assert(err == GL_NO_ERROR);
}
err = glGetError();
assert(err == GL_NO_ERROR);
drawPoints(vaohandlespecificperopenglcontext);
err = glGetError();
assert(err == GL_NO_ERROR);
}
}
@ -505,7 +492,6 @@ namespace vcg
GLenum target = GL_ARRAY_BUFFER;
if (boname == VERTINDEXBO)
target = GL_ELEMENT_ARRAY_BUFFER;
glBindVertexArray(vaohandlespecificperopenglcontext);
bool notvalidbuttoberegenerated = (cbo != NULL) && (!cbo->_isvalid) && (importatt);
if (notvalidbuttoberegenerated)
@ -1035,8 +1021,6 @@ namespace vcg
}
case(VERTINDEXBO):
{
glIndexPointer(cbo->_gltype, 0, 0);
glEnableClientState(GL_INDEX_ARRAY);
break;
}
}
@ -1077,7 +1061,6 @@ namespace vcg
}
case(VERTINDEXBO):
{
glDisableClientState(GL_INDEX_ARRAY);
break;
}
}