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