arrays not seenable

hello,

i would like to use arrays but i failed.
i’ve done it like this:

float v[]={0,0,0, 10,10,10, 20,20,20,
30,30,30, 40,40,40, 50,50,50};
int i[]={0,1,2,3,4,5};

glEnableClientState( GL_VERTEX_ARRAY);
glVertexArray( GL_FLOAT, 0, &v[0]);
glDrawElements( GL_TRIANGLES, 2, &i[0]);

But nothing is seen at the screen !!

help me please !

I never heard of glVertexArray function!

-Lev

1: The function to set vertex pointer is called glVertexPointer and takes five parameters.
2: The second parameter in glDrawElements is the number of vertices to draw from the vertex arrays. Drawing a triangle using two vertices won’t produce anything, since a triangle requires three vertices.

That’s it.

void VertexPointer ( int size, enum type, sizei stride, void *pointer ) ;

void DrawElements ( enum mode, sizei count, enum type, void *indices );

This link may be interesting:
http://www.opengl.org/developers/documentation/Specs/glspec1.1/node21.html?Vertex+Arrays#first_hit

-nemesis-

OK, is this better ? (i still haven’t time to test)

float v[]={0,0,0, 10,10,10, 20,20,20,
30,30,30, 40,40,40, 50,50,50};
int i[]={0,1,2,3,4,5};

glEnableClientState( GL_VERTEX_ARRAY);
glVertexPointer( 3, GL_FLOAT, 0, &v[0]);
glDrawElements( GL_TRIANGLES, 3, UNSIGNED_INT, &i[0]);
glDisableClientState( GL_VERTEX_ARRAY);

thanks

Well, apart from the fact that you missed a GL_ before UNSIGNED_INT in glDrawElements, that looks a whole lot better.