VBO crashing with TAOFramework.

I’m doing a 3D display for a big object.

I’ve managed to display it with opengl primitives, so it’s (very) slow

Now i want to use the VBO optimization.
But when i lost the focus on the opengl window (even without hiding it), the display driver is blocked for some seconds (enough to shutdown my screens).

Could you help me.
Thanks.
The code is below
Flow

-> Code to load the object in VBO buffer

             currentwindows = new Windows3D();

            toquit = false;

            Gl.glGenBuffers(1, out VBOObject.VBOid);
            Gl.glBindBuffer(Gl.GL_ARRAY_BUFFER, VBOObject.VBOid);
            Gl.glVertexPointer(3, Gl.GL_FLOAT, 0, null);

            Gl.glBufferData(Gl.GL_ARRAY_BUFFER, (IntPtr)(VBOObject.count * 3 * sizeof(float)), VBOObject.xyz, Gl.GL_STATIC_DRAW);

            Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);						// Black Background
            Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);			// Set Perspective Calculations To Most Accurate
            Gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);						// Set The Color To White

            while (!toquit)
            {
                DrawGLScene();// Loop That Runs While done = false
                Gdi.SwapBuffers(hDC);

                Application.DoEvents();
                // Process Events

            }
            Gl.glDeleteBuffers(1,ref VBOObject.VBOid);
            Application.Exit();
            return;        

-> Display method.

    private void DrawGLScene()
        {
                    Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);        // Clear The Screen And The Depth Buffer
            Gl.glLoadIdentity();

            Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);

            Glu.gluLookAt(212, 60, 194, 186, 55, 171, 0, 1, 0);	// This Determines Where The Camera's Position And View Is

            Gl.glTranslatef(-ycentre, -xcentre, -zcentre);

            Gl.glBindBuffer(Gl.GL_ARRAY_BUFFER, VBOObject.VBOid);


            Gl.glVertexAttribPointer(0, 3, Gl.GL_FLOAT, Gl.GL_FALSE, 3 * sizeof(float), null);
            Gl.glEnableVertexAttribArray(0);

            Gl.glBindBuffer(Gl.GL_ELEMENT_ARRAY_BUFFER, 0);
            Gl.glDrawArrays(Gl.GL_QUADS, 0, VBOObject.count);

            Gl.glDisableVertexAttribArray(0);

            Gl.glDisableClientState(Gl.GL_VERTEX_ARRAY);
        }

One problem I see is you’re trying to use legacy vertex attributes and generic vertex attributes at the same time. These can interfere with each other. I suggest you’d use one or the other. That is, use these:

Generic vertex attributes:
gl{Enable,Disable}VertexAttribArray
glVertexAttribPointer

OR:
Legacy vertex attribute arrays:
gl{Enable,Disable}ClientState
gl{Vertex,Normal,Color,TexCoord,…}Pointer

You have to write your shader code and your app-side shader compile/link code to match which one you choose.