Wrong vertices drawing with VBO with glDrawArrays

Hi All,
I have a problem I do not understand. The following code works in a simple test program on AMD - in a more complex program something is affecting glDrawArrays offset index.

The code works correctly in both programs on nVidia

glGenBuffers(1, &id);
glBindBuffer(GL_ARRAY_BUFFER, id);
glVertexAttribPointer(VERTEX_BINDINGS_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(C3D_VertexC), 0);
glEnableVertexAttribArray(VERTEX_BINDINGS_POSITION);
glVertexAttribPointer(VERTEX_BINDINGS_COLOUR, 4,GL_UNSIGNED_BYTE, GL_TRUE,sizeof(C3D_VertexC),(const void*)(sizeof(float)*3));
glEnableVertexAttribArray(VERTEX_BINDINGS_COLOUR);

{
C3D_VertexC v[20];
for (int i = 0; i < 5; i++)
{
float x = (float)i;
v[i].x = (x-10.0f)/10.0f;
v[i].y = 0;
v[i].z = 0;
v[i].rgba = 255;
}
glBufferData(GL_ARRAY_BUFFER, sizeof(C3D_VertexC)*20, NULL, GL_STATIC_DRAW);

// this draws the 5 points in the correct location on the screen
// glBufferSubData(GL_ARRAY_BUFFER, sizeof(C3D_VertexC)*12, // sizeof(C3D_VertexC)*5, v);

// all verices drawn at 0,0,0 in black
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(C3D_VertexC)*5, v);
}

glDrawArrays(GL_POINTS, 0, 5);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(1,&id);

What can affect the first vertex used in glDrawArrays?

I suggest that you call glBindBuffer followed by glVertexAttrib calls before you draw.

Also, instead of v, try &v[0].x.

Make sure that other arrays are disabled such as texcoord and color.

Thanks V-man,
I have done all those changes but it has had no effect.

I assume this is what you meant about disabling attributes

glBindBuffer(GL_ARRAY_BUFFER, id);

glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&maxAttributes);
for (int i = 0; i < maxAttributes; i++)
glDisableVertexAttribArray(i);

glVertexAttribPointer(VERTEX_BINDINGS_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(C3D_VertexC), 0); glEnableVertexAttribArray(VERTEX_BINDINGS_POSITION);
glVertexAttribPointer(VERTEX_BINDINGS_COLOUR, 4,GL_UNSIGNED_BYTE, GL_TRUE,sizeof(C3D_VertexC),(const void*)(sizeof(float)*3));
glEnableVertexAttribArray(VERTEX_BINDINGS_COLOUR);
glDrawArrays(GL_POINTS, 0, 5);

The problem seems to be caused by using this code prior to the above code

glBindBuffer(GL_DRAW_INDIRECT_BUFFER,c_DrawCommands);

glDrawElementsIndirect(GL_TRIANGLES,GL_UNSIGNED_INT,(void* (p_Object*sizeof(C3D_DrawElementsIndirectCommand)));

glBindBuffer(GL_DRAW_INDIRECT_BUFFER,0);

I changed this to

glDrawElementsIndirect(GL_TRIANGLES,GL_UNSIGNED_INT,&c_DrawCommand[p_Object]);

and the code now works