PDA

View Full Version : Multiples VBOs



Coluna
02-12-2004, 03:07 AM
Hi;
Im using vbos for animated models (with GL_DYNAMIC_DRAW_ARB), and as i use normals, texcoords and the verts, i have 3 vbos for the main instance of each kind of model (for example the orc model)...how can i bind each one,as we do glVertexArray(vert), glTexCoordArray(texcoords) ? should i put them all in a single vbo or is it possible to have three independent vbos? thanx

al_bob
02-12-2004, 06:08 AM
It's possible to have 3 VBOs. You basically use them like:



glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
glVertexPointer(..., offset_in_vbo_0);
glBindBuffer(GL_ARRAY_BUFFER, vbo[1]);
glTexCoordPointer(..., offset_in_vbo_1);
glBindBuffer(GL_ARRAY_BUFFER, vbo[2]);
glColorPointer(..., offset_in_vbo_2);
/* etc */

Coluna
02-12-2004, 06:54 AM
Thanx!! another question....with GL_DYNAMIC_DRAW_ARB my VBO is slower than simple VA ...
im doing
//init
glBufferDataARB( GL_ARRAY_BUFFER_ARB, MAX_FLOATS_VBO*sizeof(GLfloat), NULL, GL_DYNAMIC_DRAW_ARB );
//
//loop
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, size, array_vbo);
glDrawArrays(GL_TRIANGLES,0,num_faces*3);

is there any problem?