openGLへの呼び出しを減らすことについて多くの情報を見てきましたが、パイプラインを十分に理解していません。VBOを完全に前倒しで設定できますか?具体的には、この例を使用して、VBOをセットアップし、各フレームが描画呼び出しの前に有効化/ポインターセットアップを呼び出します。VBOは、作成時に有効化/ポインター設定で完全に設定できますか?
このようなもの
Data_Init_Func(...)
{
....
glGenBuffers(1, &IndexVBOID);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexVBOID);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, SizeInBytes, NULL, GL_STATIC_DRAW);
short pindices[YYY];
pindices[0]=0;
pindices[1]=5;
//etc...
offsetInByte=0;
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, offsetInByte, SizeInBytes, pindices);
glGenBuffers(1, VertexVBOID);
glBindBuffer(GL_ARRAY_BUFFER, VertexVBOID);
glBufferData(GL_ARRAY_BUFFER, SizeInBytes, NULL, GL_STATIC_DRAW);4
//data creation and binding
...
// Normally it seems like this code is PER FRAME... DOES IT NEED TO BE?
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 64, BUFFER_OFFSET(0));
glNormalPointer(GL_FLOAT, 64, BUFFER_OFFSET(12));
glClientActiveTexture(GL_TEXTURE0);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); //Notice that after we call
glClientActiveTexture, we enable the array
glTexCoordPointer(2, GL_FLOAT, 64, BUFFER_OFFSET(24));
glClientActiveTexture(GL_TEXTURE1);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); //Notice that after we call
glClientActiveTexture, we enable the array
glTexCoordPointer(2, GL_FLOAT, 64, BUFFER_OFFSET(32));
glClientActiveTexture(GL_TEXTURE2);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); //Notice that after we call
glClientActiveTexture, we enable the array
glTexCoordPointer(2, GL_FLOAT, 64, BUFFER_OFFSET(40));
...
}
Draw(...)
{
glBindBuffer(GL_ARRAY_BUFFER_ARB, VertexVBOID); // for vertex coordinates
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); // for indices
// DO I NEED TO CALL THE VERTEX ENABLING/POINTER SETUP HERE?
// draw 6 quads using offset of index array
glDrawRangeElements(GL_TRIANGLES, x, y, z, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
...
}