Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by aaa ( 6 years ago )
int color = 0;
float PI = atan(1.0) * 4.0;
float a, b, x, y, z;
float da = 6.0, db = 6.0;
float radius = 1.0;
for (a = -90.0; a + da <= 90.0; a += da) {
  glBegin(GL_QUAD_STRIP);
  for (b = 0.0; b <= 360.0; b += db) {
    if (color) {
      glIndexi(RED);
      glColor3f(1, 0, 0);
    } else {
      glIndexi(WHITE);
      glColor3f(1, 1, 1); {
        x = radius * cos(b * PI / 180) * cos(a * PI / 180);
        y = radius * sin(b * PI / 180) * cos(a * PI / 180);
        z = radius * sin(a * PI / 180);
        glVertex3f(x, y, z);
        x = radius * cos(b * PI / 180) * cos((a + da) * PI / 180);
        y = radius * sin(b * PI / 180) * cos((a + da) * PI / 180);
        z = radius * sin((a + da) * PI / 180);
        glVertex3f(x, y, z);
        color = 1 - color;
      }
      glEnd();
    }

 

Revise this Paste

Your Name: Code Language: