Hi
I am hunting down bugs in my app, and now it seems to be related with index arrays in video memory, so i open up a new thread for this.
I have two VBOs. One for data, one for indices. If i bind both and issue a drawcall, it runs flawlessly on ATI, but crashes immediately on nVidia.
If i don’t put the index array into a VBO, it also runs as expected on nVidia.
Here is my Code:
Setup:
------
glGenBuffers (1, &m_uiVertexBufferID);
glBindBuffer (GL_ARRAY_BUFFER_ARB, m_uiVertexBufferID);
glBufferData (GL_ARRAY_BUFFER_ARB, m_uiElementSize * uiVertexCount, (void*) &m_pInterleavedData[0], GL_STATIC_DRAW);
glGenBuffers (1, &m_uiIndexBufferID);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, m_uiIndexBufferID);
glBufferData (GL_ELEMENT_ARRAY_BUFFER, iIndices * sizeof (int), (void*) &m_pIndices[0], GL_STATIC_DRAW);
Bindbuffer:
-----------
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, m_uiIndexBufferID);
glBindBuffer (GL_ARRAY_BUFFER_ARB, m_uiVertexBufferID);
for (int i=1; i < max; ++i)
{
glEnableVertexAttribArray (i);
glVertexAttribPointer (i, ...);
}
// array 0 is set LAST, as nVidia advises in their paper about VBOs
glEnableVertexAttribArray (0);
glVertexAttribPointer (0, ...);
Render:
-------
Bindbuffer ();
// this crashes
glDrawElements (GL_TRIANGLES, uiCount, GL_UNSIGNED_INT, BUFFER_OFFSET (uiFirstVertex * sizeof (int)));
// this works just fine
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
glDrawElements (GL_TRIANGLES, uiCount, GL_UNSIGNED_INT, &m_pIndices[uiFirstVertex]);
It seems, as if the driver doesn’t like indices to lay in video memory.
This is on a Geforce 7600 GT, Forceware 93.71.
On an ATI Radeon X1600 Mobility it runs just fine. Tried several different setups, changing the order of execution, etc. didn’t change anything. The moment i put the Indexdata into a VBO it crashes on nVidia.
Thanks,
Jan.