Simple Vertex Arrays (i cant)

Started by
2 comments, last by Marvin 22 years, 7 months ago
Im trying to get the most basic vertex arrays working (so i can use them in my engine), but i cant even get the simplest vertex arrays working. Bellow is what im trying, i must be doing something very wrong that i hope a pro can spot GLfloat test[] = {0.0f,2.0f,0.0f, 1.0f,0.0f,0.0f -1.0f,0.0f,0.0f}; GLuint index[] = {0,1,2}; glVertexPointer(3, GL_FLOAT, 0, test); glEnableClientState(GL_VERTEX_ARRAY); glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, index); Even better could someone post complete code (well minus framework) for rendering a single triangle using vertex arrays
Advertisement
Try this:
  GLfloat test[] = {0.0f,2.0f,0.0f,1.0f,0.0f,0.0f-1.0f,0.0f,0.0f};glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3, GL_FLOAT, 0, test);glDrawArrays(GL_TRIANGLES, 0, 3);  



[Resist Windows XP''s Invasive Production Activation Technology!]
both methods should work

try this

GLfloat test[] = {0.0f,2.0f,0.0f,
1.0f,0.0f,0.0f
-1.0f,0.0f,0.0f};

glBegin( GL_TRIANGLES );
glVertex3fv( &test[0] );
glVertex3fv( &test[3] );
glVertex3fv( &test[6] );
glEnd();

if this doesnt work then the problem doesnt lie with the vertex arrays
I tried as posted by Zedzeek last night, and still didnt have a damn thing rendered, i found the problem to lie in the near clipping plane, thanks for the help

This topic is closed to new replies.

Advertisement