Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define X 0,525731112119133606
- #define Z 0,850650808352039932
- Unit length vertices, t = (1 + sqrt(5))/2, s = sqrt(1 + t * t), t * s = sqrt(5 + 2 * sqrt(5)):
- v0 = (t, 1, 0)/s v3 = (−t, −1, 0)/s v6 = (−1, 0, t)/s v9 = (0, −t, 1)/s
- v1 = (−t, 1, 0)/s v4 = (1, 0, t)/s v7 = (−1, 0, −t)/s v10 = (0, t, −1)/s
- v2 = (t, −1, 0)/s v5 = (1, 0, −t)/s v8 = (0, t, 1)/s v11 = (0, −t, −1)/s
- //-----------------------------------------------------------------------
- static GLfloat vdata[12][3] = {
- {-X, 0.0, Z}, {X, 0.0, Z}, {-X, 0.0, -Z}, {X, 0.0, -Z},
- {0.0, Z, X}, {0.0, Z, -X}, {0.0, -Z, X}, {0.0, -Z, -X},
- {Z, X, 0.0}, {-Z, X, 0.0}, {Z, -X, 0.0}, {-Z, -X, 0.0}
- };
- static GLuint tindices [20][3] = {
- {1, 4, 0}, {4, 9, 0}, {4, 5, 9}, {8, 5, 4}, {1, 8, 4},
- {1, 10, 8}, {10, 3, 8}, {8, 3, 5}, {3, 2, 5}, {3, 7, 2},
- {3, 10, 7}, {10, 6, 7}, {6, 11, 7}, {6, 0, 11}, {6, 1, 0},
- {10, 1, 6}, {11, 0, 9}, {2, 11, 9}, {5, 2, 9}, {11, 2, 7},
- };
- int i;
- glBegin(GL_TRIANGLES);
- for(i=0; i<20;i++) {
- glColor3f(1.0,0.0,0.0);
- glVertex3fv(&vdata[tindices[i][0]][0]);
- glVertex3fv(&vdata[tindices[i][1]][0]);
- glVertex3fv(&vdata[tindices[i][2]][0]);
- }
- glEnd();
Advertisement
Add Comment
Please, Sign In to add comment