• Advertisement

Archived

This topic is now archived and is closed to further replies.

Simple Vertex Arrays (i cant)

This topic is 5979 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement