Hi, all!
I'm trying to draw a square as a pair of triangles. I'm using glDrawElements, but the program crashes!
What did I do wrong?
==========================================
GLshort vertex[] =
{
0,0,
0,50,
50,50,
50,0
};

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, vertex);

GLubyte index[] = { 0,1,2, 0,2,3};
glDrawElements( GL_TRIANGLE_FAN, 6, GL_UNSIGNED_BYTE, index ); // Crash, but if I write glDrawArrays it works!

glDisableClientState(GL_VERTEX_ARRAY);
==========================================

Thank you!