main(int argc, char** argv) { glutInit(&argc, argv); /* need both double buffering and z buffer */ char *title = "Scott Wilson Park"; if(argc > 1) { title = *(argv + 1); } glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowPosition(250,50); glutInitWindowSize(600, 600); glutCreateWindow(title); initDisplayLists(); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutIdleFunc(swingAnim); glutKeyboardFunc(keyboard); glEnable(GL_DEPTH_TEST); /* Enable hidden--surface--removal */ glutMainLoop(); }
void Light::setAttenuation(float c, float l, float q) { constAtt = c; linAtt = l; quadAtt = q; initDisplayLists(); }
void Light::setSpecular(float r, float g, float b) { specular[0] = r; specular[1] = g; specular[2] = b; initDisplayLists(); }
void Light::setDiffuse(float r, float g, float b) { diffuse[0] = r; diffuse[1] = g; diffuse[2] = b; initDisplayLists(); }
void Light::setAmbient(float r, float g, float b) { ambient[0] = r; ambient[1] = g; ambient[2] = b; initDisplayLists(); }
// Implémentation classique du pattern singleton View::View() { model = Model::getInstance(); glClearColor(0.0,0.0,0.0,0); // Définit la couleur à utiliser lors des appels à glClear(...) initDisplayLists(); // initialisation des display lists }
Light::Light(int name) { this->name = name; ambient[0]=1.0; ambient[1]=1.0; ambient[2]=1.0; ambient[3]=1.0; diffuse[0]=1.0; diffuse[1]=1.0; diffuse[2]=1.0; diffuse[3]=1.0; specular[0]=1.0; specular[1]=1.0; specular[2]=1.0; specular[3]=1.0; constAtt = 1.0; linAtt = 0.0; quadAtt = 0.0; initDisplayLists(); }
int main (int argc, char **argv) { glutInit (&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); if (isGameMode) { glutGameModeString ("1024x768:32"); if (glutGameModeGet (GLUT_GAME_MODE_POSSIBLE)) glutEnterGameMode (); else isGameMode = 0; } if (!isGameMode) { glutInitWindowSize (1024, 768); glutCreateWindow ("tetris"); } initWindow (); initDisplayLists (); glutMainLoop (); return 0; }