void buildInterface(){ myGluiWindow = GLUI_Master.create_glui ("Options", 0, windowX+500, windowY); /*file open options, textbox and buttons*/ myGluiWindow->add_edittext("Input file: ", GLUI_EDITTEXT_TEXT, text, FILE_INPUT, myGluiCallback); myGluiWindow->add_button ("Open", OPEN_BUTTON, myGluiCallback); /*adding new panel*/ GLUI_Panel *myPanel1 = myGluiWindow->add_panel("Object Properties"); /*list box for mesh displaying*/ GLUI_Listbox *myListBox= myGluiWindow->add_listbox_to_panel (myPanel1, "Display Mesh", &listbox_id, DISPLAY_LISTBOX, myGluiCallback); myListBox->add_item (1, "Flat Shaded"); myListBox->add_item (2, "Smooth Shaded"); myListBox->add_item (3, "Wireframe"); myListBox->add_item (4, "Shaded with edges"); /*adding one more panel*/ GLUI_Panel *myPanel2 = myGluiWindow->add_panel("Transformation"); GLUI_Panel *mySubPanel1 = myGluiWindow->add_panel_to_panel(myPanel2, ""); /*translate X, Y*/ GLUI_Translation *myTranslation = myGluiWindow->add_translation_to_panel(mySubPanel1, "Translation XY", GLUI_TRANSLATION_XY, translate_xy, TRANSLATION_XY, myGluiCallback); myTranslation->set_speed(0.005); /*adding a new column (side by side display)*/ myGluiWindow->add_column_to_panel(mySubPanel1, false); /*translate Z*/ GLUI_Translation *myTranslationZ = myGluiWindow->add_translation_to_panel(mySubPanel1, "Translation Z", GLUI_TRANSLATION_Z, &translate_z, TRANSLATION_Z, myGluiCallback); myTranslationZ->set_speed(0.005); /*adding sub panel*/ GLUI_Panel *mySubPanel2 = myGluiWindow->add_panel_to_panel(myPanel2, ""); /*set up rotation*/ myGluiWindow->add_rotation_to_panel(mySubPanel2, "Rotation", rotation_matrix, ROTATION, myGluiCallback); /*adding a new column (side by side display)*/ myGluiWindow->add_column_to_panel(mySubPanel2, false); /*set up zoom (i.e. scale)*/ GLUI_Spinner *mySpinner = myGluiWindow->add_spinner_to_panel (mySubPanel2, "Scale", GLUI_SPINNER_FLOAT, &scale, SCALE_SPINNER, myGluiCallback); mySpinner->set_float_limits (-4.0, 4.0); /*save mesh*/ myGluiWindow->add_edittext("Output file: ", GLUI_EDITTEXT_TEXT, optext, FILE_OUTPUT, myGluiCallback); myGluiWindow->add_button ("Save", SAVE_BUTTON, myGluiCallback); /*add quit button*/ myGluiWindow->add_button ("Quit", QUIT_BUTTON, myGluiCallback); GLUI_Master.set_glutIdleFunc(myIdle); GLUI_Master.set_glutReshapeFunc(myReshape); myGluiWindow->set_main_gfx_window(myWindow); }
GLUI_Translation *GLUI::add_translation_to_panel( GLUI_Panel *panel, char *name, int trans_type, float *value_ptr, int id, GLUI_Update_CB callback ) { GLUI_Translation *control; control = new GLUI_Translation; if ( control ) { control->set_ptr_val( value_ptr ); control->user_id = id; control->set_name( name ); control->callback = callback; add_control( panel, control ); control->init_live(); control->trans_type = trans_type; if ( trans_type == GLUI_TRANSLATION_XY ) { control->float_array_size = 2; } else if ( trans_type == GLUI_TRANSLATION_X ) { control->float_array_size = 1; } else if ( trans_type == GLUI_TRANSLATION_Y ) { control->float_array_size = 1; } else if ( trans_type == GLUI_TRANSLATION_Z ) { control->float_array_size = 1; } return control; } else { return NULL; } }
void InitGlui( ) { glutInitWindowPosition( INIT_WINDOW_SIZE + 50, 0 ); Glui = GLUI_Master.create_glui( (char *) GLUITITLE ); Glui->add_statictext( (char *) GLUITITLE ); Glui->add_separator( ); Glui->add_checkbox( "Axes", &AxesOn ); Glui->add_checkbox( "Perspective", &WhichProjection ); Glui->add_checkbox( "Show Performance", &ShowPerformance ); GLUI_Panel *panel = Glui->add_panel( "Object Transformation" ); GLUI_Rotation *rot = Glui->add_rotation_to_panel( panel, "Rotation", (float *) RotMatrix ); rot->set_spin( 1.0 ); Glui->add_column_to_panel( panel, GLUIFALSE ); GLUI_Translation *scale = Glui->add_translation_to_panel( panel, "Scale", GLUI_TRANSLATION_Y , &Scale2 ); scale->set_speed( 0.01f ); Glui->add_column_to_panel( panel, FALSE ); GLUI_Translation *trans = Glui->add_translation_to_panel( panel, "Trans XY", GLUI_TRANSLATION_XY, &TransXYZ[0] ); trans->set_speed( 1.1f ); Glui->add_column_to_panel( panel, FALSE ); trans = Glui->add_translation_to_panel( panel, "Trans Z", GLUI_TRANSLATION_Z , &TransXYZ[2] ); trans->set_speed( 1.1f ); panel = Glui->add_panel( "", FALSE ); Glui->add_button_to_panel( panel, "Reset", RESET, (GLUI_Update_CB) Buttons ); Glui->add_column_to_panel( panel, FALSE ); Glui->add_button_to_panel( panel, "Go !", GO, (GLUI_Update_CB) Buttons ); Glui->add_column_to_panel( panel, FALSE ); Glui->add_button_to_panel( panel, "Quit", QUIT, (GLUI_Update_CB) Buttons ); Glui->set_main_gfx_window( MainWindow ); GLUI_Master.set_glutIdleFunc( NULL ); }
int main(int argc, char** argv) { /* standard GLUT initialization */ glutInit(&argc,argv); // Set up model Window glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); /* default, not needed */ glutInitWindowSize(W_MODEL, H_MODEL); glutInitWindowPosition(X_MODEL, Y_MODEL); modelWindow = glutCreateWindow("Mimicry"); /* window title */ glClearColor(0.5, 0.5, 0.5, 1); glutDisplayFunc(displayModel); glutReshapeFunc(reshapeModel); glutIdleFunc(0); // Set up statistics Window /* glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(W_STATS, H_STATS); glutInitWindowPosition(X_STATS, Y_STATS); statsWindow = glutCreateWindow("Statistics"); glClearColor(0, 0, 0, 1); glutDisplayFunc(displayStats); glutReshapeFunc(reshapeStats); */ glutKeyboardFunc(keyboard); // GLUI initialization glui = GLUI_Master.create_glui("Controls", 0, X_GLUI, Y_GLUI); // Initialization panel GLUI_Panel *initializationPanel = glui->add_panel("Initialization"); ctlGeneBankName = glui->add_edittext_to_panel(initializationPanel, "File ", GLUI_EDITTEXT_TEXT); ctlGeneBankName->set_w(150); ctlGeneBankName->enable(); ctlGeneBankName->set_text("initialconfig.xml"); glui->add_column_to_panel(initializationPanel, true); ctlStart = glui->add_button_to_panel(initializationPanel, "Start", START, control); ctlStop = glui->add_button_to_panel(initializationPanel, "Stop", STOP, control); ctlStop->disable(); ctlPause = glui->add_button_to_panel(initializationPanel, "Pause/Continue", PAUSE, control); ctlPause->disable(); // Run-time controls panel GLUI_Panel *runtimePanel = glui->add_panel("Runtime Parameters"); // Prey Runtime configuration panel GLUI_Panel *preyConfigPanel = glui->add_panel_to_panel(runtimePanel, "Prey Configuration"); GLUI_Spinner *preySize = glui->add_spinner_to_panel( preyConfigPanel, "Prey Size", GLUI_SPINNER_INT, &System::PREY_SIZE, PREY_SIZE, control); preySize->set_int_limits(1, 5); GLUI_Panel *preyReprodConfigPanel = glui->add_panel_to_panel(preyConfigPanel, "Reproduction"); GLUI_Spinner *preyReproductionAgeLimit = glui->add_spinner_to_panel( preyReprodConfigPanel, "Age Limit", GLUI_SPINNER_INT, &System::PREY_REPRODUCTION_AGE_LIMIT, PREY_REPRODUCTION_AGE_LIMIT, control); preyReproductionAgeLimit->set_int_limits(100, 10000); GLUI_Spinner *preyReproductionInterval = glui->add_spinner_to_panel( preyReprodConfigPanel, "Interval", GLUI_SPINNER_INT, &System::PREY_REPRODUCTION_INTERVAL, PREY_REPRODUCTION_INTERVAL, control); preyReproductionInterval->set_int_limits(100, 10000); GLUI_Panel *preyMutationRatePanel = glui->add_panel_to_panel(preyConfigPanel, "Mutation Rate"); GLUI_Spinner *patternMutationRate = glui->add_spinner_to_panel( preyMutationRatePanel, "Pattern", GLUI_SPINNER_FLOAT, &System::PATTERN_MUTATION_RATE, PATTERN_MUTATION_RATE, control); patternMutationRate->set_int_limits(0.01, 1.0); GLUI_Spinner *preyGenomeMutationRate = glui->add_spinner_to_panel( preyMutationRatePanel, "Genome", GLUI_SPINNER_FLOAT, &System::PREY_GENOME_MUTATION_RATE, PREY_GENOME_MUTATION_RATE, control); preyGenomeMutationRate->set_int_limits(0.01, 1.0); GLUI_Spinner *preyDemiseAge = glui->add_spinner_to_panel( preyConfigPanel, "Demise Age", GLUI_SPINNER_INT, &System::PREY_DEMISE_AGE, PREY_DEMISE_AGE, control); preyDemiseAge->set_int_limits(100, 10000); glui->add_column_to_panel(runtimePanel, true); // Predator Runtime configuration panel GLUI_Panel *predatorConfigPanel = glui->add_panel_to_panel(runtimePanel, "Predator Configuration"); GLUI_Panel *predatorReprodConfigPanel = glui->add_panel_to_panel(predatorConfigPanel, "Reproduction"); GLUI_Spinner *predatorReproductionAgeLimit = glui->add_spinner_to_panel( predatorReprodConfigPanel, "Age Limit", GLUI_SPINNER_INT, &System::PREDATOR_REPRODUCTION_AGE_LIMIT, PREDATOR_REPRODUCTION_AGE_LIMIT, control); predatorReproductionAgeLimit->set_int_limits(100, 10000); GLUI_Spinner *predatorReproductionInterval = glui->add_spinner_to_panel( predatorReprodConfigPanel, "Interval", GLUI_SPINNER_INT, &System::PREDATOR_REPRODUCTION_INTERVAL, PREDATOR_REPRODUCTION_INTERVAL, control); predatorReproductionInterval->set_int_limits(100, 10000); GLUI_Panel *hopfieldNetworkConfg = glui->add_panel_to_panel(predatorConfigPanel, "Memory Configurations"); GLUI_Spinner *predatorMinMemorySize = glui->add_spinner_to_panel( hopfieldNetworkConfg, "Minimum", GLUI_SPINNER_INT, &System::MIN_MEMORY_SIZE, MIN_MEMORY_SIZE, control); predatorMinMemorySize->set_int_limits(1, 20); GLUI_Spinner *predatorMaxMemorySize = glui->add_spinner_to_panel( hopfieldNetworkConfg, "Maximum", GLUI_SPINNER_INT, &System::MAX_MEMORY_SIZE, MAX_MEMORY_SIZE, control); predatorMaxMemorySize->set_int_limits(2, 20); GLUI_Spinner *predatorGenomeMutationRate = glui->add_spinner_to_panel( predatorConfigPanel, "Mutation Rate", GLUI_SPINNER_FLOAT, &System::PREDATOR_GENOME_MUTATION_RATE, PREDATOR_GENOME_MUTATION_RATE, control); predatorGenomeMutationRate->set_int_limits(0.01, 1.0); GLUI_Spinner *predatorDemiseAge = glui->add_spinner_to_panel( predatorConfigPanel, "Demise Age", GLUI_SPINNER_INT, &System::PREDATOR_DEMISE_AGE, PREDATOR_DEMISE_AGE, control); predatorDemiseAge->set_int_limits(100, 10000); glui->add_column(true); // Model view panel GLUI_Panel *modelViewPanel = glui->add_panel("Model view"); ctlRot = glui->add_rotation_to_panel(modelViewPanel, "Orientation", gluiRotation); //glui->add_column_to_panel(modelViewPanel, true); GLUI_Translation *ctlTranslateXY = glui->add_translation_to_panel( modelViewPanel, "XY position", GLUI_TRANSLATION_XY, gluiPosition); //glui->add_column_to_panel(modelViewPanel, true); GLUI_Translation *ctlTranslateZ = glui->add_translation_to_panel( modelViewPanel, "Zoom", GLUI_TRANSLATION_Z, &gluiPosition[2], ZOOM, control); glui->add_separator_to_panel(modelViewPanel); glui->add_button_to_panel(modelViewPanel, "Reset view", RESET, control); glui->add_checkbox_to_panel(modelViewPanel, "Update model", &updateModel); glui->add_checkbox_to_panel(modelViewPanel, "Update statistics", &updateStats); // Run-time controls panel GLUI_Panel *controlsPanel = glui->add_panel("Runtime Controls"); // View Selection panel GLUI_Panel *viewSelectionPanel = glui->add_panel_to_panel(controlsPanel, "View Selection"); glui->add_checkbox_to_panel(viewSelectionPanel, "Outline", &System::showOutline); glui->add_checkbox_to_panel(viewSelectionPanel, "View Cells", &System::showCells); // Reports panel GLUI_Panel *reportPanel = glui->add_panel_to_panel(controlsPanel, "Reports"); glui->add_button_to_panel(reportPanel, "Rings", RING_REPORT, control); ctlTranslateXY->set_speed(0.1); ctlTranslateZ->set_speed(0.1); /* display callback invoked when window opened */ glutMainLoop(); /* enter event loop */ return 0; }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowPosition(50, 50); glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT); main_window = glutCreateWindow("OBJ Loader"); glutDisplayFunc(myGlutDisplay); glutReshapeFunc(myGlutReshape); glutMouseFunc(myGlutMouse); glutMotionFunc(myGlutMotion); initScene(); Objects.push_back(Object()); glui = GLUI_Master.create_glui("OBJ Loader GUI", 0, 600, 50); GLUI_Panel *objPanel = glui->add_panel(""); GLUI_Panel *objPanel2 = glui->add_panel_to_panel(objPanel, "", 0); objFileNameTextField = glui->add_edittext_to_panel(objPanel2, "Filename:",GLUI_EDITTEXT_TEXT,NULL,OBJ_TEXTFIELD,textCB); objFileNameTextField->set_text("cow"); glui->add_button_to_panel(objPanel2, "Load", LOAD_BUTTON, buttonCB); glui->add_button_to_panel(objPanel2, "Screenshot (or it didn't happen)", SCREENSHOT, buttonCB); glui->add_column_to_panel(objPanel, 0); GLUI_Panel *projPanel = glui->add_panel_to_panel(objPanel, "", 0); GLUI_RadioGroup *projGroup = glui->add_radiogroup_to_panel(projPanel, (int*) &projType, -1, projCB); glui->add_radiobutton_to_group(projGroup, "Orthographic"); glui->add_radiobutton_to_group(projGroup, "Perspective"); projGroup->set_int_val(ORTHO); GLUI_Spinner *fovSpinner = glui->add_spinner_to_panel(projPanel, "FOV", GLUI_SPINNER_INT, &fov, FOV, projCB); fovSpinner->set_int_limits(FOVMIN, FOVMAX); fovSpinner->set_int_val(30); glui->add_column_to_panel(projPanel, 0); GLUI_Translation *scale = glui->add_translation_to_panel(projPanel, "Scale", GLUI_TRANSLATION_Y , &scaleFactor, -1, (GLUI_Update_CB) projCB); scale->set_speed(0.005f); GLUI_Panel *lightingPanel = glui->add_panel("", 0); GLUI_Panel *objMaterialPanel = glui->add_panel_to_panel(lightingPanel, "Object material"); GLUI_Panel *objDiffusePanel = glui->add_panel_to_panel(objMaterialPanel, "Diffuse"); GLUI_Spinner *kdRedValue = glui->add_spinner_to_panel(objDiffusePanel, "Red", GLUI_SPINNER_FLOAT, &objectMat.diffuse[0], 0, colorCB); kdRedValue->set_float_limits(0.f, 1.f); kdRedValue->set_float_val(1.f); GLUI_Spinner *kdGreenValue = glui->add_spinner_to_panel(objDiffusePanel, "Green", GLUI_SPINNER_FLOAT, &objectMat.diffuse[1], 0, colorCB); kdGreenValue->set_float_limits(0.f, 1.f); kdGreenValue->set_float_val(1.f); GLUI_Spinner *kdBlueValue = glui->add_spinner_to_panel(objDiffusePanel, "Blue", GLUI_SPINNER_FLOAT, &objectMat.diffuse[2], 0, colorCB); kdBlueValue->set_float_limits(0.f, 1.f); kdBlueValue->set_float_val(1.f); GLUI_Panel *objAmbientPanel = glui->add_panel_to_panel(objMaterialPanel, "Ambient"); GLUI_Spinner *kaRedValue = glui->add_spinner_to_panel(objAmbientPanel, "Red", GLUI_SPINNER_FLOAT, &objectMat.ambient[0], 0, colorCB); kaRedValue->set_float_limits(0.f, 1.f); kaRedValue->set_float_val(1.f); GLUI_Spinner *kaGreenValue = glui->add_spinner_to_panel(objAmbientPanel, "Green", GLUI_SPINNER_FLOAT, &objectMat.ambient[1], 0, colorCB); kaGreenValue->set_float_limits(0.f, 1.f); kaGreenValue->set_float_val(1.f); GLUI_Spinner *kaBlueValue = glui->add_spinner_to_panel(objAmbientPanel, "Blue", GLUI_SPINNER_FLOAT, &objectMat.ambient[2], 0, colorCB); kaBlueValue->set_float_limits(0.f, 1.f); kaBlueValue->set_float_val(1.f); GLUI_Panel *objSpecularPanel = glui->add_panel_to_panel(objMaterialPanel, "Specular"); GLUI_Spinner *ksRedValue = glui->add_spinner_to_panel(objSpecularPanel, "Red", GLUI_SPINNER_FLOAT, &objectMat.specular[0], 0, colorCB); ksRedValue->set_float_limits(0.f, 1.f); ksRedValue->set_float_val(1.f); GLUI_Spinner *ksGreenValue = glui->add_spinner_to_panel(objSpecularPanel, "Green", GLUI_SPINNER_FLOAT, &objectMat.specular[1], 0, colorCB); ksGreenValue->set_float_limits(0.f, 1.f); ksGreenValue->set_float_val(1.f); GLUI_Spinner *ksBlueValue = glui->add_spinner_to_panel(objSpecularPanel, "Blue", GLUI_SPINNER_FLOAT, &objectMat.specular[2], 0, colorCB); ksBlueValue->set_float_limits(0.f, 1.f); ksBlueValue->set_float_val(1.f); glui->add_column_to_panel(lightingPanel,0); GLUI_Panel *lightPanel = glui->add_panel_to_panel(lightingPanel, "Light source"); GLUI_Panel *lightDiffusePanel = glui->add_panel_to_panel(lightPanel, "Diffuse"); GLUI_Spinner *ldRedValue = glui->add_spinner_to_panel(lightDiffusePanel, "Red", GLUI_SPINNER_FLOAT, &lightCoeffs.diffuse[0], -1, colorCB); ldRedValue->set_float_limits(0.f, 1.f); ldRedValue->set_float_val(1.f); GLUI_Spinner *ldGreenValue = glui->add_spinner_to_panel(lightDiffusePanel, "Green", GLUI_SPINNER_FLOAT, &lightCoeffs.diffuse[1], -1, colorCB); ldGreenValue->set_float_limits(0.f, 1.f); ldGreenValue->set_float_val(1.f); GLUI_Spinner *ldBlueValue = glui->add_spinner_to_panel(lightDiffusePanel, "Blue", GLUI_SPINNER_FLOAT, &lightCoeffs.diffuse[2], -1, colorCB); ldBlueValue->set_float_limits(0.f, 1.f); ldBlueValue->set_float_val(1.f); GLUI_Panel *lightAmbientPanel = glui->add_panel_to_panel(lightPanel, "Ambient"); GLUI_Spinner *laRedValue = glui->add_spinner_to_panel(lightAmbientPanel, "Red", GLUI_SPINNER_FLOAT, &lightCoeffs.ambient[0], -1, colorCB); laRedValue->set_float_limits(0.f, 1.f); laRedValue->set_float_val(1.f); GLUI_Spinner *laGreenValue = glui->add_spinner_to_panel(lightAmbientPanel, "Green", GLUI_SPINNER_FLOAT, &lightCoeffs.ambient[1], -1, colorCB); laGreenValue->set_float_limits(0.f, 1.f); laGreenValue->set_float_val(1.f); GLUI_Spinner *laBlueValue = glui->add_spinner_to_panel(lightAmbientPanel, "Blue", GLUI_SPINNER_FLOAT, &lightCoeffs.ambient[2], -1, colorCB); laBlueValue->set_float_limits(0.f, 1.f); laBlueValue->set_float_val(1.f); GLUI_Panel *lightSpecularPanel = glui->add_panel_to_panel(lightPanel, "Specular"); GLUI_Spinner *lsRedValue = glui->add_spinner_to_panel(lightSpecularPanel, "Red", GLUI_SPINNER_FLOAT, &lightCoeffs.specular[0], -1, colorCB); lsRedValue->set_float_limits(0.f, 1.f); lsRedValue->set_float_val(1.f); GLUI_Spinner *lsGreenValue = glui->add_spinner_to_panel(lightSpecularPanel, "Green", GLUI_SPINNER_FLOAT, &lightCoeffs.specular[1], -1, colorCB); lsGreenValue->set_float_limits(0.f, 1.f); lsGreenValue->set_float_val(1.f); GLUI_Spinner *lsBlueValue = glui->add_spinner_to_panel(lightSpecularPanel, "Blue", GLUI_SPINNER_FLOAT, &lightCoeffs.specular[2], -1, colorCB); lsBlueValue->set_float_limits(0.f, 1.f); lsBlueValue->set_float_val(1.f); GLUI_Panel *texturingPanel = glui->add_panel("Texturing"); GLUI_Listbox *textureListbox = glui->add_listbox_to_panel(texturingPanel, "Texture", (int*)&texture, -1, textureCB); textureListbox->add_item(NOTEXTURE, "No texture"); textureListbox->add_item(OSU, "OSU"); textureListbox->add_item(EARTH, "EARTH"); textureListbox->add_item(WOOD, "WOOD"); textureListbox->set_int_val(NOTEXTURE); GLUI_Panel *texFiltersPanel = glui->add_panel_to_panel(texturingPanel, "", 0); GLUI_Panel *minFilterPanel = glui->add_panel_to_panel(texFiltersPanel, "Minifying filter", 1); GLUI_RadioGroup *minFilterGroup = glui->add_radiogroup_to_panel(minFilterPanel, (int*) &texMinFilter, -1, textureCB); glui->add_radiobutton_to_group(minFilterGroup, "Linear"); glui->add_radiobutton_to_group(minFilterGroup, "Nearest"); minFilterGroup->set_int_val(LINEAR); GLUI_Panel *magFilterPanel = glui->add_panel_to_panel(texFiltersPanel, "Magnifying filter", 1); GLUI_RadioGroup *magFilterGroup = glui->add_radiogroup_to_panel(magFilterPanel, (int*) &texMagFilter, -1, textureCB); glui->add_radiobutton_to_group(magFilterGroup, "Linear"); glui->add_radiobutton_to_group(magFilterGroup, "Nearest"); magFilterGroup->set_int_val(LINEAR); glui->add_column_to_panel(texFiltersPanel, 0); GLUI_Panel *texWrapSPanel = glui->add_panel_to_panel(texFiltersPanel, "Wrapping S", 1); GLUI_RadioGroup *texWrapSGroup = glui->add_radiogroup_to_panel(texWrapSPanel, (int*) &texWrap_S, -1, textureCB); glui->add_radiobutton_to_group(texWrapSGroup, "Repeat"); glui->add_radiobutton_to_group(texWrapSGroup, "Clamp to edge"); texWrapSGroup->set_int_val(CLAMPTOEDGE); GLUI_Panel *texWrapTPanel = glui->add_panel_to_panel(texFiltersPanel, "Wrapping T", 1); GLUI_RadioGroup *texWrapTGroup = glui->add_radiogroup_to_panel(texWrapTPanel, (int*) &texWrap_T, -1, textureCB); glui->add_radiobutton_to_group(texWrapTGroup, "Repeat"); glui->add_radiobutton_to_group(texWrapTGroup, "Clamp to edge"); texWrapTGroup->set_int_val(CLAMPTOEDGE); GLUI_Listbox *texEnvListbox = glui->add_listbox_to_panel(texturingPanel, "Environment", (int*)&texEnv, -1, textureCB); texEnvListbox->add_item(REPLACE, "GL_REPLACE"); texEnvListbox->add_item(MODULATE, "GL_MODULATE"); texEnvListbox->add_item(DECAL, "GL_DECAL"); texEnvListbox->add_item(BLEND, "GL_BLEND"); texEnvListbox->set_int_val(MODULATE); GLUI_Listbox *texGenListbox = glui->add_listbox_to_panel(texturingPanel, "UV Generation", (int*)&texGen, -1, textureCB); texGenListbox->add_item(OBJECT, "Object Linear"); texGenListbox->add_item(EYE, "Eye Linear"); texGenListbox->add_item(SPHERE, "Sphere Map"); texGenListbox->set_int_val(OBJECT); GLUI_Panel *shadingPanel = glui->add_panel("Shading"); GLUI_RadioGroup *shadingGroup = glui->add_radiogroup_to_panel(shadingPanel, (int*) &shadingModel, -1, shadingCB); glui->add_radiobutton_to_group(shadingGroup, "Flat"); glui->add_radiobutton_to_group(shadingGroup, "Smooth"); shadingGroup->set_int_val(SMOOTH); GLUI_Listbox *shaderListbox = glui->add_listbox_to_panel(shadingPanel, "Shader", (int*)&shader, -1, shadingCB); shaderListbox->add_item(NOSHADER, "Fixed function"); shaderListbox->add_item(PASS_THROUGH, "Pass through"); shaderListbox->add_item(DIFFUSE, "Lambert illumination"); shaderListbox->add_item(PHONG, "Phong illumination"); shaderListbox->add_item(TOON, "Toon shading"); shaderListbox->add_item(PROCEDURAL, "Procedural texture"); shaderListbox->set_int_val(PASS_THROUGH); glui->set_main_gfx_window(main_window); // We register the idle callback with GLUI, *not* with GLUT GLUI_Master.set_glutIdleFunc(NULL); glui->sync_live(); glutMainLoop(); return EXIT_SUCCESS; }