Computergrafik
GL Vertex Arrays
← GL Indexed Face Sets | ● | VBOs →
OpenGL Beispiel für Indexed Face Sets mit Vertex Arrays:
GLfloat vertex_list[] = {-1,-1,0,
1,-1,0,
1,1,0,
-1,1,0,
0,0,1.5};
glVertexPointer(3, GL_FLOAT, 0, vertex_list);
glEnableClientState(GL_VERTEX_ARRAY);
GLushort element_list[] = {0,1,4,
1,2,4,
2,3,4,
3,0,4,
3,2,1,0};
glDrawElements(GL_TRIANGLES, 4*3, GL_UNSIGNED_SHORT, element_list);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_SHORT, element_list+12);
1,-1,0,
1,1,0,
-1,1,0,
0,0,1.5};
glVertexPointer(3, GL_FLOAT, 0, vertex_list);
glEnableClientState(GL_VERTEX_ARRAY);
GLushort element_list[] = {0,1,4,
1,2,4,
2,3,4,
3,0,4,
3,2,1,0};
glDrawElements(GL_TRIANGLES, 4*3, GL_UNSIGNED_SHORT, element_list);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_SHORT, element_list+12);
← GL Indexed Face Sets | ● | VBOs →