Simple Vertex Arrays (i cant)
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
Try this:
[Resist Windows XP''s Invasive Production Activation Technology!]
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement