nature of VBOs

Hello everyone.

I am fairly new to opengl and I’ve used it so with far with C for rendering 2D sprites in immediate mode. I have looked over VBOs
a bit and it appears that everything in the VBO is drawn at once (possibly in parallel by all available graphics cores). It seems
to me that this is exponentially more efficient than anything I’m doing.

My questions are:
[li]Can individual elements in a VBO (like the nth ‘rotation’ float in the VBO) be modified in my ‘animate’ and ‘detect_collisions’ functions or are all of these changed at once. (see below).
[/li][li]How should I set up my structs to easily fill in the VBO in say a create_VBO_from_sprites(sprite_Array) function.

Here’s the basic setup I’m using which works well so far on even weaker laptops with integrated GPUs:

a sprite is defined:

typdef struct
   Texture* image;

   GLfloat width;
   GLfloat height;
   GLfloat xcoords[4];  // x vertices
   GLfloat ycoords[4];  // y vertices
   GLfloat rotation;      // in degrees
   GLfloat xdir;            // direction of travel x
   GLfloat ydir;            // direction of travel y

In my idle function, I go through all sprites and do

//get start time 't0'


// get time 't1' = time since 't0'
// get difference 'gap' between 't1' and wanted refresh of 16.667 mlsec (60 frames per second)


This basically just updates the vertices ‘xcoords’, ‘ycoords’ based on new values of ‘rotation’, ‘xdir’ and ‘ydir’. If a
collision is detected, the values of ‘rotation’, ‘xdir’, and ‘ydir’ are all changed based on some physics I will not write

My display function simply draws the textures based on the ‘xcoords’ and ‘ycoords’ settings

for(GLuint i=0; i<sizeof(sprite_Array); i++)
   Sprite* sp = sprite_Array[i];

   glBindTexture(GL_TEXTURE_2D, sp->image->ID);
   glColor4f(1, 1, 1, sp->alpha);
   glTexCoord2i(0, 0); glVertex2f(sp->xcoords[0], sp->ycoords[0]);
   glTexCoord2i(1, 0); glVertex2f(sp->xcoords[1], sp->ycoords[1]);
   glTexCoord2i(1, 1); glVertex2f(sp->xcoords[2], sp->ycoords[2]);
   glTexCoord2i(0, 1); glVertex2f(sp->xcoords[3], sp->ycoords[3]);

Yes, you can edit individual elements in a VBO. See glBufferSubData. There is also glMapBuffer and glUnmapBuffer.
Also glMapBufferRange.
There is an extensive page in the Wiki

You can draw from any part of a VBO. It is your choice.

Why store rotation in a VBO? It looks like you aren’t using shaders. If you write a shader and decide to rotate your vertex in your vertex shader, then it makes sense to have a rotate value in your VBO.

Normally, people declare a vertex structure. See

the part that starts with
struct Vertex { GLfloat position[3];