Sign in to follow this  

glBufferSubData / 0xC0000005 crash

Recommended Posts

Hi I trie to remove glMapBufferARB/glUnmapBufferARB pair from my code using glBufferSubData but i get crash every time i call this function. Here is VBO init part: First i create my mesh in memory. After i finish it looks like this
.---------------------------. - 0
|   Vertexy  - (float)XYZW  |
+---------------------------+ - sizeof(vertex)* vertex_count
|   Normal   - (float)XYZW  |
+---------------------------+ - sizeof(normal)* normal_count + sizeof(vertex)*vertex count
|   Color    - (float)RGBA  | 
+---------------------------+ - etc...
|   TexCoord - (float)XY    |

1 long bufer...
    glGenBuffersARB( 1, &_vboVertexId );
    glBindBufferARB( GL_ARRAY_BUFFER_ARB, _vboVertexId );
    glBufferDataARB( GL_ARRAY_BUFFER_ARB, reqMem, sourceBuffer, GL_DYNAMIC_DRAW_ARB );

    int retval = 0;
    glGetBufferParameterivARB( GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &retval );
    if( retval != reqMem )
        errorf( "glBufferDataARB failed to allocate any memory!\n" );
    glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );

then i modify (skinning) vertex and normals and trie to update them like this
        glBindBufferARB( GL_ARRAY_BUFFER_ARB, _vboVertexId );
        glBufferSubData( GL_ARRAY_BUFFER_ARB, 0, destSize, destData );
        glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );

destSize, destData are correct and contain data :/ I made a test like this one:
        glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboVertexId );
        glGetBufferParameterivARB( GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB,   &ret); cout << ret << endl;
        glGetBufferParameterivARB( GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB,  &ret); cout << ret << endl;
        glGetBufferParameterivARB( GL_ARRAY_BUFFER_ARB, GL_BUFFER_ACCESS_ARB, &ret); cout << ret << endl;
        glGetBufferParameterivARB( GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB,  &ret); cout << ret << endl;
        glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );

Of curse return values are as i expected: GL_BUFFER_SIZE_ARB = 11872 - that's correct value GL_BUFFER_USAGE_ARB = GL_DYNAMIC_DRAW_ARB GL_BUFFER_ACCESS_ARB = READ_WRITE_ARB GL_BUFFER_MAPPED_ARB = 0x00000000 Any idea what is wrong ??? Thanks for any halp [Edit] I made one more test:
        float test[10] = {1.f, 1.f, 1.f, 1.f, 1.f };

        glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboVertexId );
        glBufferSubData( GL_ARRAY_BUFFER_ARB, 0, sizeof(test), test );
        glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );

of curse it's crashing too ::cry::

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this