Oldani
01-14-2011, 06:39 AM
Hello,
i do have a problem that my program crashes on one hardware and on the other it works fine. The crashing hardware is a notebook: NVIDIA GeForce 8400M GS.
I thought I would make it easier if I create one buffer for each datatype: one buffer with GLfloat (for the colour, normals, uv-coordinates, vertex, ...) and one with GLboolean (for the edge-flags). As an alternative I could store everything in the same buffer but in this case I have to use the old c-functions with malloc and it is not that easy to have index-access to an element in the buffer ([]-operator) because the datatypes have different sizes (sizeoff(GLboolean) != sizeoff(GLfloat)). Therefore I stored each datatype in one separate buffer.
My program looks something like this:
...
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboID_Flt);
unsigned int sizeRowVbo = m_drawData.getSizeRowVbo();
unsigned int sizeRowVboByte = sizeRowVbo * sizeof(GLfloat);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeRowVboByte, offsetUv));
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, sizeRowVboByte, offsetColor));
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, sizeRowVboByte, offsetNormal));
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeRowVboByte, offsetVertex));
glBindBufferARB(GL_ARRAY_BUFFER_ARB, NULL);
glEnableClientState(GL_EDGE_FLAG_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboID_Bool);
glEdgeFlagPointer(sizeof(char), 0);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, NULL);
...
The problem is that it crashes on the GeForce 8400M when I try to unbind the buffer with the floats and bind the buffer with the edge-flags for setting the edgel-flag-pointer with glEdgeFlagPointer.
Is there a possibility to do it like this or do I have to bild just one buffer for each glDrawElements(...)?
Thank you.
i do have a problem that my program crashes on one hardware and on the other it works fine. The crashing hardware is a notebook: NVIDIA GeForce 8400M GS.
I thought I would make it easier if I create one buffer for each datatype: one buffer with GLfloat (for the colour, normals, uv-coordinates, vertex, ...) and one with GLboolean (for the edge-flags). As an alternative I could store everything in the same buffer but in this case I have to use the old c-functions with malloc and it is not that easy to have index-access to an element in the buffer ([]-operator) because the datatypes have different sizes (sizeoff(GLboolean) != sizeoff(GLfloat)). Therefore I stored each datatype in one separate buffer.
My program looks something like this:
...
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboID_Flt);
unsigned int sizeRowVbo = m_drawData.getSizeRowVbo();
unsigned int sizeRowVboByte = sizeRowVbo * sizeof(GLfloat);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeRowVboByte, offsetUv));
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, sizeRowVboByte, offsetColor));
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, sizeRowVboByte, offsetNormal));
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeRowVboByte, offsetVertex));
glBindBufferARB(GL_ARRAY_BUFFER_ARB, NULL);
glEnableClientState(GL_EDGE_FLAG_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboID_Bool);
glEdgeFlagPointer(sizeof(char), 0);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, NULL);
...
The problem is that it crashes on the GeForce 8400M when I try to unbind the buffer with the floats and bind the buffer with the edge-flags for setting the edgel-flag-pointer with glEdgeFlagPointer.
Is there a possibility to do it like this or do I have to bild just one buffer for each glDrawElements(...)?
Thank you.