   VBO not rendering
  Hi all,I've spent the last couple of days reading up on VBOs and I've run into a wall implementing them: namely, they're not rendering. At all.I'm working with C plus plus (why is the plus character stripped in posts??), SFML, and GLEW. GLEW tells me GLEW_ARB_vertex_buffer_object is supported (i.e. it evaluates to true in an if statement), so I'd have thought I'm all good there. I'll spare you the details of how I'm generating my triangles; suffice it to say that I'm pretty sure the data is correct as I can render it in immediate mode without any problem.Potentially relevant stuff:- I'm using interleaved data. AFAICT I'm passing in my stride parameter correctly.- I'm just using "straight" vertex buffers, not indexed ones, so I'm using glDrawArrays(). I think this is right?Onto the code, then. My vertex buffer is a std::vector of these (HVector3 contains three floats and no other members, just the usual vector functions):struct HTerrainVertex{HVector3 vPosition;HVector3 vNormal;};At initialise time, I'm doing the following://Generate a vertex buffer and bind it.glGenBuffersARB(1, &m_VertexBufferID);glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_VertexBufferID);//Just allocate the buffer for now.glBufferDataARB( GL_ARRAY_BUFFER_ARB, m_VertexBuffer.size() * sizeof(HTerrainVertex), NULL, GL_STATIC_DRAW_ARB );//Then copy across our data.glBufferSubDataARB( GL_ARRAY_BUFFER_ARB, 0, m_VertexBuffer.size() * sizeof(HTerrainVertex), &(m_VertexBuffer[0]) );//Note the stride value here, since I'm temporarily not using normals until I can get stuff rendered.glVertexPointer( 3, GL_FLOAT, sizeof(HVector3), 0 );And in my render function, after the whole business of getting the ModelView matrix in the right place://Bind to our buffer.glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_VertexBufferID);//Enable magic.glEnableClientState(GL_VERTEX_ARRAY);//Define our vertex pointer. Stride jumps over the normals for now.glVertexPointer( 3, GL_FLOAT, sizeof(HVector3), 0 );//Draw.glDrawArrays( GL_TRIANGLES, 0, (int)m_VertexBuffer.size() );//Disable magic.glDisableClientState(GL_VERTEX_ARRAY);I assume I've just missed something really stupid, but having read a million tutorials I can't figure out for the life of me what. Can someone point out the one little thing I'm doing (or not) which is stopping it from working, so I can kick myself for it, please?Also, when should I unbind the buffer? At the end of each frame, or at the end of the object's lifetime (which is application exit, for me)?Cheers,-Floomi   
  Oh, bum. I know why. It's because my vector class allocates its array of floats on the heap. What the hell was I thinking?Also my stride was wrong, it should have been sizeof(HTerrainVertex).[Edited by - Floomi on August 7, 2010 1:23:28 PM];Also, when should I unbind the buffer? At the end of each frame, or at the end of the object's lifetime (which is application exit, for me)?[/qoute]At the end of each frame.;  Fantastic, thanks a lot :)   