void XMLScene::display() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); axis.draw(); activeCamera->applyView(); for(unsigned int i=0;i<sceneLights.size();i++) { if(activeLights[i]==1) { sceneLights[i]->enable(); sceneLights[i]->draw(); } else sceneLights[i]->disable(); sceneLights[i]->update(); } axis.draw(); selectDrawMode(); drawObjects(); glutSwapBuffers(); }
void XMLScene::display() { static int i=0; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //axis.draw(); /* glMatrixMode(GL_PROJECTION); glLoadIdentity(); int viewport[]={0,0,0,0}; glGetIntegerv(GL_VIEWPORT,viewport); glViewport(0,0,viewport[2],viewport[3]); //file->sceneCameras[camera].second->updateProjectionMatrix(viewport[2],viewport[3]); file->sceneCameras[camera].second->applyView(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); */ //activeCamera->setZ(-20); activeCamera->applyView(); printScoreBoard(); //draw lights selectDrawMode(); for(unsigned int i=0;i<file->sceneLights.size();i++) { if(activeLights[i]==1) { file->sceneLights[i]->enable(); file->sceneLights[i]->draw(); } else file->sceneLights[i]->disable(); file->sceneLights[i]->update(); } //end of draw lights glPushMatrix(); drawObjects(); glPopMatrix(); data->getBoard()->draw(); //if theme is changed if(lastOption!=option) { data->getBoard()->setPieceOption(option); changeTheme(); lastOption=option; } i++; glutSwapBuffers(); }
void XMLScene::display() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); activeCamera->applyView(); //axis.draw(); /*glMatrixMode(GL_PROJECTION); glLoadIdentity(); sceneCameras[camera].second->applyView(); glMatrixMode(GL_MODELVIEW); glLoadIdentity();*/ //draw lights selectDrawMode(); unsigned int initial=files[option]->sceneLights[0]->getLightId(); unsigned int finalId=files[option]->sceneLights[files[option]->sceneLights.size()-1]->getLightId(); for(unsigned int i=initial;i<finalId;i++) { if(activeLights[i]==1) { files[option]->sceneLights[i]->enable(); files[option]->sceneLights[i]->draw(); } else files[option]->sceneLights[i]->disable(); files[option]->sceneLights[i]->update(); } //end of draw lights glPushMatrix(); drawObjects(); glPopMatrix(); pieces->draw(); board->draw(); //if theme is changed if(lastOption!=option) { pieces->setOption(option); changeTheme(); pieces->setOption(option); changeTheme(); lastOption=option; } glutSwapBuffers(); }