Sign in to follow this  

Segfault on second pass when using VBO

Recommended Posts

Heya all, I'm having a peculiar problem with VBOs. I'm running my code on two computers, my main machine at home w/ GeForce 7800 and my computer at work which has some terrible Intel integrated card. I checked the extensions for the Intel card here and it supposedly does support ARB_VERTEX_BUFFER_OBJECT, and the drivers have been updated to the most recent version. The code runs fine on the Nvidia machine at home... no memory leaks (that I can tell) and silky smooth rendering. At work, however, the program segfaults on the SECOND frame. I can actually see the first frame rendered properly, then -poof- it dies the second time around. It seems to crap out on glDrawArrays(). The debugger points to the driver library (ig4icd32.dll) when it segfaults. I'm at a loss as to what could be causing this, so I present my code to you all for perusal :) Allocating buffers:

Initialization (done only ONCE):
        printf("buffering data to VBO... ");
        glBindBuffer(GL_ARRAY_BUFFER, vbo_cube_vertex);
        glBufferData( GL_ARRAY_BUFFER, i_quad_count*12*sizeof(GLfloat), va_vertex, GL_STATIC_DRAW );

        glBufferData( GL_ARRAY_BUFFER, i_quad_count*16*sizeof(GLfloat), va_color, GL_STATIC_DRAW );

        glBufferData( GL_ARRAY_BUFFER, i_quad_count*12*sizeof(GLfloat), va_normal, GL_STATIC_DRAW );

        // bind with 0, so, switch back to normal pointer operation
        glBindBuffer(GL_ARRAY_BUFFER, 0);


               glBindBuffer(GL_ARRAY_BUFFER, vbo_cube_vertex);         
                glVertexPointer(3, GL_FLOAT, 0, 0);

               glBindBuffer(GL_ARRAY_BUFFER, vbo_cube_normal);         
                glNormalPointer(GL_FLOAT, 0, 0);

               glBindBuffer(GL_ARRAY_BUFFER, vbo_cube_color);         
                glColorPointer(4, GL_FLOAT, 0, 0);

             glDrawArrays(GL_QUADS, 0, i_quad_count*4);

               glBindBuffer(GL_ARRAY_BUFFER, 0);


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