title: Separating Triangle Strips in Circular Annulus
body: <p>Given the problem description:</p>
  
  <p><a href="https://i.stack.imgur.com/uH1ax.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uH1ax.png" alt="problem_description"></a></p>
  
  <p>More specifically, the problem involves specifically the decorated annulus. The problem I am having is to separate the lightly shaded triangle from the dark shaded triangles. </p>
  
  <p>I have produced code (based on a previous example) that produces a circular annulus. However, the triangles are together rather than separate, and produce the same color.</p>
  
  <p>Here is the code that I have produced so far:</p>
  
  <pre><code>///////////////////////////////////////////////////////////////////////////////////////////        
  // circularAnnuluses.cpp
  //
  // This program draws three identical-looking circular annuluses in three different ways - 
  // see comments below.
  //
  // Interaction:
  // Press the space bar to toggle between wirefrime and filled for the lower annulus.
  // 
  // Sumanta Guha.
  /////////////////////////////////////////////////////////////////////////////////////////// 
  
  #include &lt;cstdlib&gt;
  #include &lt;cmath&gt;
  #include &lt;iostream&gt;
  
  #ifdef __APPLE__ 
  #  include &lt;GL/glew.h&gt; 
  #  include &lt;GL/freeglut.h&gt; 
  #  include &lt;OpenGL/glext.h&gt; 
  #else 
  #  include &lt;GL/glew.h&gt; 
  #  include &lt;GL/freeglut.h&gt; 
  //#  include &lt;GL/glext.h&gt; 
  #pragma comment(lib, "glew32.lib") 
  #endif 
  
  #define PI 3.14159265
  #define N 6.0 // Number of vertices on the boundary of the disc.
  
  using namespace std;
  
  // Globals.
  static int isWire = 0; // Is wireframe?
  
  
  // Drawing routine.
  void drawScene(void)
  {
      float angle;
      int i;
  
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the buffers including 
                                                          // the depth buffer.
  
      glPolygonMode(GL_FRONT, GL_FILL);
  
      // Lower circular annulus: with a true hole.
      if (isWire) glPolygonMode(GL_FRONT, GL_LINE); else glPolygonMode(GL_FRONT, GL_FILL);
      glBegin(GL_TRIANGLE_STRIP);
      for (i = 0; i &lt;= N; ++i)
      {
          angle = 2 * PI * i / N;
          glColor3f(1.0, 0.0, 0.0);
          glVertex3f(50 + cos(angle) * 10.0, 50 + sin(angle) * 10.0, 0.0);
          glColor3f(0, 1, 0);
          glVertex3f(50 + cos(angle) * 20.0, 50 + sin(angle) * 20.0, 0.0);
      }
      glEnd();
  
      // Write labels.
      glColor3f(0.0, 0.0, 0.0);
  
      glFlush();
  }
  
  // Initialization routine.
  void setup(void)
  {
      glClearColor(1.0, 1.0, 1.0, 0.0);
  }
  
  // OpenGL window reshape routine.
  void resize(int w, int h)
  {
      glViewport(0, 0, w, h);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0.0, 100.0, 0.0, 100.0, -1.0, 1.0);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
  }
  
  // Keyboard input processing routine.
  void keyInput(unsigned char key, int x, int y)
  {
      switch (key)
      {
      case ' ':
          if (isWire == 0) isWire = 1;
          else isWire = 0;
          glutPostRedisplay();
          break;
      case 27:
          exit(0);
          break;
      default:
          break;
      }
  }
  
  // Routine to output interaction instructions to the C++ window.
  void printInteraction(void)
  {
      cout &lt;&lt; "Interaction:" &lt;&lt; endl;
      cout &lt;&lt; "Press the space bar to toggle between wirefrime and filled for the lower annulus." &lt;&lt; endl;
  }
  
  // Main routine.
  int main(int argc, char** argv)
  {
      printInteraction();
      glutInit(&amp;argc, argv);
  
      glutInitContextVersion(4, 3);
      glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE);
  
      glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA | GLUT_DEPTH);
      glutInitWindowSize(500, 500);
      glutInitWindowPosition(100, 100);
      glutCreateWindow("DecoratedAnnulus.cpp");
      glutDisplayFunc(drawScene);
      glutReshapeFunc(resize);
      glutKeyboardFunc(keyInput);
  
      glewExperimental = GL_TRUE;
      glewInit();
  
      setup();
  
      glutMainLoop();
  }
  </code></pre>
  
  <p>The section of code where the problem lies is in the 'drawscene' function. I believe there should be two different for loops to separate the triangles from one another, but whenever I try to split the for loop it produces a monster of a shape.</p>
  
  <p>I'm not exactly sure where to begin to complete this last problem.</p>