Ternary
03-17-2011, 08:51 AM
I have a very large array of GL_TRIANGLES that I am giving to gl with glBindBuffer/glBufferData. I then draw them with glDrawElements. The last 20,000 or so triangles are not drawn.
Here is some pseudo code
glGenBuffers(1, &posName);
glBindBuffer(GL_ARRAY_BUFFER, posName);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*posDataLen, posData, GL_STATIC_DRAW);
glGenBuffers(1, &idxName);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxName);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)*idxDataLen, idxData, GL_STATIC_DRAW);
glEnableVertexAttribArray(AttributePosition);
glBindBuffer(GL_ARRAY_BUFFER, posName);
glVertexAttribPointer(AttributePosition, 3, GL_FLOAT, GL_FALSE, 0, 0);
glDrawElements(GL_TRIANGLES, idxDataLen, GL_UNSIGNED_INT, 0);
In the position data there are 1,300,556 vertices.
In the index data there are 2,522,028 indices.
This makes for 840676 triangles.
If I split the data in two it draws fine.
If I don't generate the first 20,000 triangles into the list the 20,000 extra triangle at the end of the list draw fine.
Is there a size constraint associated with glBindBuffer, glDrawElements or somewhere else I cannot find?
Here is some pseudo code
glGenBuffers(1, &posName);
glBindBuffer(GL_ARRAY_BUFFER, posName);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*posDataLen, posData, GL_STATIC_DRAW);
glGenBuffers(1, &idxName);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxName);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)*idxDataLen, idxData, GL_STATIC_DRAW);
glEnableVertexAttribArray(AttributePosition);
glBindBuffer(GL_ARRAY_BUFFER, posName);
glVertexAttribPointer(AttributePosition, 3, GL_FLOAT, GL_FALSE, 0, 0);
glDrawElements(GL_TRIANGLES, idxDataLen, GL_UNSIGNED_INT, 0);
In the position data there are 1,300,556 vertices.
In the index data there are 2,522,028 indices.
This makes for 840676 triangles.
If I split the data in two it draws fine.
If I don't generate the first 20,000 triangles into the list the 20,000 extra triangle at the end of the list draw fine.
Is there a size constraint associated with glBindBuffer, glDrawElements or somewhere else I cannot find?