Getting black screen with DrawElements

Jan 2, 2014 at 9:51 PM
So, I have existing code that renders a model with per-vertex coloring by drawing each vertex individually using gl.Vertex(), as below:
OpenGL gl = openGLControl.OpenGL;

gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

gl.Begin(OpenGL.GL_TRIANGLES);

for (int i = 0; i < faces.Length; i += 3)
{
    int v1 = faces[i] * 3;
    int v2 = faces[i + 1] * 3;
    int v3 = faces[i + 2] * 3;

    gl.Color(colors[v1], colors[v1 + 1], colors[v1 + 2]);
    gl.Vertex(vertices[v1], vertices[v1 + 1], vertices[v1 + 2]);
    gl.Color(colors[v2], colors[v2 + 1], colors[v2 + 2]);
    gl.Vertex(vertices[v2], vertices[v2 + 1], vertices[v2 + 2]);
    gl.Color(colors[v3], colors[v3 + 1], colors[v3 + 2]);
    gl.Vertex(vertices[v3], vertices[v3 + 1], vertices[v3 + 2]);
}

gl.End();
I'm trying to improve the performance by using gl.DrawElements(), but after spending a couple of hours I haven't been able to get it working...the program compiles and runs, but the model is not drawn. Here is the code I am attempting to replace the above with:
OpenGL gl = openGLControl.OpenGL;

gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY);
gl.EnableClientState(OpenGL.GL_COLOR_ARRAY);

GCHandle vhandle = GCHandle.Alloc(vertices, GCHandleType.Pinned);
IntPtr vptr = vhandle.AddrOfPinnedObject();
gl.VertexPointer(3, OpenGL.GL_DOUBLE, 0, vptr);
GCHandle chandle = GCHandle.Alloc(colors, GCHandleType.Pinned);
IntPtr cptr = chandle.AddrOfPinnedObject();
gl.ColorPointer(3, OpenGL.GL_DOUBLE, 0, cptr);
GCHandle fhandle = GCHandle.Alloc(faces, GCHandleType.Pinned);
IntPtr fptr = fhandle.AddrOfPinnedObject();
gl.DrawElements(OpenGL.GL_TRIANGLES, faces.Length, OpenGL.GL_INT, fptr);

fhandle.Free();
chandle.Free();
vhandle.Free();

gl.DisableClientState(OpenGL.GL_COLOR_ARRAY);
gl.DisableClientState(OpenGL.GL_VERTEX_ARRAY);
Any ideas what the issue might be?