Quote:Original post by EnigmaI'd be more suspicious of the glDrawRangeElements call, particularly the end parameter. I assume you've set up your GL_ELEMENT_ARRAY_BUFFER correctly and bound it? With your start and end parameters as they are you're stating that for every element in your GL_ELEMENT_ARRAY_BUFFER (element >= 0 && element <= m_Quads.m_VertexIndex.size()), which is probably true but only because there tend to be as many or more indicies than vertices (otherwise you have unused vertices).
I'm generating my VBOs using:
glGenBuffersARB(1, &m_CoordinateVboName);glBindBufferARB(GL_ARRAY_BUFFER, m_CoordinateVboName);glBufferDataARB(GL_ARRAY_BUFFER, m_Vertices.size() * 3 * sizeof(float), &m_Vertices[0], GL_DYNAMIC_DRAW);glGenBuffersARB(1, &m_Quads.m_VertexIndexVboName);glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, m_Quads.m_VertexIndexVboName);glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER, m_Quads.m_VertexIndex.size() * sizeof(unsigned int), &m_Quads.m_VertexIndex[0], GL_DYNAMIC_DRAW);
When I go to draw, I use:
glBindBufferARB(GL_ARRAY_BUFFER, m_CoordinateVboName);glVertexPointer(3, GL_FLOAT, sizeof(Vertex), &(((Vertex *) 0)->m_Coordinate));glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, m_Quads.m_VertexIndexVboName);glDrawRangeElements(GL_QUADS, 0, m_Quads.m_VertexIndex.size(), m_Quads.m_VertexIndex.size(), GL_UNSIGNED_INT, NULL);
Quote:Right now you're passing 0x00000004 as the start of the index information, which GL will try to read, generating an access violation as 0x00000004 is a protected memory location.
Isn't this what I do anyways, when there isn't an offset? In my old version, I was simply using a plain old array. My offset was 0, so I had:
glVertexPointer(3, GL_FLOAT, 0, 0);
Now my offset is 4 bytes, so why shouldn't the 4th paramter be 4?