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; } }
void initRendering() ///////////////////////////////////////////////////////////////////////////////////////// { glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); setupPointers(); }
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; } }
void init(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_SMOOTH); setupPointers(); }