Hi,
I am using glDrawArrays to draw Quads like this
glVertexPointer(3, GL_DOUBLE, sizeof(QV[0]), &QV[0][0])
glDrawArrays(GL_QUADS, 0, QV.size());
where QV is the list of vertices representing quads. Everything goes fine, until the size of QV exceeds the GL_MAX_ELEMENTS_VERTICES_WIN. If I understand correctly, this is the limit imposed on the no of vertices accepted by glDrawArrays.
So, i try to split my vertices into chunks as follows
[b]int MV;
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES_WIN, &MV);
int chunk_size = 10000; int start = 0;
cout<<" Trying to break up “<<QV.size()<<” vertices! limit = “<<MV<<”
";
while( start< QV.size()-1){
if( start + chunk_size > QV.size() )
chunk_size = QV.size() - start ;
cout<<" Trying to draw “<<chunk_size <<” elements starting from "<< start <<endl;
glDrawArrays(GL_QUADS, start, chunk_size );
start += chunk_size;
}[/b]
The output that I get is
[b]
Trying to break up 2478736 vertices! limit = 1048576
Trying to draw 10000 elements starting from 0
.
.
.
.
Trying to draw 10000 elements starting from 160000[/b]
and the code breaks. If i try breaking up a smaller set of vertices, it works fine, but for this particular dataset, the code always breaks, even if try to increase or decrease the chunk size. I am not quiet sure whats happening ?
I tried passing the vertex pointers in chunks as well,
glVertexPointer(3, GL_DOUBLE, sizeof(QV[0]), &QV[start][0]);
glDrawArrays(GL_QUADS, start, chunk_size);
Any help is appreciated. Thank You.
but the code breaks at the same place.