PDA

View Full Version : Crazy VBOs



HellKnight
01-05-2006, 04:40 AM
Ok, this is really driving me insane. Look at these two functions:



#if 0
//DRIVER BUG??
void DrawArrays(void)
{
int i;

for(i = 0; i < world_apd.num_shaders; i++)
re->DrawIndexedArrayRange(world_v_buffer, world_i_buffer, index_refs[i], num_shader_indices[i]);
}
#else
void DrawArrays(void)
{
vertex_t *verts;
int *indices;

int i, j;

indices = re->MapGeometryArray(GT_INDEX_ARRAY, world_i_buffer, GL_READ_WRITE_ARB);

glBegin(GL_TRIANGLES);

for(j = 0; j < world_apd.num_shaders; j++)
{
for(i = index_refs[j]; i < index_refs[j] + num_shader_indices[j]; i++)
{

glArrayElement(indices[i]);
}
}

glEnd();

re->UnmapGeometryArray(GT_INDEX_ARRAY, world_i_buffer);
}
#endif

If I update the vertex buffer object and then call the first function, the GL draws some weird polygons as if I didn't specify the vertices right... However, this isn't the case, since the second one functions properly all the time. I'm not unbinding the VBOs, the alignment is right, there's no difference between Map()'ing and BufferData()'ing the vertex buffer object, it just seems like a driver bug (81.95, GF6600GT, Athlon64) to me...

Any ideas?

Regards,
-phil.

Mikkel Gjoel
01-05-2006, 01:30 PM
The only thing you didn't mention was pointer-calls, so I'm going to ask about those.
*ahem*
Do you use make all the correct pointer-calls? :) Ie. glVertexPointer(..), glNormalPointer(..) etc. Do you only store element-indices in a VBO, or do you also store vertex-data (positions, normals)? I actually experienced this exact same problem a couple of months ago, and AFAIR it was me forgetting to unbind/unmap/setup-some-pointer. I'll post again if I remember the exact problem :D

Good luck!