Jump to content
  • Advertisement
Sign in to follow this  
sinoth

Segfault on second pass when using VBO

This topic is 3629 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

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:
     glGenBuffers(1,&vbo_cube_vertex);
     glGenBuffers(1,&vbo_cube_color);
     glGenBuffers(1,&vbo_cube_normal);

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 );

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

        glBindBuffer(GL_ARRAY_BUFFER,vbo_cube_normal);
        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);
        printf("done\n");

Rendering:
           glEnableClientState(GL_VERTEX_ARRAY);
           glEnableClientState(GL_NORMAL_ARRAY);
           glEnableClientState(GL_COLOR_ARRAY);

               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);

           glDisableClientState(GL_VERTEX_ARRAY);
           glDisableClientState(GL_COLOR_ARRAY);
           glDisableClientState(GL_NORMAL_ARRAY);

Share this post


Link to post
Share on other sites
Advertisement
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!