Esempio n. 1
0
void initGLUI(int window) {
	GLUI *gluiSide = GLUI_Master.create_glui_subwindow(window, GLUI_SUBWINDOW_RIGHT);
	gluiSide->set_main_gfx_window(window);

	gluiSide->add_button("New Curve",     NEW_CURVE,   gluiHandler);

	gluiSide->add_button("New Surface",   NEW_SURFACE, gluiHandler);
	surfPanel = gluiSide->add_panel("Surface Parms", GLUI_PANEL_EMBOSSED);
	GLUI_Spinner *xS = gluiSide->add_spinner_to_panel(surfPanel, "X Pts.", 
									GLUI_SPINNER_INT, &surf_x, SURF_X, gluiHandler);
	xS->set_int_limits(3, 10);
	GLUI_Spinner *yS = gluiSide->add_spinner_to_panel(surfPanel, "Y Pts.", 
									GLUI_SPINNER_INT, &surf_y, SURF_Y, gluiHandler);
	yS->set_int_limits(3, 10);
	gluiSide->add_button_to_panel(surfPanel, "Ok", SURF_OK, gluiHandler);
	surfPanel->disable();

	gluiSide->add_button("Modify Points", MODIFY,      gluiHandler);
	gluiSide->add_button("Clear Screen",  CLEAR,       gluiHandler);
	gluiSide->add_button("Camera Mode",   CAMERA,      gluiHandler);

	gluiSide->add_separator();

	GLUI_Spinner *uS = gluiSide->add_spinner("U", GLUI_SPINNER_FLOAT, &u, U, gluiHandler);
	uS->set_float_limits(0.0f, 1.0f);
	uS->set_speed(50);
	GLUI_Spinner *vS = gluiSide->add_spinner("V", GLUI_SPINNER_FLOAT, &v, V, gluiHandler);
	vS->set_float_limits(0.0f, 1.0f);
	vS->set_speed(50);

	gluiSide->add_separator();

	gluiSide->add_button("Quit", QUIT, gluiHandler);
}
Esempio n. 2
0
//! This function creates all the GLUI gui elements
void create_glui_ui(void)
{
  GLUI *glui = GLUI_Master.create_glui_subwindow( main_window, GLUI_SUBWINDOW_RIGHT );
  glui->add_statictext("Group 11 Simulation"); 
  new GLUI_Separator(glui);
  glui->add_statictext("Simulation Timesteps"); 
  GLUI_Spinner* velocityIterationSpinner =
    glui->add_spinner("Velocity Iterations", GLUI_SPINNER_INT, &settings.velocity_iterations);
  velocityIterationSpinner->set_int_limits(1, 500);
  
  GLUI_Spinner* positionIterationSpinner =
    glui->add_spinner("Position Iterations", GLUI_SPINNER_INT, &settings.position_iterations);
  positionIterationSpinner->set_int_limits(0, 100);
  
  GLUI_Spinner* hertzSpinner =
    glui->add_spinner("Sim steps per frame", GLUI_SPINNER_FLOAT, &settings.hz);
  hertzSpinner->set_float_limits(5.0f, 200.0f);


  new GLUI_Separator(glui);
  //new GLUI_Column( glui, false );
  glui->add_statictext("Simulation Parameters"); 
  glui->add_checkbox("Warm Starting", &settings.enable_warm_starting);
  glui->add_checkbox("Time of Impact", &settings.enable_continuous);
  glui->add_checkbox("Sub-Stepping", &settings.enable_sub_stepping);


  
  //new GLUI_Column( glui, false );
  new GLUI_Separator(glui);
  glui->add_statictext("Display Options"); 
  GLUI_Panel* drawPanel =	glui->add_panel("Draw");
  glui->add_checkbox_to_panel(drawPanel, "Shapes", &settings.draw_shapes);
  glui->add_checkbox_to_panel(drawPanel, "Joints", &settings.draw_joints);
  glui->add_checkbox_to_panel(drawPanel, "AABBs", &settings.draw_AABBs);
  glui->add_checkbox_to_panel(drawPanel, "Statistics", &settings.draw_stats);
  glui->add_checkbox_to_panel(drawPanel, "Profile", &settings.draw_profile);
  
  //new GLUI_Column( glui, false );
  new GLUI_Separator(glui);
  glui->add_button("Pause", 0, callbacks_t::pause_cb);
  glui->add_button("Single Step", 0, callbacks_t::single_step_cb);
  glui->add_button("Restart", 0, callbacks_t::restart_cb);
  glui->add_button("Quit", 0,(GLUI_Update_CB)callbacks_t::exit_cb);
  glui->set_main_gfx_window( main_window );

  new GLUI_Separator(glui);
  glui->add_statictext("Mayank Meghwanshi"); 
  glui->add_statictext("Divyam Bansal"); 
  glui->add_statictext("Jaswant Kumar"); 

}
//############################################ Menu window functions ###############################################
void init_menu()
{
	GLUI_Master.close_all();						// Closes the previous windows
	GLUI *glui = GLUI_Master.create_glui( "RMS v1.0");
	glui->add_column(true);							// Adds a column separator
  	glui->add_statictext("WELCOME!");
  	glui->add_separator();							// Adds horizontal separator
  	glui->add_button("NEW USER",SET_NEW_USER,(GLUI_Update_CB)switcher_function);	// Adds a button 
  	glui->add_separator();
  	glui->add_button("OLD USER",SET_OLD_USER, (GLUI_Update_CB)switcher_function);
  	glui->add_separator();
  	glui->add_button("Quit",ERROR_CHECK,(GLUI_Update_CB)exit);
  	glui->add_separator();
  	glui->add_column(true);
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
    //OpenCVの初期化
    cvInit();
	
    //OpenGLとGLUTの初期化
    //(OpenCVみたいにまとめないのはargcとargvが必要だから?)
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA);
    glutInitWindowSize(width, height);
    glutCreateWindow("IplImage");
    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);
    glInit();
    
    
    GLUI *glui = GLUI_Master.create_glui("control");
    glui->add_button("Exit", 0, gluiCallback);

	
    //メインループ突入(displayを繰り返し実行)
    glutMainLoop();
    
    return 0;
}
Esempio n. 5
0
bool GLUIRealTimePlannerGUI::Initialize()
{
  if(!BaseT::Initialize()) return false;

  glui = GLUI_Master.create_glui_subwindow(main_window,GLUI_SUBWINDOW_RIGHT);
  glui->set_main_gfx_window(main_window);
  AddControl(glui->add_button("New target"),"new_target");
  AddControl(glui->add_checkbox("Draw desired"),"draw_desired");
  AddControl(glui->add_checkbox("Draw commanded"),"draw_desired");
  AddControl(glui->add_checkbox("Draw UI"),"draw_ui");
  AddControl(glui->add_checkbox("Draw path"),"draw_path");
  AddControl(glui->add_checkbox("Draw contacts"),"draw_contacts");
  GLUI_Spinner* spinner = glui->add_spinner("Collision margin",GLUI_SPINNER_FLOAT);
  spinner->set_float_limits(0.0,1.0);
  AddControl(spinner,"collision_margin");

  AnyCollection c;
  bool res=c.read("{type:button_press,button:new_target}");
  Assert(res == true);
  AddCommandRule(c,"new_target","");
  res=c.read("{type:widget_value,widget:collision_margin,value:_1}");
  Assert(res == true);
  AddCommandRule(c,"set_collision_margin","_1");
  
  printf("Done initializing...\n");
  return true;
}
Esempio n. 6
0
//metodo main de la aplicacion
void main(int argc, char** argv){

	//inicializar la glut y los buffers
	glutInit(&argc, argv);

	//frame buffer doble y z-bufer
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);

	//construir ventana
	glutInitWindowSize(1280,650);
	glutInitWindowPosition(20,20);
	window=glutCreateWindow("Prueba Theremin");

	std::cout << "Arranca el programa" << std::endl;

	//registrar las callbacks
	GLUI_Master.set_glutDisplayFunc(display);
	//glutReshapeFunc(reshape);
	GLUI_Master.set_glutKeyboardFunc(onKey);
	GLUI_Master.set_glutReshapeFunc(reshape);

	GLUI * glui;
	glui = GLUI_Master.create_glui_subwindow (window,GLUI_SUBWINDOW_TOP);
	bt1 = glui->add_button ("Play", 1, gluiMainWindow);
	glui->add_column (0);
	bt2 = glui->add_button ("Configuracion", 2, gluiMainWindow);
	glui->add_column (0);
	bt3 = glui->add_button ("Acerca de", 3, gluiMainWindow);
	glui->add_column (0);
	bt4 = glui->add_button ("Quit", -3, gluiMainWindow);
	
	GLUI_Master.set_glutIdleFunc(idle);

	glEnable(GL_DEPTH_TEST);

	//Poner en marcha el bucle de eventos
    glutMainLoop();

}
Esempio n. 7
0
File: sea.cpp Progetto: bradens/uvc
int main(int argc, char** argv) {


  glutInit(&argc,argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(500,500);
  glutInitWindowPosition(100,100);
  win =  glutCreateWindow(argv[0]);

  /* initialize background, objects, camera, etc. */
  init();

  /* callback functions */
  GLUI_Master.set_glutDisplayFunc(display);
  GLUI_Master.set_glutReshapeFunc(reshape);
  GLUI_Master.set_glutKeyboardFunc(keyboard);

  /*  GLUI Code */
  //Subwindow doesn't seem to work with mac.. refresh is not correct
  //  GLUI *glui = GLUI_Master.create_glui_subwindow(win, GLUI_SUBWINDOW_RIGHT);
  GLUI *glui = GLUI_Master.create_glui("Controls"/*name*/,0/*flags*/,100+500,100 /*x y*/);
  glui->set_main_gfx_window(win);
  GLUI_Rotation *view_rot = glui->add_rotation("Camera", curview);
  view_rot->set_spin(1.0);
  GLUI_Translation *trans_xy = glui->add_translation("XY", GLUI_TRANSLATION_XY, cameraPosition);
  trans_xy->set_speed(0.005);
  
  GLUI_Translation *trans_x = 
    glui->add_translation( "Objects X", GLUI_TRANSLATION_X, cameraPosition );
  trans_x->set_speed( .005 );
  
  GLUI_Translation *trans_y = 
    glui->add_translation( "Objects Y", GLUI_TRANSLATION_Y, &cameraPosition[1] );
  trans_y->set_speed( .005 );
  
  GLUI_Translation *trans_z = 
    glui->add_translation( "Objects Z", GLUI_TRANSLATION_Z, &cameraPosition[2] );
  trans_z->set_speed( .005 );
  
  glui->add_button("Reset View", RESET_VIEW, placeCamera);

  GLUI_Master.set_glutIdleFunc(myGlutIdle);
  glutMainLoop();
  return(0);
}
int main(int argc, char* argv[])
{
	atexit(onExit);

	/****************************************/
	/*   Initialize GLUT and create window  */
	/****************************************/

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowPosition(50, 50);
	glutInitWindowSize(500, 500);

	main_window = glutCreateWindow("COMP 175 Assignment 2");
	glutDisplayFunc(myGlutDisplay);
	glutReshapeFunc(myGlutReshape);

	/****************************************/
	/*       Set up OpenGL lighting         */
	/****************************************/


	    glClearColor (0.38, 0.38, 0.38, 0.0);
        glShadeModel (GL_SMOOTH);

        GLfloat light_pos0[] = {0.0f, 0.0f, 1.0f, 0.0f};
        GLfloat diffuse[] = {0.5f, 0.5f, 0.5f, 0.0f};
        GLfloat ambient[] = {0.1f, 0.1f, 0.1f, 1.0f};

        glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
        glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
        glLightfv (GL_LIGHT0, GL_POSITION, light_pos0);

        glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
        glEnable (GL_COLOR_MATERIAL);

        glEnable(GL_LIGHTING);
        glEnable (GL_LIGHT0);
        glEnable (GL_DEPTH_TEST);

	///****************************************/
	///*          Enable z-buferring          */
	///****************************************/


	glPolygonOffset(1, 1);



	/****************************************/
	/*         Here's the GLUI code         */
	/****************************************/

	GLUI *glui = GLUI_Master.create_glui("GLUI");

	GLUI_Panel *render_panel = glui->add_panel("Render");
	new GLUI_Checkbox(render_panel, "Wireframe", &wireframe);
	new GLUI_Checkbox(render_panel, "Fill", &fill);
	new GLUI_Checkbox(render_panel, "Normal", &normal);
	(new GLUI_Spinner(render_panel, "Segments X:", &segmentsX))
		->set_int_limits(3, 60);
	(new GLUI_Spinner(render_panel, "Segments Y:", &segmentsY))
		->set_int_limits(3, 60);

	GLUI_Panel *camera_panel = glui->add_panel("Camera");
	(new GLUI_Spinner(camera_panel, "RotateV:", &camRotV))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "RotateU:", &camRotU))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "RotateW:", &camRotW))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "Angle:", &viewAngle))
		->set_int_limits(1, 179);

	GLUI_Spinner* eyex_widget = glui->add_spinner_to_panel(camera_panel, "EyeX:", GLUI_SPINNER_FLOAT, &eyeX);
	eyex_widget->set_float_limits(-5, 5);
	GLUI_Spinner* eyey_widget = glui->add_spinner_to_panel(camera_panel, "EyeY:", GLUI_SPINNER_FLOAT, &eyeY);
	eyey_widget->set_float_limits(-5, 5);
	GLUI_Spinner* eyez_widget = glui->add_spinner_to_panel(camera_panel, "EyeZ:", GLUI_SPINNER_FLOAT, &eyeZ);
	eyez_widget->set_float_limits(-5, 5);

	GLUI_Spinner* lookx_widget = glui->add_spinner_to_panel(camera_panel, "LookX:", GLUI_SPINNER_FLOAT, &lookX);
	lookx_widget->set_float_limits(-5, 5);
	GLUI_Spinner* looky_widget = glui->add_spinner_to_panel(camera_panel, "LookY:", GLUI_SPINNER_FLOAT, &lookY);
	looky_widget->set_float_limits(-5, 5);
	GLUI_Spinner* lookz_widget = glui->add_spinner_to_panel(camera_panel, "LookZ:", GLUI_SPINNER_FLOAT, &lookZ);
	lookz_widget->set_float_limits(-5, 5);

	GLUI_Spinner* clipN_widget = glui->add_spinner_to_panel(camera_panel, "Near:", GLUI_SPINNER_FLOAT, &clipNear);
	clipN_widget->set_float_limits(0, 10);
	GLUI_Spinner* clipF_widget = glui->add_spinner_to_panel(camera_panel, "Far:", GLUI_SPINNER_FLOAT, &clipFar);
	clipF_widget->set_float_limits(0, 100);

	glui->add_column(true);

	GLUI_Panel *obj_panel = glui->add_panel("Object Type");
	GLUI_RadioGroup *group1 =
		glui->add_radiogroup_to_panel(obj_panel, (int*)(&objType), 3, callback_obj);
	glui->add_radiobutton_to_group(group1, "Cube");
	glui->add_radiobutton_to_group(group1, "Cylinder");
	glui->add_radiobutton_to_group(group1, "Cone");
	glui->add_radiobutton_to_group(group1, "Sphere");
	glui->add_radiobutton_to_group(group1, "Special1");


	GLUI_Panel *object_panel = glui->add_panel("Object");
	(new GLUI_Spinner(object_panel, "Rotate X:", &rotX))
		->set_int_limits(0, 359);
	(new GLUI_Spinner(object_panel, "Rotate Y:", &rotY))
		->set_int_limits(0, 359);
	(new GLUI_Spinner(object_panel, "Rotate Z:", &rotZ))
		->set_int_limits(0, 359);
	(new GLUI_Spinner(object_panel, "Scale:", &scale))
		->set_int_limits(1, 100);

	glui->add_button("Quit", 0, (GLUI_Update_CB)exit);

	glui->set_main_gfx_window(main_window);

	/* We register the idle callback with GLUI, *not* with GLUT */
	GLUI_Master.set_glutIdleFunc(myGlutIdle);

	glutMainLoop();

	return EXIT_SUCCESS;
}
Esempio n. 9
0
int main(int argc, char* argv[])
{

	atexit(onExit);
	/****************************************/
	/*   Initialize GLUT and create window  */
	/****************************************/
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(windowXSize, windowYSize);

	main_window = glutCreateWindow("COMP 175 In Class Assignment 7");
	glutDisplayFunc(myGlutDisplay);
	glutReshapeFunc(myGlutReshape);
	/****************************************/
	/*       Set up OpenGL lighting         */
	/****************************************/
	glShadeModel(GL_SMOOTH);

	glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
	glEnable(GL_COLOR_MATERIAL);
	
	glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);

	static float one[] = { 1, 1, 1, 1 };
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, one);
	/****************************************/
	/*          Enable z-buferring          */
	/****************************************/
	glEnable(GL_DEPTH_TEST);
	glPolygonOffset(1, 1);

	/****************************************/
	/*		Setup textured Objects          */
	/****************************************/
	myObject->setTexture(0,"./data/pink.ppm");
	myObject->setTexture(1,"./data/smile.ppm");

	/****************************************/
	/*         Here's the GLUI code         */
	/****************************************/
	GLUI *glui = GLUI_Master.create_glui("GLUI");

	GLUI_Scrollbar* sb1 = new GLUI_Scrollbar(glui, "Red", GLUI_SCROLL_HORIZONTAL, &red_Scroll, COLORR_ID, control_cb);
	sb1->set_int_limits(0, 255);
	GLUI_Scrollbar* sb2 = new GLUI_Scrollbar(glui, "Green", GLUI_SCROLL_HORIZONTAL, &green_Scroll, COLORG_ID, control_cb);
	sb2->set_int_limits(0, 255);
	GLUI_Scrollbar* sb3 = new GLUI_Scrollbar(glui, "Blue", GLUI_SCROLL_HORIZONTAL, &blue_Scroll, COLORB_ID, control_cb);
	sb3->set_int_limits(0, 255);
	sb1->set_int_val(255);
	sb2->set_int_val(255);

/*
    // Create a rotation widget
    GLUI_Rotation *view_rot = new GLUI_Rotation(glui, "Objects", view_rotate );
    view_rot->set_spin( 1.0 );

    // Navigate our scene
    new GLUI_Column( glui, false );
    GLUI_Translation *trans_x =  new GLUI_Translation(glui, "Objects X", GLUI_TRANSLATION_X, obj_pos );
    trans_x->set_speed( .1 );
    new GLUI_Column( glui, false );
    GLUI_Translation *trans_y =  new GLUI_Translation( glui, "Objects Y", GLUI_TRANSLATION_Y, &obj_pos[1] );
    trans_y->set_speed( .1 );
    new GLUI_Column( glui, false );
    GLUI_Translation *trans_z =  new GLUI_Translation( glui, "Objects Z", GLUI_TRANSLATION_Z, &obj_pos[2] );
    trans_z->set_speed( .1 );
*/
	glui->add_column(true);

	GLUI_Panel *render_panel = glui->add_panel("Render");
	new GLUI_Checkbox(render_panel, "Wireframe", &wireframe);
	new GLUI_Checkbox(render_panel, "Filled", &filled);
	new GLUI_Checkbox(render_panel, "Paint", &paint);

	glui->add_button("Quit", 0, (GLUI_Update_CB)exit);

	glui->set_main_gfx_window(main_window);
	/* We register the idle callback with GLUI, *not* with GLUT */
	GLUI_Master.set_glutIdleFunc(myGlutIdle);
	GLUI_Master.set_glutMouseFunc( myGlutMouse );
	glutMotionFunc( myGlutMotion );

	glutMainLoop();

	return EXIT_SUCCESS;
}
int main(int argc, char* argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); //double buffering, RGB mode, need depth buffer
	glutInitWindowSize(WIDTH,HEIGHT); //width, height of the window
	glutInitWindowPosition(0, 0);	// location on the screen the window appears
	
	window = glutCreateWindow("Project GUI");	// creates the window
	
	init(); //things to do once, mostly in beginning	
	
	glutDisplayFunc(handleDisplay);		// tells glut which function to call to render a screen.
	glutMotionFunc(handleMotion);		// handle when motion (this generally means when mouse is moved with a button pressed)
	
 	GLUI_Master.set_glutReshapeFunc( handleReshape );

  	//Setting opengl lights

  	GLfloat light0_ambient[] =  {0.1f, 0.1f, 0.3f, 1.0f};
  	GLfloat light0_diffuse[] =  {.6f, .6f, 1.0f, 1.0f};
  	GLfloat light0_position[] = {1.0f, 1.0f, 1.0f, 0.0f};

  	glEnable(GL_LIGHTING);
  	glEnable(GL_LIGHT0);
  	glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
  	glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  	glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
	
	glEnable(GL_DEPTH_TEST);		// enabling depth
	
	GLUI *glui = GLUI_Master.create_glui_subwindow(window,
                     GLUI_SUBWINDOW_RIGHT);
  	new GLUI_StaticText( glui, "Project GLUI" );
  	new GLUI_Separator(glui);
	
	glui->set_main_gfx_window( window );
	GLUI_Panel *obj_panel = glui->add_panel ("Display option panel");
  	
	listbox = new GLUI_Listbox(obj_panel, "Mesh display option", &display_type, 1, controlBlock);
  	listbox->add_item(FLAT_SHADED, "Flat Shaded");
	listbox->add_item(SMOOTH_SHADED, "Smooth Shaded");
	listbox->add_item(WIREFRAME, "Wireframe");
  	listbox->add_item(EDGES_SHADED, "Shaded with mesh edges");

	//scale code
	GLUI_Spinner *scale_spinner = new GLUI_Spinner( obj_panel, "Scale:", &scale);
  	scale_spinner->set_float_limits( .2f, 5.0 );
  	scale_spinner->set_alignment( GLUI_ALIGN_RIGHT );
	
	//rotation code
	GLUI_Panel * rotation_panel = glui->add_panel_to_panel(obj_panel, "", GLUI_PANEL_NONE);
	
	GLUI_Rotation *sph_rot =
		glui->add_rotation_to_panel(rotation_panel,"Rotate", sphere_rotate,
		ROTATION_ID, controlBlock); 
	sph_rot->set_spin(1.0);

	//translation code
	GLUI_Panel * translate_panel = glui->add_panel_to_panel(obj_panel, "",
		GLUI_PANEL_NONE);	

	GLUI_Translation * move_z =
		glui->add_translation_to_panel(translate_panel,"Object Z",
		GLUI_TRANSLATION_Z, &obj_pos[2]); 
	move_z->scale_factor = 0.1f;

	glui->add_column_to_panel(translate_panel, true);
	
	GLUI_Translation * move_around =
		glui->add_translation_to_panel(translate_panel,"Object XY",
		GLUI_TRANSLATION_XY, obj_pos);
	move_around->scale_factor = 0.1f;

	GLUI_Panel * decimate_panel = glui->add_panel("Decimate Panel");

	glui->add_edittext_to_panel(decimate_panel, "No. of collapse iteration: ", GLUI_EDITTEXT_INT, &collapseCount);

	glui->add_edittext_to_panel(decimate_panel, "Random count (k): ", GLUI_EDITTEXT_INT, &KValue);

	glui->add_button_to_panel(decimate_panel, "Decimate", DECIMATE_ID, controlBlock);

	glui->add_button_to_panel(decimate_panel, "Shape Preserve", SHAPE_PRESERVE_DECIMATE_ID, controlBlock);

	glui->add_separator();

	GLUI_Panel * shape_panel = glui->add_panel("Shape based Panel");
	
	glui->add_button_to_panel(shape_panel, "Go", SURE_SHAPE_PRESERVE_DECIMATE_ID, controlBlock);

	glui->add_separator();

	GLUI_Panel * mapping_panel = glui->add_panel("Mapping Panel");

	glui->add_button_to_panel(mapping_panel, "Open map file", MAPPING_OPEN_ID, controlBlock);
	//other details
	glui->add_separator();
	glui->add_button("Open", OPEN_ID, controlBlock);
	glui->add_button("Save", SAVE_ID, controlBlock);
	glui->add_button("Reset", RESET_ID, controlBlock);
  	glui->add_button("Quit", QUIT_ID, (GLUI_Update_CB)exit);

	/* register idle callback with GLUI, NOT with GLUT */
  	GLUI_Master.set_glutIdleFunc( handleIdle );	// handle when no events are occuring 

	glutMainLoop();				// once this is called, glut takes over --
						// returns only when the window is closed	
	
	return EXIT_SUCCESS;
}
Esempio n. 11
0
int main(int argc, char* argv[])
{
        
        atexit(onExit);

        /****************************************/
        /*   Initialize GLUT and create window  */
        /****************************************/

        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
        glutInitWindowPosition(50, 50);
        glutInitWindowSize(500, 500);

        main_window = glutCreateWindow("COMP 175 In Class Lab 7");
        glutDisplayFunc(myGlutDisplay);
        glutReshapeFunc(myGlutReshape);

        /****************************************/
        /*       Set up OpenGL lighting         */
        /****************************************/

        // Essentially set the background color of the 3D scene.
        //glClearColor(.9f, .9f, .9f, 1.0f);
        glClearColor(0.1, 0.1, 0.1, 1.0);
        glShadeModel(GL_FLAT);

        GLfloat light_pos0[] = { 0.0f, 0.0f, 1.0f, 0.0f };
        GLfloat diffuse[] = { 0.5f, 0.5f, 0.5f, 0.0f };
        GLfloat ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f };

        glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
        glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
        glLightfv(GL_LIGHT0, GL_POSITION, light_pos0);

        //glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
        glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
        glEnable(GL_COLOR_MATERIAL);

        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);

        /****************************************/
        /*          Enable z-buferring          */
        /****************************************/

        glEnable(GL_DEPTH_TEST);
        glPolygonOffset(1, 1);

        /****************************************/
        /*         Here's the GLUI code         */
        /****************************************/

        GLUI *glui = GLUI_Master.create_glui("GLUI");

        GLUI_Panel *render_panel = glui->add_panel("Render");
        new GLUI_Checkbox(render_panel, "Wireframe", &wireframe);
        new GLUI_Checkbox(render_panel, "Filled", &filled);
        new GLUI_Checkbox(render_panel, "Silhouette", &silhouette);

        GLUI_Panel *camera_panel = glui->add_panel("Camera");
        (new GLUI_Spinner(camera_panel, "Rotate Y:", &rotY))->set_int_limits(0, 359);
        (new GLUI_Spinner(camera_panel, "Scale:", &scale))
                ->set_int_limits(1, 1000);


        filenameTextField = new GLUI_EditText( glui, "Filename:", filenamePath);
        filenameTextField->set_w(300);
        glui->add_button("Load PLY", 0, callback_load);


        glui->add_column(true);
        glui->add_button("Quit", 0, (GLUI_Update_CB)exit);

        glui->set_main_gfx_window(main_window);
        /* We register the idle callback with GLUI, *not* with GLUT */
        GLUI_Master.set_glutIdleFunc(myGlutIdle);



        glutMainLoop();

        return EXIT_SUCCESS;
}
Esempio n. 12
0
int main(int argc, char* argv[])
{
	atexit(onExit);

	/****************************************/
	/*   Initialize GLUT and create window  */
	/****************************************/

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowPosition(50, 50);
	glutInitWindowSize(500, 500);

	main_window = glutCreateWindow("COMP 175 Assignment 3");
	glutDisplayFunc(myGlutDisplay);
	glutReshapeFunc(myGlutReshape);

	glShadeModel (GL_SMOOTH);

	glEnable(GL_DEPTH_TEST);

	// Specular reflections will be off without this, since OpenGL calculates
	// specular highlights using an infinitely far away camera by default, not
	// the actual location of the camera
	glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);

	// Show all ambient light for the entire scene (not one by default)
	GLfloat one[] = { 0.5f, 0.5f, 0.5f, 1.0f };
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, one);

	glPolygonOffset(1, 1);



	/****************************************/
	/*         Here's the GLUI code         */
	/****************************************/

	GLUI* glui = GLUI_Master.create_glui("GLUI");

	filenameTextField = new GLUI_EditText( glui, "Filename:", filenamePath);
	filenameTextField->set_w(300);
	glui->add_button("Load", 0, callback_load);
	
	GLUI_Panel *camera_panel = glui->add_panel("Camera");
	(new GLUI_Spinner(camera_panel, "RotateV:", &camRotV))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "RotateU:", &camRotU))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "RotateW:", &camRotW))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "Angle:", &viewAngle))
		->set_int_limits(1, 179);

	glui->add_column_to_panel(camera_panel, true);

	GLUI_Spinner* eyex_widget = glui->add_spinner_to_panel(camera_panel, "EyeX:", GLUI_SPINNER_FLOAT, &eyeX);
	eyex_widget->set_float_limits(-10, 10);
	GLUI_Spinner* eyey_widget = glui->add_spinner_to_panel(camera_panel, "EyeY:", GLUI_SPINNER_FLOAT, &eyeY);
	eyey_widget->set_float_limits(-10, 10);
	GLUI_Spinner* eyez_widget = glui->add_spinner_to_panel(camera_panel, "EyeZ:", GLUI_SPINNER_FLOAT, &eyeZ);
	eyez_widget->set_float_limits(-10, 10);

	GLUI_Spinner* lookx_widget = glui->add_spinner_to_panel(camera_panel, "LookX:", GLUI_SPINNER_FLOAT, &lookX);
	lookx_widget->set_float_limits(-10, 10);
	GLUI_Spinner* looky_widget = glui->add_spinner_to_panel(camera_panel, "LookY:", GLUI_SPINNER_FLOAT, &lookY);
	looky_widget->set_float_limits(-10, 10);
	GLUI_Spinner* lookz_widget = glui->add_spinner_to_panel(camera_panel, "LookZ:", GLUI_SPINNER_FLOAT, &lookZ);
	lookz_widget->set_float_limits(-10, 10);

	glui->add_column(true);

	GLUI_Panel *render_panel = glui->add_panel("Render");
	new GLUI_Checkbox(render_panel, "Wireframe", &wireframe);
	new GLUI_Checkbox(render_panel, "Fill", &fillObj);
	(new GLUI_Spinner(render_panel, "Segments X:", &segmentsX))
		->set_int_limits(3, 60);
	(new GLUI_Spinner(render_panel, "Segments Y:", &segmentsY))
		->set_int_limits(3, 60);


	glui->add_button("Quit", 0, (GLUI_Update_CB)exit);

	glui->set_main_gfx_window(main_window);

	/* We register the idle callback with GLUI, *not* with GLUT */
	GLUI_Master.set_glutIdleFunc(myGlutIdle);

	glutMainLoop();

	return EXIT_SUCCESS;
}
Esempio n. 13
0
int main(int argc, char** args)
{

	
	

	glutInit(&argc, args);
	



	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(800, 600);
	

	

    //glutPassiveMotionFunc(move);

	

	
	init();
	gl_DrawShape();
	
	main_window = glutCreateWindow("3D and 2D Super shapes");
	glutDisplayFunc(display);
	glutReshapeFunc(reshapeWindow);


	GLUI *glui = GLUI_Master.create_glui_subwindow( main_window, GLUI_SUBWINDOW_LEFT);
	GLUI_Master.set_glutIdleFunc(myGlutIdle);
	//GLUI_Master.set_glutDisplayFunc(display);
	m = glui->add_spinner("Change m", GLUI_SPINNER_FLOAT, 0, 0, changeSpinner);
	//m->set_int_limits(0, 5, GLUI_LIMIT_WRAP);
	m->set_speed(0.2f);

	n1 = glui->add_spinner("Change n1", GLUI_SPINNER_FLOAT, 0, 1, changeSpinner);
	//n1->set_int_limits(0, 5, GLUI_LIMIT_WRAP);
	n1->set_speed(0.2f);

	n2 = glui->add_spinner("Change n2", GLUI_SPINNER_FLOAT, 0, 2, changeSpinner);
	//n2->set_int_limits(0, 5, GLUI_LIMIT_WRAP);
	n2->set_speed(0.2f);

	n3 = glui->add_spinner("Change n3", GLUI_SPINNER_FLOAT, 0, 3, changeSpinner);
	//n3->set_int_limits(0, 5, GLUI_LIMIT_WRAP);
	n3->set_speed(0.2f);

	a = glui->add_spinner("Change a", GLUI_SPINNER_INT, 0, 4, changeSpinner);
	//a->set_int_limits(0, 5, GLUI_LIMIT_WRAP);
	a->set_speed(0.05f);

	b = glui->add_spinner("Change b", GLUI_SPINNER_INT, 0, 5, changeSpinner);
	//b->set_int_limits(0, 5, GLUI_LIMIT_WRAP);
	b->set_speed(0.05f);

	glui->add_button("Close", 0, (GLUI_Update_CB )exit);

	

	//shape->draw();
	//renderFrame(shape);
	//setup();
	//draw();
	//shape->draw();



	glutMainLoop();

    // Create a CMyWindow object

    // Run the application's message loop
	return 0;
}
Esempio n. 14
0
// Do some GLUT initialization, also set up GLUI
void setupGLUT(char* programName)
{
    glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE);
    glutInitWindowPosition(100,100);
    glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
	mainWindow = glutCreateWindow(programName);

    glutReshapeFunc(reshape);

    glutDisplayFunc(display);

    glutKeyboardFunc(keyboard);

    glutMouseFunc(mouse);

    glutMotionFunc(mouseMove);

    glutIdleFunc(idle);

	glutTimerFunc(tickSpeed, tick, 0);

	GLUI_Master.set_glutKeyboardFunc(keyboard);
	GLUI_Master.set_glutReshapeFunc(reshape);

	//GLUI stuff
	gluiWindow = GLUI_Master.create_glui_subwindow(mainWindow, GLUI_SUBWINDOW_RIGHT);
	camRotateTrans = gluiWindow->add_translation("Rotate Camera", GLUI_TRANSLATION_XY, cameraRotate);
	camRotateTrans->set_speed(0.01f);
	camZoomTrans = gluiWindow->add_translation("Zoom Camera", GLUI_TRANSLATION_Z, cameraZoom);
	camZoomTrans->set_speed(0.1f);
	gluiWindow->add_separator();
	gluiWindow->add_button( "Quit", 0,(GLUI_Update_CB)exit );
	
	GLUI_Panel *viewPanel = gluiWindow->add_panel("Camera View", GLUI_PANEL_EMBOSSED);
	GLUI_RadioGroup *cameraRadio = gluiWindow->add_radiogroup_to_panel(viewPanel, &cameraMode);
	gluiWindow->add_radiobutton_to_group(cameraRadio, "Free Look");
	gluiWindow->add_radiobutton_to_group(cameraRadio, "Third Person");
	gluiWindow->add_radiobutton_to_group(cameraRadio, "Top View");

	GLUI *gluiWindowLeft = GLUI_Master.create_glui_subwindow(mainWindow, GLUI_SUBWINDOW_LEFT);

	angleSpinner = gluiWindowLeft->add_spinner("Angle", GLUI_SPINNER_INT, &launchAngle);
	angleSpinner->set_int_limits(0, 359, GLUI_LIMIT_WRAP);
	angleSpinner->set_speed(0.2);
	angleSpinner->set_int_val(launchAngle);

	powerSpinner = gluiWindowLeft->add_spinner("Power", GLUI_SPINNER_INT, &launchPower);
	powerSpinner->set_int_limits(1, MAX_SPEED, GLUI_LIMIT_CLAMP);
	powerSpinner->set_int_val(launchPower);
	powerSpinner->set_speed(0.1);

	fireButton = gluiWindowLeft->add_button("Go!", 0, launchBall);

	newPlayerButton = gluiWindowLeft->add_button("New Player" , 1, addNewPlayer);
	//currentProfile = gluiWindowLeft->add_listbox(

	GLUI_Panel *holePanel = gluiWindowLeft->add_panel("Profile");
	userName = gluiWindowLeft->add_statictext_to_panel(holePanel, "Player: ");
	currentHole = gluiWindowLeft->add_statictext_to_panel(holePanel, "Hole: ");
	totalNumHoles = gluiWindowLeft->add_statictext_to_panel(holePanel, "Total Holes: ");
	numStrokes = gluiWindowLeft->add_statictext_to_panel(holePanel, "Current Stroke: ");	
	par = gluiWindowLeft->add_statictext_to_panel(holePanel, "Par: ");

	// Set glui initial values
	numStrokes->set_int_val(0);

	GLUI_Panel *scoresPanel = gluiWindowLeft->add_panel("High Scores");
	highScoresList[0] = gluiWindowLeft->add_statictext_to_panel(scoresPanel, "No high scores");
	highScoresList[1] = gluiWindowLeft->add_statictext_to_panel(scoresPanel, "");
	highScoresList[2] = gluiWindowLeft->add_statictext_to_panel(scoresPanel, "");
	highScoresList[3] = gluiWindowLeft->add_statictext_to_panel(scoresPanel, "");
	highScoresList[4] = gluiWindowLeft->add_statictext_to_panel(scoresPanel, "");
	
	soundButton = gluiWindowLeft->add_button("Toggle Music", 0, soundTest);
	
	GLUI_Master.auto_set_viewport();

	gluiWindow->set_main_gfx_window(mainWindow);
	GLUI_Master.set_glutIdleFunc(idle);
	GLUI_Master.sync_live_all();
}
/**
 * @brief UI設定関数
 */
void setGlui(void)
{
  /* GLUIコントローラーの設定 */
  GLUI * glui = GLUI_Master.create_glui("Control Panel", 0);

  /* スリットサイズのテキストボックス追加 */
  GLUI_EditText * editSlitWidth = new GLUI_EditText(glui, "Slit width (cm)", &slitWidth, NULL, inputChangeSlitWidth);
  // 限界値とその処理
  //editSlitWidth->set_float_limits(0.0, 1.0, GLUI_LIMIT_CLAMP);
  // 初期値
  editSlitWidth->set_float_val(0.3);

  /* 移動スピードのテキストボックス追加 */
  GLUI_EditText * editSlitSpeed = new GLUI_EditText(glui, "Slit speed (cm)/s", &slitSpeed, NULL, inputChangeSlitSpeed);
  //editSlitSpeed->set_float_limits(0.0, 1.0, GLUI_LIMIT_CLAMP);
  editSlitSpeed->set_float_val(18000);

  // 仕切り線
  glui->add_separator();

  /* モード変更用のラジオボタン */
  // テキスト
  glui->add_statictext("Move select");
  GLUI_RadioGroup * mode_radio = new GLUI_RadioGroup(glui, &mode);
  // モード変更の項目設定
  glui->add_radiobutton_to_group(mode_radio, "Slit Move");
  glui->add_radiobutton_to_group(mode_radio, "Image Move");

  // 仕切り線
  glui->add_separator();

  // スリット色変え
  GLUI_RadioGroup * slit_mode_radio = new GLUI_RadioGroup(glui, &slitColor);
  glui->add_radiobutton_to_group(slit_mode_radio, "Black");
  glui->add_radiobutton_to_group(slit_mode_radio, "White");

  glui->add_separator();

  // 反復ボタン
  new GLUI_Checkbox(glui, "Repetition", &repetition);

  glui->add_separator();

  /* 画像変更のラジオボタン */
  glui->add_statictext("Image select");
  GLUI_RadioGroup * imageMode_radio = new GLUI_RadioGroup(glui, &ImageMode);
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - Line drowing black");
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - Line drowing white");
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - Black");
  glui->add_radiobutton_to_group(imageMode_radio, "Dromedary camel - White");

  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - Line drowing black");
  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - Line drowing white");
  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - Black");
  glui->add_radiobutton_to_group(imageMode_radio, "Bactrian camel - White");

  glui->add_radiobutton_to_group(imageMode_radio, "Momotaro");

  glui->add_radiobutton_to_group(imageMode_radio, "Circle");
  glui->add_radiobutton_to_group(imageMode_radio, "Square");
  glui->add_radiobutton_to_group(imageMode_radio, "triangle");

  // 仕切り線
  glui->add_separator();

  /* exitボタン */
  glui->add_button("Exit", 0, gluiCallBack);

  // idlezコールバック関数はGLUIで登録
  GLUI_Master.set_glutIdleFunc(NULL);
}
Esempio n. 16
0
int main(int argc, char* argv[])
{
	atexit(onExit);

	/****************************************/
	/*   Initialize GLUT and create window  */
	/****************************************/

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
	glutInitWindowPosition(50, 50);
	glutInitWindowSize(500, 500);

	main_window = glutCreateWindow("COMP 175 Assignment 4");
	glutDisplayFunc(myGlutDisplay);
	glutReshapeFunc(myGlutReshape);

	/****************************************/
	/*         Here's the GLUI code         */
	/****************************************/

	GLUI* glui = GLUI_Master.create_glui("GLUI");

	filenameTextField = new GLUI_EditText( glui, "Filename:", filenamePath);
	filenameTextField->set_w(300);
	glui->add_button("Load", 0, callback_load);
	glui->add_button("Start!", 0, callback_start);
	glui->add_checkbox("Isect Only", &isectOnly);
	
	GLUI_Panel *camera_panel = glui->add_panel("Camera");
	(new GLUI_Spinner(camera_panel, "RotateV:", &camRotV))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "RotateU:", &camRotU))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "RotateW:", &camRotW))
		->set_int_limits(-179, 179);
	(new GLUI_Spinner(camera_panel, "Angle:", &viewAngle))
		->set_int_limits(1, 179);

	glui->add_column_to_panel(camera_panel, true);

	GLUI_Spinner* eyex_widget = glui->add_spinner_to_panel(camera_panel, "EyeX:", GLUI_SPINNER_FLOAT, &eyeX);
	eyex_widget->set_float_limits(-10, 10);
	GLUI_Spinner* eyey_widget = glui->add_spinner_to_panel(camera_panel, "EyeY:", GLUI_SPINNER_FLOAT, &eyeY);
	eyey_widget->set_float_limits(-10, 10);
	GLUI_Spinner* eyez_widget = glui->add_spinner_to_panel(camera_panel, "EyeZ:", GLUI_SPINNER_FLOAT, &eyeZ);
	eyez_widget->set_float_limits(-10, 10);

	GLUI_Spinner* lookx_widget = glui->add_spinner_to_panel(camera_panel, "LookX:", GLUI_SPINNER_FLOAT, &lookX);
	lookx_widget->set_float_limits(-10, 10);
	GLUI_Spinner* looky_widget = glui->add_spinner_to_panel(camera_panel, "LookY:", GLUI_SPINNER_FLOAT, &lookY);
	looky_widget->set_float_limits(-10, 10);
	GLUI_Spinner* lookz_widget = glui->add_spinner_to_panel(camera_panel, "LookZ:", GLUI_SPINNER_FLOAT, &lookZ);
	lookz_widget->set_float_limits(-10, 10);

	glui->add_button("Quit", 0, (GLUI_Update_CB)exit);

	glui->set_main_gfx_window(main_window);

	/* We register the idle callback with GLUI, *not* with GLUT */
	GLUI_Master.set_glutIdleFunc(myGlutIdle);

	glutMainLoop();

	return EXIT_SUCCESS;
}
Esempio n. 17
0
int main(int argc, char **argv) {

    /* Seed random */
    srand(time(NULL));

    /* Init glut and glew */
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(X_SIZE, Y_SIZE);
    glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
    glutInitContextProfile(GLUT_CORE_PROFILE);
    glewExperimental = GL_TRUE;

    /* Create window */
    main_window = glutCreateWindow("Project");
    glewInit();
    glEnable(GL_DEPTH_TEST);

    /* Model init */
    Model::program_init();

    /* Data init */
    init();

    /* Glut functions */
    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(special);
    glutIdleFunc(NULL);

    /* Glui */
    GLUI* glui = GLUI_Master.create_glui_subwindow(main_window, GLUI_SUBWINDOW_RIGHT);
    
    glui->set_main_gfx_window(main_window);

    glui->add_statictext("Camera Rotate");
    glui->add_separator();
    glui->add_button("X+", CAMERA_XPR, button_callback);
    glui->add_button("X-", CAMERA_XNR, button_callback);  
    glui->add_button("Y+", CAMERA_YPR, button_callback);
    glui->add_button("Y-", CAMERA_YNR, button_callback);
    glui->add_button("Z+", CAMERA_ZPR, button_callback);
    glui->add_button("Z-", CAMERA_ZNR, button_callback);

    glui->add_statictext("Camera Translate");
    glui->add_separator();
    glui->add_button("X+", CAMERA_XPT, button_callback);
    glui->add_button("X-", CAMERA_XNT, button_callback);  
    glui->add_button("Y+", CAMERA_YPT, button_callback);
    glui->add_button("Y-", CAMERA_YNT, button_callback);
    glui->add_button("Z+", CAMERA_ZPT, button_callback);
    glui->add_button("Z-", CAMERA_ZNT, button_callback);    

    glui->add_statictext("Light");
    glui->add_separator();
    glui->add_button("X+", LIGHT_XPT, button_callback);
    glui->add_button("X-", LIGHT_XNT, button_callback); 
    glui->add_button("Y+", LIGHT_YPT, button_callback);
    glui->add_button("Y-", LIGHT_YNT, button_callback);    
    glui->add_button("Z+", LIGHT_ZPT, button_callback);
    glui->add_button("Z-", LIGHT_ZNT, button_callback);   
    glui->add_button("Light+", LIGHTP, button_callback);
    glui->add_button("Light-", LIGHTN, button_callback);      

    glui->add_statictext("Materials");
    glui->add_separator();
    glui->add_button("Ambient+", AMBIENTP, button_callback);
    glui->add_button("Ambient-", AMBIENTN, button_callback); 
    glui->add_button("Diffuse+", DIFFUSEP, button_callback);
    glui->add_button("Diffuse-", DIFFUSEN, button_callback);    
    glui->add_button("Specular+", SPECULARP, button_callback);
    glui->add_button("Specular-", SPECULARN, button_callback);       
        
    GLUI_Master.set_glutIdleFunc(idle);

    /* Main loop */
    glutMainLoop();

    return 0;
}