سؤال

What would be the best algorithm to generate a list of vertices to draw a plane using triangle strips?

I'm looking for a function which receives the plane's width and height and returns a float array containing correctly indexed vertices.

width represents the number of vertices per row.

height represents the number of vertices per column.

float* getVertices( int width, int height ) {
    ...
}

void render() {
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, 0, getVertices(width,heigth));
    glDrawArrays(GL_TRIANGLE_STRIP, 0, width*height);
    glDisableClientState(GL_VERTEX_ARRAY);
}

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top