• Create Account

## Simple Vertex Arrays (i cant)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1Marvin  Members

127
Like
Likes
Like

Posted 06 September 2001 - 08:47 AM

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

### #2Null and Void  Members

1087
Like
Likes
Like

Posted 06 September 2001 - 10:10 AM

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!]

### #3zedzeek  Members

528
Like
Likes
Like

Posted 06 September 2001 - 11:15 AM

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

### #4Marvin  Members

127
Like
Likes
Like

Posted 06 September 2001 - 11:47 PM

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.