Jump to content
  • Advertisement
Sign in to follow this  
Estor

glBufferSubData / 0xC0000005 crash

This topic is 4695 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
You might have forgotten to initialize the function pointer. I also noticed that you're using the ARB suffix for every function (i.e. glBindBufferARB), except glBufferSubData. Try glBufferSubDataARB.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!