GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Monday, March 14, 2011

OpenGL - Vertex Array

Beside vertex arrays, there's also:
GL_COLOR_ARRAY, 
GL_INDEX_ARRAY, 
GL_NORMAL_ARRAY, 
GL_TEXTURE_COORD_ARRAY, and 
GL_EDGE_FLAG_ARRAY

The first is that you call this function for enable the array:
glEnableClientState(GL_VERTEX_ARRAY);

Then you set the data:
static GLint data[] = {
    1, 1,
    3, 3,
    5, 1
};

After finishing it, try
glVertexPointer(2, GLint, 0, data);

Then the last is:
glBegin(GL_TRIANGLES);
    glArrayElement(2);
glEnd();

See more on: http://glprogramming.com/red/chapter02.html
Share/Bookmark

No comments:

Post a Comment