本文整理汇总了C++中GLUI::set_main_gfx_window方法的典型用法代码示例。如果您正苦于以下问题:C++ GLUI::set_main_gfx_window方法的具体用法?C++ GLUI::set_main_gfx_window怎么用?C++ GLUI::set_main_gfx_window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLUI
的用法示例。
在下文中一共展示了GLUI::set_main_gfx_window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initGLUI
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);
}
示例2: Initialize
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;
}
示例3: main
int main(int argc, char* argv[])
{
/****************************************/
/* Initialize GLUT and create window */
/****************************************/
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowPosition( 50, 50 );
glutInitWindowSize( 300, 300 );
main_window = glutCreateWindow( "GLUI Example 1" );
glutDisplayFunc( myGlutDisplay );
glutReshapeFunc( myGlutReshape );
/****************************************/
/* Set up 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);
/****************************************/
/* Enable z-buferring */
/****************************************/
glEnable(GL_DEPTH_TEST);
/****************************************/
/* Here's the GLUI code */
/****************************************/
GLUI *glui = GLUI_Master.create_glui( "GLUI" );
new GLUI_Checkbox( glui, "Wireframe", &wireframe );
(new GLUI_Spinner( glui, "Segments:", &segments ))
->set_int_limits( 3, 60 );
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;
}
示例4: create_glui_ui
//! 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");
}
示例5: main
int main(int argc, char* argv[])
{
int a;
do
{
system("clear");
imprimir_help();
printf("continuar? (1 para sim) "); scanf("%d", &a);
}while(a != 1);
paused=0;
qtd_estados=2;
old_qtd_estados=2;
automato = new Automato(qtd_estados);
/****************************************/
/* Initialize GLUT and create window */
/****************************************/
glutInit(&argc,argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(800,400);
glutInitWindowPosition(0,0);
main_window = glutCreateWindow("It's raining languages!");
init();
glutDisplayFunc(display);
glutIdleFunc(animate);
/****************************************/
/* Here's the GLUI code */
/****************************************/
GLUI *glui = GLUI_Master.create_glui( "GLUI" );
new GLUI_Checkbox( glui, "Paused", &paused );
(new GLUI_Spinner( glui, "Qtd. Estados:", &qtd_estados ))->set_int_limits( 2, 6 );
edittext = new GLUI_EditText(glui, "Text:", text,3, getRegex);
glui->set_main_gfx_window( main_window );
/* We register the idle callback with GLUI, *not* with GLUT */
GLUI_Master.set_glutIdleFunc( animate );
glutMainLoop();
return 0;
}
示例6: main
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);
}
示例7: main
//.........这里部分代码省略.........
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;
}
示例8: main
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;
}
示例9: main
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);
//.........这里部分代码省略.........
示例10: initGlui
// initialize GLUI
int MeshGui::initGlui(void)
{
// create the side subwindow
GLUI *glui = GLUI_Master.create_glui_subwindow(main_window, GLUI_SUBWINDOW_RIGHT);
// radio button group
GLUI_RadioGroup *ot_group = new GLUI_RadioGroup (glui, &radiogroup_item_id, SHADING_MODE, control_cb);
// shading choices
glui->add_radiobutton_to_group( ot_group, "flatShaded" );
glui->add_radiobutton_to_group( ot_group, "smoothShaded" );
glui->add_radiobutton_to_group( ot_group, "wireframe" );
glui->add_radiobutton_to_group( ot_group, "shadedEdges" );
glui->add_radiobutton_to_group( ot_group, "point" );
// load and save smf file
new GLUI_EditText (glui, "smf/", GLUI_EDITTEXT_TEXT, filetext, INPUT_FILE, control_cb);
new GLUI_Button( glui, "open", OPEN_MESH, control_cb );
new GLUI_Button( glui, "save", SAVE_MESH, control_cb );
// A 'quit' button
new GLUI_Button( glui, "Quit", 0,(GLUI_Update_CB)exit );
// some controls for lights
//GLUI_Rollout *roll_lights = new GLUI_Rollout(glui, "Lights", false);
GLUI_Panel *light0 = new GLUI_Panel( glui, "Light 0" );
GLUI_Panel *light1 = new GLUI_Panel( glui, "Light 1" );
new GLUI_Checkbox( light0, "Enabled", &light0_enabled, LIGHT0_ENABLE, control_cb );
light0_spinner = new GLUI_Spinner( light0, "Intensity:", &light0_intensity, LIGHT0_INTENSITY, control_cb );
light0_spinner->set_float_limits( 0.0, 1.0 );
GLUI_Scrollbar *sb;
sb = new GLUI_Scrollbar( light0, "Red",GLUI_SCROLL_HORIZONTAL, &light0_diffuse[0],LIGHT0_INTENSITY,control_cb);
sb->set_float_limits(0,1);
sb = new GLUI_Scrollbar( light0, "Green",GLUI_SCROLL_HORIZONTAL, &light0_diffuse[1],LIGHT0_INTENSITY,control_cb);
sb->set_float_limits(0,1);
sb = new GLUI_Scrollbar( light0, "Blue",GLUI_SCROLL_HORIZONTAL, &light0_diffuse[2],LIGHT0_INTENSITY,control_cb);
sb->set_float_limits(0,1);
new GLUI_Checkbox( light1, "Enabled", &light1_enabled, LIGHT1_ENABLE, control_cb );
light1_spinner = new GLUI_Spinner( light1, "Intensity:", &light1_intensity, LIGHT1_INTENSITY, control_cb );
light1_spinner->set_float_limits( 0.0, 1.0 );
sb = new GLUI_Scrollbar( light1, "Red",GLUI_SCROLL_HORIZONTAL, &light1_diffuse[0],LIGHT1_INTENSITY,control_cb);
sb->set_float_limits(0,1);
sb = new GLUI_Scrollbar( light1, "Green",GLUI_SCROLL_HORIZONTAL, &light1_diffuse[1],LIGHT1_INTENSITY,control_cb);
sb->set_float_limits(0,1);
sb = new GLUI_Scrollbar( light1, "Blue",GLUI_SCROLL_HORIZONTAL, &light1_diffuse[2],LIGHT1_INTENSITY,control_cb);
sb->set_float_limits(0,1);
// edge number to randomly choose from
GLUI_Spinner *edge_spinner = new GLUI_Spinner(glui, "EdgeNumber", &edge_number, EDGE_NUMBER, control_cb );
edge_spinner->set_float_limits(2, 100);
// edge percentage to collapse
GLUI_Spinner *percentage_spinner = new GLUI_Spinner(glui, "CollapsePercentage%", &collapse_percentage, COLLAPSE_NUMBER, control_cb );
percentage_spinner->set_float_limits(1, 100);
new GLUI_Button(glui, "decimate", DECIMATE, control_cb );
// Link windows to GLUI, and register idle callback
glui->set_main_gfx_window( main_window );
// Create the bottom subwindow
GLUI *glui2 = GLUI_Master.create_glui_subwindow( main_window, GLUI_SUBWINDOW_BOTTOM );
glui2->set_main_gfx_window( main_window );
// rotate the world
GLUI_Rotation *view_rot = new GLUI_Rotation(glui2, "Objects", view_rotate );
view_rot->set_spin( 1.0 );
// rotate the model
new GLUI_Column( glui2, false );
GLUI_Rotation *sph_rot = new GLUI_Rotation(glui2, "Model", mesh_rotate );
sph_rot->set_spin( .98 );
// rotate the blue light
new GLUI_Column( glui2, false );
GLUI_Rotation *lights_rot = new GLUI_Rotation(glui2, "Blue Light", lights_rotation );
lights_rot->set_spin( .82 );
// object XY translate
new GLUI_Column( glui2, false );
GLUI_Translation *trans_xy = new GLUI_Translation(glui2, "Objects XY", GLUI_TRANSLATION_XY, obj_pos );
trans_xy->set_speed( .005 );
// object X translate
new GLUI_Column( glui2, false );
GLUI_Translation *trans_x = new GLUI_Translation(glui2, "Objects X", GLUI_TRANSLATION_X, obj_pos );
trans_x->set_speed( .005 );
// object Y translate
new GLUI_Column( glui2, false );
GLUI_Translation *trans_y = new GLUI_Translation( glui2, "Objects Y", GLUI_TRANSLATION_Y, &obj_pos[1] );
trans_y->set_speed( .005 );
// object y translate
new GLUI_Column( glui2, false );
GLUI_Translation *trans_z = new GLUI_Translation( glui2, "Objects Z", GLUI_TRANSLATION_Z, &obj_pos[2] );
trans_z->set_speed( .005 );
return EXIT_SUCCESS;
}
示例11: main
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;
}
示例12: main
int main(int argc, char* argv[])
{
Sub_mesh_d.load_mesh(argv[1]);
Con_mesh_d.load_mesh(argv[1]);
Sub_mesh_d.triangulation();
for(int i=0;i<3;i++){
Sub_mesh_d.make_edges();
Sub_mesh_d.make_neighbours();
//Sub_mesh_d.calculate_normals();
Sub_mesh_d.subdivide();
Sub_mesh_d.calculate_normals();
}
printf("\n\t\t Dodecahedron finished**********\n");
Sub_mesh_e.load_mesh(argv[2]);
Con_mesh_e.load_mesh(argv[2]);
Sub_mesh_e.triangulation();
Sub_mesh_e.calculate_normals();
Sub_mesh_e.make_edges();
Sub_mesh_e.make_neighbours();
Sub_mesh_e.subdivide();
Sub_mesh_e.calculate_normals();
/****************************************/
/* Initialize GLUT and create window */
/****************************************/
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowPosition( 50, 50 );
glutInitWindowSize( 300, 300 );
main_window = glutCreateWindow( "GLUI Example 2" );
glutDisplayFunc( myGlutDisplay );
glutReshapeFunc( myGlutReshape );
glutKeyboardFunc( myGlutKeyboard );
glutMotionFunc( myGlutMotion );
glutMouseFunc( myGlutMouse );
/****************************************/
/* Set up 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);
/****************************************/
/* Enable z-buferring */
/****************************************/
glEnable(GL_DEPTH_TEST);
/****************************************/
/* Here's the GLUI code */
/****************************************/
GLUI *glui = GLUI_Master.create_glui( "GLUI", 0, 400, 50 ); /* name, flags,
x, and y */
new GLUI_StaticText( glui, "GLUI Example 2" );
new GLUI_Separator( glui );
checkbox = new GLUI_Checkbox( glui, "Control Mesh", &wireframe, 1, control_cb );
spinner = new GLUI_Spinner( glui, "Subdivision _factor", &segments, 2, control_cb );
spinner->set_int_limits( 3, 60 );
rotate = new GLUI_Rotation(glui, "view_rotate",view_rotate);
rotate -> set_spin(1.0);
Light_rotate = new GLUI_Rotation(glui, "light_rotate",light_rotate);
Light_rotate -> set_spin(1.0);
GLUI_Panel *obj_panel = new GLUI_Panel( glui, "mesh selection" );
radio = new GLUI_RadioGroup( obj_panel,&obj,4,control_cb );
new GLUI_RadioButton( radio, "Dodecahedron" );
new GLUI_RadioButton( radio, "Ellel" );
GLUI_Panel *control = new GLUI_Panel(glui,"Control Mesh Changer");
new GLUI_Button( glui, "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_glutIdleFunc( NULL );
glutMainLoop();
return EXIT_SUCCESS;
}
示例13: main
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;
}
示例14: createInterface
//.........这里部分代码省略.........
materialSpecularRedSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *materialSpecularGreenSpinner = glui->add_spinner_to_panel(materialSpecularPanel, "Green ", GLUI_SPINNER_FLOAT, &relightingEffect->materialSpecular[1], -1, gluiCallback);
materialSpecularGreenSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *materialSpecularBlueSpinner = glui->add_spinner_to_panel(materialSpecularPanel, "Blue ", GLUI_SPINNER_FLOAT, &relightingEffect->materialSpecular[2], -1, gluiCallback);
materialSpecularBlueSpinner->set_float_limits(0.0, 1);
GLUI_Rollout* lightRollout = glui->add_rollout_to_panel(relightingRollout, "Light", 0, GLUI_PANEL_EMBOSSED);
GLUI_Panel* lightAmbientPanel = glui->add_panel_to_panel(lightRollout, "Ambient", GLUI_PANEL_EMBOSSED);
GLUI_Spinner *lightAmbientRedSpinner = glui->add_spinner_to_panel(lightAmbientPanel, "Red ", GLUI_SPINNER_FLOAT, &relightingEffect->lightAmbient[0], -1, gluiCallback);
lightAmbientRedSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *lightAmbientGreenSpinner = glui->add_spinner_to_panel(lightAmbientPanel, "Green ", GLUI_SPINNER_FLOAT, &relightingEffect->lightAmbient[1], -1, gluiCallback);
lightAmbientGreenSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *lightAmbientBlueSpinner = glui->add_spinner_to_panel(lightAmbientPanel, "Blue ", GLUI_SPINNER_FLOAT, &relightingEffect->lightAmbient[2], -1, gluiCallback);
lightAmbientBlueSpinner->set_float_limits(0.0, 1);
GLUI_Panel* lightDiffusePanel = glui->add_panel_to_panel(lightRollout, "Diffuse", GLUI_PANEL_EMBOSSED);
GLUI_Spinner *lightDiffuseRedSpinner = glui->add_spinner_to_panel(lightDiffusePanel, "Red ", GLUI_SPINNER_FLOAT, &relightingEffect->lightDiffuse[0], -1, gluiCallback);
lightDiffuseRedSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *lightDiffuseGreenSpinner = glui->add_spinner_to_panel(lightDiffusePanel, "Green ", GLUI_SPINNER_FLOAT, &relightingEffect->lightDiffuse[1], -1, gluiCallback);
lightDiffuseGreenSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *lightDiffuseBlueSpinner = glui->add_spinner_to_panel(lightDiffusePanel, "Blue ", GLUI_SPINNER_FLOAT, &relightingEffect->lightDiffuse[2], -1, gluiCallback);
lightDiffuseBlueSpinner->set_float_limits(0.0, 1);
GLUI_Panel* lightSpecularPanel = glui->add_panel_to_panel(lightRollout, "Specular", GLUI_PANEL_EMBOSSED);
GLUI_Spinner *lightSpecularRedSpinner = glui->add_spinner_to_panel(lightSpecularPanel, "Red ", GLUI_SPINNER_FLOAT, &relightingEffect->lightSpecular[0], -1, gluiCallback);
lightSpecularRedSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *lightSpecularGreenSpinner = glui->add_spinner_to_panel(lightSpecularPanel, "Green ", GLUI_SPINNER_FLOAT, &relightingEffect->lightSpecular[1], -1, gluiCallback);
lightSpecularGreenSpinner->set_float_limits(0.0, 1);
GLUI_Spinner *lightSpecularBlueSpinner = glui->add_spinner_to_panel(lightSpecularPanel, "Blue ", GLUI_SPINNER_FLOAT, &relightingEffect->lightSpecular[2], -1, gluiCallback);
lightSpecularBlueSpinner->set_float_limits(0.0, 1);
glui->add_statictext_to_panel(relightingRollout, "");
GLUI_Spinner *specularPowerSpinner = glui->add_spinner_to_panel(relightingRollout, "Shininess ", GLUI_SPINNER_FLOAT, &relightingEffect->shininess, -1, gluiCallback);
specularPowerSpinner->set_float_limits(0.0, 50);
//CARTOON SHADING
GLUI_Rollout *cartoonRollout = glui->add_rollout("Cartoon Shading", 0);
cartoonRollout->set_w(218);
glui->add_statictext_to_panel(cartoonRollout, "")->set_w(200);
GLUI_Panel *filteringPanel = glui->add_panel_to_panel(cartoonRollout, "Filtering");
glui->add_statictext_to_panel(filteringPanel, "");
GLUI_RadioGroup *filteringMethodRadioGroup = glui->add_radiogroup_to_panel(filteringPanel, &cartoonEffect->filteringMethod, -1, gluiCallback);
glui->add_radiobutton_to_group(filteringMethodRadioGroup, "None");
glui->add_radiobutton_to_group(filteringMethodRadioGroup, "Bilateral");
glui->add_radiobutton_to_group(filteringMethodRadioGroup, "Kuwahara");
glui->add_statictext_to_panel(filteringPanel, "");
glui->add_checkbox_to_panel(filteringPanel, "Quantize Colours", &cartoonEffect->quantize, -1, gluiCallback);
//Bilateral.
glui->add_statictext_to_panel(filteringPanel, "");
GLUI_Rollout* bilateralRollout = glui->add_rollout_to_panel(filteringPanel, "Bilateral", 0, GLUI_PANEL_EMBOSSED);
GLUI_Spinner *bilateralFilterPassesSpinner = glui->add_spinner_to_panel(bilateralRollout, "Filter Passes ", GLUI_SPINNER_INT, &cartoonEffect->bilateralFilterPasses, -1, gluiCallback);
bilateralFilterPassesSpinner->set_int_limits(1, 10);
GLUI_Spinner *bilateralKernelSizeSpinner = glui->add_spinner_to_panel(bilateralRollout, "Kernel Size ", GLUI_SPINNER_INT, &cartoonEffect->bilateralKernelSize, -1, gluiCallback);
bilateralKernelSizeSpinner->set_int_limits(1, 100);
GLUI_Spinner *bilateralSigmaSpinner = glui->add_spinner_to_panel(bilateralRollout, "Sample Deviation ", GLUI_SPINNER_FLOAT, &cartoonEffect->bilateralSigma, -1, gluiCallback);
bilateralSigmaSpinner->set_float_limits(0.001, 0.15);
//Kuwahara.
GLUI_Rollout* kuwaharaRollout = glui->add_rollout_to_panel(filteringPanel, "Kuwahara", 0, GLUI_PANEL_EMBOSSED);
GLUI_Spinner *kuwaharaFilterPassesSpinner = glui->add_spinner_to_panel(kuwaharaRollout, "Filter Passes ", GLUI_SPINNER_INT, &cartoonEffect->kuwaharaFilterPasses, -1, gluiCallback);
kuwaharaFilterPassesSpinner->set_int_limits(1, 10);
GLUI_Spinner *kuwaharaKernelSizeSpinner = glui->add_spinner_to_panel(kuwaharaRollout, "Kernel Size ", GLUI_SPINNER_INT, &cartoonEffect->kuwaharaKernelSize, -1, gluiCallback);
kuwaharaKernelSizeSpinner->set_int_limits(1, 100);
//Edge
glui->add_statictext_to_panel(cartoonRollout, "");
GLUI_Panel *edgeDetectionPanel = glui->add_panel_to_panel(cartoonRollout, "Edge Detection");
glui->add_statictext_to_panel(edgeDetectionPanel, "");
GLUI_RadioGroup *edgeMethodRadioGroup = glui->add_radiogroup_to_panel(edgeDetectionPanel, &cartoonEffect->edgeMethod, -1, gluiCallback);
glui->add_radiobutton_to_group(edgeMethodRadioGroup, "None");
glui->add_radiobutton_to_group(edgeMethodRadioGroup, "Depth Discontinuity");
glui->add_radiobutton_to_group(edgeMethodRadioGroup, "Sobel Depth");
glui->add_radiobutton_to_group(edgeMethodRadioGroup, "Sobel Colour");
glui->add_statictext_to_panel(edgeDetectionPanel, "");
GLUI_Spinner *edgeThresholdSpinner = glui->add_spinner_to_panel(edgeDetectionPanel, "Threshold ", GLUI_SPINNER_FLOAT, &cartoonEffect->edgeThreshold, -1, gluiCallback);
edgeThresholdSpinner->set_float_limits(0.0, 2.0);
//glui->add_button("Quit", 0, (GLUI_Update_CB) exit);
/** Tell GLUI window which other window to recognize as the main gfx window **/
glui->set_main_gfx_window(window);
//GLUI_Master.set_glutIdleFunc(NULL);
}
示例15: main
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;
}