Here is the error: "Unhandled exception at 0x00c0ff8b in Primitives.exe: 0xC0000005: Access violation writing location 0x00000004."
The error occurs in this chunk of code inside GLBatch.cpp on the line "nNumVerts = nVerts;":
// Start the primitive batch.
void GLBatch::Begin(GLenum primitive, GLuint nVerts, GLuint nTextureUnits)
{
primitiveType = primitive;
nNumVerts = nVerts;
if(nTextureUnits > 4) // Limit to four texture units
nTextureUnits = 4;
nNumTextureUnits = nTextureUnits;
if(nNumTextureUnits != 0) {
uiTextureCoordArray = new GLuint[nNumTextureUnits];
// An array of pointers to texture coordinate arrays
pTexCoords = new M3DVector2f*[nNumTextureUnits];
for(unsigned int i = 0; i < nNumTextureUnits; i++) {
uiTextureCoordArray = 0;
pTexCoords = NULL;
}
}
// Vertex Array object for this Array
#ifndef OPENGL_ES
glGenVertexArrays(1, &vertexArrayObject);
glBindVertexArray(vertexArrayObject);
#endif
}
Here is my code that calls this GLBatch::Begin():
temp->Begin(GL_TRIANGLES, 3);
temp->CopyVertexData3f(vertices);
temp->End();
batches.push_back(*temp);
Does anyone have an idea what's causing the problem? It's probably something very simple