Exemplo n.º 1
0
void normalKeyboard(unsigned char key, int xx, int yy)
{

	glutSetMenu(mainMenu);
	switch (key) {
		case 27:
			glutDestroyMenu(mainMenu);
			glutDestroyMenu(fillMenu);
			glutDestroyMenu(colorMenu);
			glutDestroyMenu(shrinkMenu);
			exit(0);
			break;

		case 's':
			if (!menuFlag)
			  glutChangeToSubMenu(2,"Shrink",shrinkMenu);
			break;
		case 'c':
			if (!menuFlag)
				glutChangeToSubMenu(2,"Color",colorMenu);
			break;
	}
	if (key == 27)
        if (glutGameModeGet(GLUT_GAME_MODE_ACTIVE) != 0)
				glutLeaveGameMode();
		exit(0);
}
void processNormalKeys(unsigned char key, int xx, int yy) {

	glutSetMenu(mainMenu);
	switch (key) {
		case 27:
			glutDestroyMenu(mainMenu);
			glutDestroyMenu(fillMenu);
			glutDestroyMenu(colorMenu);
			glutDestroyMenu(shrinkMenu);
			exit(0);
			break;

		case 's':
			if (!menuFlag)
			  glutChangeToSubMenu(2,"Shrink",shrinkMenu);
			break;
		case 'c':
			if (!menuFlag)
				glutChangeToSubMenu(2,"Color",colorMenu);
			break;
              
	}
	if (key == 27)
		exit(0);
      
}
Exemplo n.º 3
0
//==================================================================
void RibRendToy::RebuildMenu()
{
	if ( mMainMenuID != -1 )
		glutDestroyMenu( mMainMenuID );

	mMainMenuID = glutCreateMenu( sMenuFunc );
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	glutAddMenuEntry( "-- Debug --", -1 );
	addBoolMenuItem( "Pick Bucket Mode", mHiderParams.mDbgShowBuckets, MENUID_DBG_PICK_BUCKET );
	addBoolMenuItem( "Color Coded Grids", mHiderParams.mDbgColorCodedGrids, MENUID_DBG_COLOR_CODE_GRIDS );
	addBoolMenuItem( "Rasterize Vertices", mHiderParams.mDbgRasterizeVerts, MENUID_DBG_RASTERIZE_VERTS );
	glutAddMenuEntry( "", -1 );

	glutAddMenuEntry( "-- Test Files --", -1 );

	mTestRibFiles.clear();
	mTestRibFilesPaths.clear();

	addDirToMenu( "TestScenes", "rib" );
	addDirToMenu( "TestScenes/KillerooNURBS", "rib" );
	addDirToMenu( "TestScenes/Sponza", "rib" );
	addDirToMenu( "TestScenes/LightsTests", "rib" );
	addDirToMenu( "TestScenes/MiscTests", "rib" );
	addDirToMenu( "TestScenes/ValuesTests", "rib" );
}
int     GLUI_Listbox::mouse_over( int state, int x, int y )
{
  GLUI_Listbox_Item *item;

  /*  printf( "x/y:   %d/%d\n", x, y );              */

  if ( state AND enabled AND x > x_abs + text_x_offset) {
    /****  Build a GLUT menu for this listbox   ***/
    
    /*	printf( "%d %d\n", x, y );              */

    glut_menu_id = glutCreateMenu(listbox_callback);

    item = (GLUI_Listbox_Item *) items_list.first_child();
    while( item ) {
      glutAddMenuEntry( item->text.c_str(), item->id );
      item = (GLUI_Listbox_Item *) item->next();
    }

    glutAttachMenu( GLUT_LEFT_BUTTON);
    
    GLUI_Master.set_left_button_glut_menu_control( this );
  }
  else if ( glut_menu_id != -1 ) {
    /*    printf( "OUT\n" );              */
    glutDetachMenu( GLUT_LEFT_BUTTON );
    glutDestroyMenu( glut_menu_id );
    glut_menu_id = -1;
  }

  return true;
}
Exemplo n.º 5
0
void cleanUp()
{
    // Clean up, Clean up
    glutDestroyMenu( menuID );
    glDeleteProgram( simConfig.program );

    simEntities.cleanup();
}
Exemplo n.º 6
0
int MakeLoadAndSaveMenus(void)
{
  DIR *dirp = opendir(".");
  struct dirent *direntp;
  int csetnum = 0;
  char *newcsetname;

  if (LoadMenu != -1)
    glutDestroyMenu(LoadMenu);
  if (SaveMenu != -1)
    glutDestroyMenu(SaveMenu);

  SaveMenu = glutCreateMenu(HandleSaveMenu);
  LoadMenu = glutCreateMenu(HandleLoadMenu);

  if (dirp == NULL) {
    fprintf(stderr, "Error opening current dir in MakeLoadAndSaveMenus\n");
    return(0);
  }

  while ((direntp = readdir(dirp)) != NULL) {
    char *ext = direntp->d_name + (strlen(direntp->d_name) - CSET_EXTLEN);
    if (!strcmp(ext, CSET_EXT)) {
      newcsetname = (char*)malloc(strlen(direntp->d_name) - CSET_EXTLEN + 1);
      strncpy(newcsetname, direntp->d_name,
	      strlen(direntp->d_name) - CSET_EXTLEN);
      newcsetname[strlen(direntp->d_name) - CSET_EXTLEN] = 0;
      CSetNames[csetnum] = newcsetname;
      glutAddMenuEntry(newcsetname, csetnum++);
    }
  }
  closedir(dirp);
  glutSetMenu(LoadMenu);
  glutAddMenuEntry("-> Rescan Directory <-", -1);
  glutSetMenu(SaveMenu);
  CSetNames[csetnum] = (char*)"NewCurve0";
  glutAddMenuEntry("NewCurve0", csetnum++);
  CSetNames[csetnum] = (char*)"NewCurve1";
  glutAddMenuEntry("NewCurve1", csetnum++);
  CSetNames[csetnum] = (char*)"NewCurve2";
  glutAddMenuEntry("NewCurve2", csetnum++);

  return (csetnum - 2);  /* just indicate curves in Load menu */
}
Exemplo n.º 7
0
static void
make_menu(void)
{
    static int main_menu = 0;

    if (main_menu)
	glutDestroyMenu(main_menu);

    main_menu = glutCreateMenu(menu);
    glutAddMenuEntry("bounce", 0);
    glutAddMenuEntry("", 0);
    if (lighton[0])
	glutAddMenuEntry("red light off", 1);
    else
	glutAddMenuEntry("red light on", 1);
    if (lighton[1])
	glutAddMenuEntry("green light off", 2);
    else
	glutAddMenuEntry("green light on", 2);
    if (lighton[2])
	glutAddMenuEntry("blue light off", 3);
    else
	glutAddMenuEntry("blue light on", 3);

    if (freeze)
	glutAddMenuEntry("unfreeze lights", 4);
    else
	glutAddMenuEntry("freeze lights", 4);

    if (normson)
	glutAddMenuEntry("normals off", 7);
    else
	glutAddMenuEntry("normals on", 7);

    if (performance)
	glutAddMenuEntry("frame rate off", 8);
    else
	glutAddMenuEntry("frame rate on", 8);

    if (obj)
    {
	if (objecton)
	    glutAddMenuEntry("object off", 5);
	else
	    glutAddMenuEntry("object on", 5);
	if (spin)
	    glutAddMenuEntry("object spin off", 6);
	else
	    glutAddMenuEntry("object spin on", 6);
    }

    glutAddMenuEntry("", 0);
    glutAddMenuEntry("exit", 9);

    glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Exemplo n.º 8
0
void C_API Program::Shutdown(void)
{
	if (m_MenuIds[0] != -1)
		glutDestroyMenu(m_MenuIds[0]);

	if (m_MenuIds[1] != -1)
		glutDestroyMenu(m_MenuIds[1]);

	glutDestroyWindow(m_WinId);

	m_vMeshGroups.clear();

	if (m_LoadedObj.pMesh != NULL)
	{
		delete m_LoadedObj.pMesh;
		m_LoadedObj.pMesh = NULL;
	}

	Texture2DManager::kill();
}
Exemplo n.º 9
0
void
menu2(int value)
{
  printf("menu item selected: %d\n", value);
  if (value != 46) {
    printf("FAIL: time6 expected 45\n");
    exit(1);
  }
  glutDestroyMenu(glutGetMenu());
  glutDestroyWindow(glutGetWindow());
  glutTimerFunc(1000, time7, 7);
}
Exemplo n.º 10
0
void C_API Program::SetUpMenus(const Mesh * pUserMesh)
{
	if (m_MenuIds[0] != -1)
		glutDestroyMenu(m_MenuIds[0]);

	if (m_MenuIds[1] != -1)
		glutDestroyMenu(m_MenuIds[1]);

	m_MenuIds[0] = glutCreateMenu(Program::MenuCallback);
	m_MenuIds[1] = glutCreateMenu(Program::MenuCallback);

	glutSetMenu(m_MenuIds[0]);
	glutAddSubMenu("Render By Group", m_MenuIds[1]);
	glutAddMenuEntry("Open File", _OPEN_CODE);
	glutAddMenuEntry("Exit", _EXIT_CODE);

	if (pUserMesh != NULL)
	{
		glutSetMenu(m_MenuIds[1]);
		glutAddMenuEntry("All Groups", -1);

		Mesh::GroupMap::const_iterator GroupIndex = pUserMesh->Groups().begin();
		Mesh::GroupMap::const_iterator LastGroup  = pUserMesh->Groups().end();

		int id = 0;

		while (GroupIndex != LastGroup)
		{
			glutAddMenuEntry((*GroupIndex).first.c_str(), id);

			m_vMeshGroups.push_back((*GroupIndex).first);

			++id;
			++GroupIndex;
		}
	}

	glutSetMenu(m_MenuIds[0]);
	glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Exemplo n.º 11
0
void CurveMenuInit(void)
{
  int i;
  char label[3];

  if (CurveEditMenu != -1) {
    glutDestroyMenu(CurveEditMenu);
    glutDestroyMenu(CurveMenu);
    glutDestroyMenu(StepSizeMenu);
  }

  CurveEditMenu = glutCreateMenu(CurveHandleEditMenu);
  for (i = 0; i < NUM_JOINTS; i++) {
    sprintf(label, " %d ", i+1);
    glutAddMenuEntry(label, i);
  }
  StepSizeMenu = glutCreateMenu(CurveHandleSZMenu);
  glutAddMenuEntry("0.25", 25);
  glutAddMenuEntry("0.5",  50);
  glutAddMenuEntry("1.0", 100);
  glutAddMenuEntry("2.0", 200);
  glutAddMenuEntry("3.0", 300);
  glutAddMenuEntry("5.0", 500);
  CurveMenu = glutCreateMenu(CurveHandleMenu);
  glutAddSubMenu("Load Curve Set", LoadMenu);
  glutAddSubMenu("Save As Curve Set", SaveMenu);
  glutAddSubMenu("Edit Curve", CurveEditMenu);
  glutAddMenuEntry("Done Editing", CMENU_DONEEDIT);
  glutAddMenuEntry("Flatten Curve Set", CMENU_RESET);
  glutAddMenuEntry("Toggle mirrored", CMENU_MIRROR);
  glutAddSubMenu("Step size", StepSizeMenu);
  glutAddMenuEntry("Toggle dotted", CMENU_CURVE);
  glutAddMenuEntry("Toggle horizontals", CMENU_HORIZ);
  glutAddMenuEntry("Toggle walking", CMENU_WALK);
  glutAddMenuEntry("Quit", CMENU_QUIT);
  glutAttachMenu(GLUT_RIGHT_BUTTON);
}
Exemplo n.º 12
0
void
time2(int value)
{
  if (value != 2) {
    printf("FAIL: time2 expected 2\n");
    exit(1);
  }
  glutMouseFunc(mouse);

  /* By attaching and detaching a menu to each button, make
     sure button usage for menus does not mess up normal button 

     callback. */
  glutCreateMenu(menu);
  glutAttachMenu(GLUT_RIGHT_BUTTON);
  glutAttachMenu(GLUT_MIDDLE_BUTTON);
  glutAttachMenu(GLUT_LEFT_BUTTON);
  glutDetachMenu(GLUT_RIGHT_BUTTON);
  glutDetachMenu(GLUT_MIDDLE_BUTTON);
  glutDetachMenu(GLUT_LEFT_BUTTON);
  glutDestroyMenu(glutGetMenu());

  switch (mouseButtons) {
  case 3:
    printf("In the black window, please click: left, then middle, then right buttons (in that order)\n");
    break;
  case 2:
    printf("In the black window, please click: left, then right buttons (in that order)\n");
    break;
  case 1:
    printf("In the black window, please click: left button\n");
    break;
  case 0:
    /* No mouse buttons??  Skip all subsequent tests since they 
       involve the mouse. */
    glutTimerFunc(1000, time7, 7);
    glutMouseFunc(NULL);
    break;
  }
}
Exemplo n.º 13
0
// adds and removes menus
void manageMenus( bool quitCall )
{
  int main_menu = 0;

  // upon initialization
  if( !quitCall )
  {
    // create main menu
    main_menu = glutCreateMenu(menu); // Call menu function
    glutAddMenuEntry("Quit", 1);
    glutAttachMenu(GLUT_RIGHT_BUTTON); //Called if there is a mouse click (right)
  }

  // destroy menus before ending program
  else
  {
    // clean up after ourselves
    glutDestroyMenu(main_menu);
  }

  // update display
  glutPostRedisplay();
}
Exemplo n.º 14
0
void mainMenuEvents(int value){

    switch(value){


        //"Time Attack"
        case 0:

            break;

        //"No Bullet Left Behind"
        case 1:

            break;

        //"Zen"
        case 2:

            break;

        //"Highscores"
        case 3:

            break;

        //"Quit Game"
        case 4:

            glutDestroyMenu(mainMenu);
            exit(0);

            break;

    }


}
Exemplo n.º 15
0
int killwindow(int GL_ID){
	DBG("try to kill win GL_ID=%d", GL_ID);
	windowData *win;
	win = searchWindow_byGLID(GL_ID);
	if(!win) return 0;
	glutSetWindow(GL_ID); // obviously set window (for closing from menu)
	if(!win->killthread){
		pthread_mutex_lock(&win->mutex);
		// say changed thread to die
		win->killthread = 1;
		pthread_mutex_unlock(&win->mutex);
		DBG("wait for changed thread");
		pthread_join(win->thread, NULL); // wait while thread dies
	}
	if(win->menu) glutDestroyMenu(win->menu);
	glutDestroyWindow(win->GL_ID);
	win->GL_ID = 0; // reset for forEachWindow()
	DBG("destroy texture %d", win->Tex);
	glDeleteTextures(1, &(win->Tex));
	glFinish();
	if(!removeWindow(win->ID)) WARNX(_("Error removing from list"));
	totWindows--;
	return 1;
}
Exemplo n.º 16
0
int
main(int argc, char **argv)
{
  int win1, win2, men1, men2, men3;

  glutInit(&argc, argv);

  if (0 != glutGetMenu()) {
    printf("FAIL: current menu wrong, should be zero\n");
    exit(1);
  }
  if (0 != glutGetWindow()) {
    printf("FAIL: current window wrong, should be zero\n");
    exit(1);
  }

  glutInitWindowSize(140, 140);

  /* Make sure initial glut init display mode is right. */
  if (glutGet(GLUT_INIT_DISPLAY_MODE) != (GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH)) {
    printf("FAIL: init display mode wrong\n");
    exit(1);
  }

  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_STENCIL);
  if (glutGet(GLUT_INIT_DISPLAY_MODE) != (GLUT_RGBA | GLUT_SINGLE | GLUT_STENCIL)) {
    printf("FAIL: display mode wrong\n");
    exit(1);
  }

  /* Interesting case:  creating menu before creating windows. */
  men1 = glutCreateMenu(menuSelect);

  /* Make sure glutCreateMenu doesn't change init display mode. */
  if (glutGet(GLUT_INIT_DISPLAY_MODE) != (GLUT_RGBA | GLUT_SINGLE | GLUT_STENCIL)) {
    printf("FAIL: display mode changed\n");
    exit(1);
  }

  if (men1 != glutGetMenu()) {
    printf("FAIL: current menu wrong\n");
    exit(1);
  }

  glutAddMenuEntry("hello", 1);
  glutAddMenuEntry("bye", 2);
  glutAddMenuEntry("yes", 3);
  glutAddMenuEntry("no", 4);
  glutAddSubMenu("submenu", 5);

  win1 = glutCreateWindow("test24");
  glutDisplayFunc(display);

  if (win1 != glutGetWindow()) {
    printf("FAIL: current window wrong\n");
    exit(1);
  }

  if (men1 != glutGetMenu()) {
    printf("FAIL: current menu wrong\n");
    exit(1);
  }

  men2 = glutCreateMenu(menuSelect);
  glutAddMenuEntry("yes", 3);
  glutAddMenuEntry("no", 4);
  glutAddSubMenu("submenu", 5);

  /* Make sure glutCreateMenu doesn't change init display mode. */
  if (glutGet(GLUT_INIT_DISPLAY_MODE) != (GLUT_RGBA | GLUT_SINGLE | GLUT_STENCIL)) {
    printf("FAIL: display mode changed\n");
    exit(1);
  }

  if (men2 != glutGetMenu()) {
    printf("FAIL: current menu wrong\n");
    exit(1);
  }

  if (win1 != glutGetWindow()) {
    printf("FAIL: current window wrong\n");
    exit(1);
  }

  win2 = glutCreateWindow("test24 second");
  glutDisplayFunc(display);

  if (win2 != glutGetWindow()) {
    printf("FAIL: current window wrong\n");
    exit(1);
  }

  glutDestroyWindow(win2);

  if (0 != glutGetWindow()) {
    printf("FAIL: current window wrong, should be zero\n");
    exit(1);
  }

  men3 = glutCreateMenu(menuSelect);
  glutAddMenuEntry("no", 4);
  glutAddSubMenu("submenu", 5);

  if (glutGet(GLUT_INIT_DISPLAY_MODE) != (GLUT_RGBA | GLUT_SINGLE | GLUT_STENCIL)) {
    printf("FAIL: display mode changed\n");
    exit(1);
  }
  glutDestroyMenu(men3);

  if (0 != glutGetMenu()) {
    printf("FAIL: current menu wrong, should be zero\n");
    exit(1);
  }

  glutTimerFunc(2 * 1000, timer, 23);
  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
Exemplo n.º 17
0
GlutViewer::~GlutViewer(void)
{
	glutDestroyWindow(m_WindowID);
	glutDestroyMenu(m_MenuID);
}
Exemplo n.º 18
0
static void destroy_model_menus(ModelStruct* model)
{
   int i;

   glutDestroyMenu(model->musclegroupmenu);
   glutDestroyMenu(model->jointmenu);
   glutDestroyMenu(model->xvarmenu);
   glutDestroyMenu(model->gencoordmenu);
   glutDestroyMenu(model->gencoordmenu2);
   if (model->gencoord_group_menu)
      glutDestroyMenu(model->gencoord_group_menu);
   glutDestroyMenu(model->momentgencmenu);
   glutDestroyMenu(model->momentarmgencmenu);
   glutDestroyMenu(model->momentarmnumgencmenu);
   glutDestroyMenu(model->maxmomentgencmenu);
   glutDestroyMenu(model->segmentmenu);
   glutDestroyMenu(model->motionplotmenu);
   glutDestroyMenu(model->motionmenu);
   glutDestroyMenu(model->motionwithrealtimemenu);
   glutDestroyMenu(model->material_menu);
   if (model->markerMenu)
      glutDestroyMenu(model->markerMenu);

   for (i = 0; i < model->numsegments; i++)
      glutDestroyMenu(model->segment[i].drawmodemenu);

   for (i = 0; i < model->numseggroups; i++)
      glutDestroyMenu(model->seggroup[i].displaymodemenu);

   for (i = 0; i < model->numworldobjects; i++)
      glutDestroyMenu(model->worldobj[i].drawmodemenu);

   glutDestroyMenu(model->dis.view_menu);
   glutDestroyMenu(model->dis.allsegsdrawmodemenu);
   glutDestroyMenu(model->dis.allligsdrawmodemenu);
   glutDestroyMenu(model->dis.allworlddrawmodemenu);
   glutDestroyMenu(model->dis.alldrawmodemenu);
   if (model->dis.eachsegdrawmodemenu > 0)
      glutDestroyMenu(model->dis.eachsegdrawmodemenu);
   glutDestroyMenu(model->dis.maindrawmodemenu);
}
Exemplo n.º 19
0
Tester::~Tester() {
	glFinish();
	glutDestroyMenu(morphMenu);
	glutDestroyMenu(DOFMenu);
	glutDestroyWindow(WindowHandle);
}
Exemplo n.º 20
0
int
main(int argc, char **argv)
{
  int win, menu;
  int marray[NUM];
  int warray[NUM];
  int i, j;
  GLint isIndex;

  glutInit(&argc, argv);
  glutInitWindowPosition(10, 10);
  glutInitWindowSize(200, 200);
  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
  win = glutCreateWindow("test2");
  glGetIntegerv(GL_INDEX_MODE, &isIndex);
  if (isIndex != 0) {
    printf("FAIL: window should be RGBA\n");
    exit(1);
  }
  glutSetWindow(win);
  glutDisplayFunc(display);
  menu = glutCreateMenu(menuSelect);
  glutSetMenu(menu);
  glutReshapeFunc(NULL);
  glutReshapeFunc(NULL);
  glutKeyboardFunc(NULL);
  glutKeyboardFunc(NULL);
  glutMouseFunc(NULL);
  glutMouseFunc(NULL);
  glutMotionFunc(NULL);
  glutMotionFunc(NULL);
  glutVisibilityFunc(NULL);
  glutVisibilityFunc(NULL);
  glutMenuStateFunc(NULL);
  glutMenuStateFunc(NULL);
  glutMenuStatusFunc(NULL);
  glutMenuStatusFunc(NULL);
  glutSpecialFunc(NULL);
  glutSpecialFunc(NULL);
  glutSpaceballMotionFunc(NULL);
  glutSpaceballMotionFunc(NULL);
  glutSpaceballRotateFunc(NULL);
  glutSpaceballRotateFunc(NULL);
  glutSpaceballButtonFunc(NULL);
  glutSpaceballButtonFunc(NULL);
  glutButtonBoxFunc(NULL);
  glutButtonBoxFunc(NULL);
  glutDialsFunc(NULL);
  glutDialsFunc(NULL);
  glutTabletMotionFunc(NULL);
  glutTabletMotionFunc(NULL);
  glutTabletButtonFunc(NULL);
  glutTabletButtonFunc(NULL);
  for (i = 0; i < NUM; i++) {
    marray[i] = glutCreateMenu(menuSelect);
    warray[i] = glutCreateWindow("test");
    glutDisplayFunc(display);
    for (j = 0; j < i; j++) {
      glutAddMenuEntry("Hello", 1);
      glutAddSubMenu("Submenu", menu);
    }
    if (marray[i] != glutGetMenu()) {
      printf("FAIL: current menu not %d\n", marray[i]);
      exit(1);
    }
    if (warray[i] != glutGetWindow()) {
      printf("FAIL: current window not %d\n", warray[i]);
      exit(1);
    }
    glutDisplayFunc(NeverVoid);
    glutVisibilityFunc(NeverValue);
    glutHideWindow();
  }
  for (i = 0; i < NUM; i++) {
    glutDestroyMenu(marray[i]);
    glutDestroyWindow(warray[i]);
  }
  glutTimerFunc(500, timer, 42);
  head = glutGet(GLUT_ELAPSED_TIME);
  glutIdleFunc(idle);
  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
Exemplo n.º 21
0
GlutViewer::
~GlutViewer()
{
    glutDestroyWindow(windowID_);
    glutDestroyMenu(menuID_);
}
Exemplo n.º 22
0
/*
 * Class:     gruenewa_opengl_GLUT__
 * Method:    glutDestroyMenu
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_gruenewa_opengl_GLUT_00024_glutDestroyMenu
  (JNIEnv * jenv, jobject jobj, jint arg1) {
   glutDestroyMenu(arg1); 
}
Exemplo n.º 23
0
void myKeyboard(unsigned char key, int x, int y){
	int k=0;
  switch (key) {
    case 'a': //lighting
      light_setting[0] = light_setting[0] == OFF ? ON : OFF;
      break;
    case 'b': //light0
      light_setting[1] = light_setting[1] == OFF ? ON : OFF;
      break;

	//handle other lights ON/OFF settings - write your code here
    case 'c': //light Cyan
      light_setting[2] = (light_setting[2] == OFF) ? ON : OFF;
      break;
    case 'd': //light Magenta
      light_setting[3] = (light_setting[3] == OFF) ? ON : OFF;
      break;
    case 'e': //light Yellow
      light_setting[4] = (light_setting[4] == OFF) ? ON : OFF;
      break;
    case 'f': //light Spot
      light_setting[5] = (light_setting[5] == OFF) ? ON : OFF;
      break;
    case 'g': //texture
      textureSetting = (textureSetting == OFF) ? ON : OFF;
      break;

	//handle fog ON/OFF setting - write your code here
    case 'h': //texture
      fogSetting = (fogSetting == OFF) ? ON : OFF;
      break;
	//handle shading FLAT/SMOOTH setting - write your code here
    case 'i': //texture
      shadeModelSetting = (shadeModelSetting == OFF) ? ON : OFF;
      break;

    case 'j': //zoomin
      cameraX = (cameraX - 0.5 > 1.0) ?  cameraX - 0.5 : cameraX;
      cameraY = (cameraY - 0.5 > 1.0) ?  cameraY - 0.5 : cameraY;
      cameraZ = (cameraZ - 0.5 > 1.0) ?  cameraZ - 0.5 : cameraZ;
	  if (mouse_yaw_picth) {
		  coiX = cameraX + cosPitch * cosYaw;
		  coiY = cameraY + sinPitch;
		  coiZ = cameraZ + cosPitch * sinYaw;
	  }
      break;
    case 'k': //zoomout
      cameraX = (cameraX + 0.5 < 8) ?  cameraX + 0.5 : cameraX;
      cameraY = (cameraY + 0.5 < 8) ?  cameraY + 0.5 : cameraY;
      cameraZ = (cameraZ + 0.5 < 8) ?  cameraZ + 0.5 : cameraZ;
	  if (mouse_yaw_picth) {
		  coiX = cameraX + cosPitch * cosYaw;
		  coiY = cameraY + sinPitch;
		  coiZ = cameraZ + cosPitch * sinYaw;
	  }
      break;
    case 'l': //reset
      cameraX = originalCameraX;
      cameraY = originalCameraY;
      cameraZ = originalCameraZ;
      coiX = originalCoiX;
      coiY = originalCoiY;
      coiZ = originalCoiZ;
      for(k=0;k<6;k++){light_setting[k] = ls_bak[k];}
      shadeModelSetting=ON;
      fogSetting =OFF;
      textureSetting =ON;
      break;

    case 'r': //rotate control
        delta=!delta;
        break;

    case 27: //escape key, exit the program
      exit(0);
    default:
      break;
    }
  glutDestroyMenu(menu);
  createMenu();
  set_Lights_and_ShadeModel();
  myDisplay();
}