Exemplo n.º 1
0
void mouse (int button, int state, int x, int y)
{
   switch (button) {
      case GLUT_LEFT_BUTTON:
         if (state == GLUT_DOWN) {
            if (setupMethod == POINTER) {
               setupMethod = INTERLEAVED;
               setupInterleave();
            }
            else if (setupMethod == INTERLEAVED) {
               setupMethod = POINTER;
               setupPointers();
            }
            glutPostRedisplay();
         }
         break;
      case GLUT_MIDDLE_BUTTON:
      case GLUT_RIGHT_BUTTON:
         if (state == GLUT_DOWN) {
            if (derefMethod == DRAWARRAY) 
               derefMethod = ARRAYELEMENT;
            else if (derefMethod == ARRAYELEMENT) 
               derefMethod = DRAWELEMENTS;
            else if (derefMethod == DRAWELEMENTS) 
               derefMethod = DRAWARRAY;
            glutPostRedisplay();
         }
         break;
      default:
         break;
   }
}
Exemplo n.º 2
0
static void init(void)
{
   glClearColor(0.0, 0.0, 0.0, 1.0);
   glShadeModel(GL_SMOOTH);
   switch (setupMethod) {
   case POINTER:
       setupPointers();
       break;
   case INTERLEAVED:
       setupInterleave();
       break;
   }
}