I should probably have mentioned that base.MakeCurrent() calls glBindBuffer(target, handle); where target is GL_ARRAY_BUFFER for VB and GL_ELEMENT_ARRAY_BUFFER for IB.
Vertex buffer and IndexBuffer inherits from BufferObject<T> which contains this behavior.
ApplyStdMaterial assigns element[i].attribute.
The offset value is a pointer to the first element in the structure, and not a real pointer. Maybe this is the wrong way to do it?
Here is a OpenGL Call only list of what happens in a normal draw operation:
glUseProgram(4);
glBindFragDataLocation(4, 1, "out_frag");
glBindBuffer(GL_ARRAY_BUFFER, 2);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, OpenGL.boolean.FALSE, 32, 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, OpenGL.boolean.FALSE, 32, 12);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 3);
glDrawElements(GL_TRIANGLES, 384, GL_UNSIGNED_INT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glUseProgram(0);
Here is the structure in use:
public struct VertexPositionTexCoordNormal
{
public Vector3 Position;
public Vector3 Normal;
public Vector2 TexCoord;
public static readonly VertexBufferDescriptor Descriptor = new VertexBufferDescriptor(
new ElementType[]
{
ElementType.Position3Float,
ElementType.Normal3Float,
ElementType.TexCoord2Float
}, typeof(VertexPositionTexCoordNormal));
}
This would be so much easier if I had an ATI card.
Thanks for all suggestions so far