Example #1
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();
}
Example #2
0
void createInterface() {

    GLUI *glui = GLUI_Master.create_glui("RGBD Effects", 0, 1050, 100);

    //Effect Selection
    GLUI_Panel *effectSelectionPanel = glui->add_panel("Effect");
    GLUI_RadioGroup *effectRadioGroup = glui->add_radiogroup_to_panel(effectSelectionPanel, &selectedEffect, -1, gluiCallback);
    glui->add_radiobutton_to_group(effectRadioGroup, "Maps");
    glui->add_radiobutton_to_group(effectRadioGroup, "Fog");
    glui->add_radiobutton_to_group(effectRadioGroup, "Depth of Field");
    glui->add_radiobutton_to_group(effectRadioGroup, "Relighting");
    glui->add_radiobutton_to_group(effectRadioGroup, "Cartoon Shading");

    //Depth range
    glui->add_statictext("");
    GLUI_Panel *depthRangePanel = glui->add_panel("Depth Range");
    GLUI_Checkbox *adaptiveDepthRangeCheckBox = glui->add_checkbox_to_panel(depthRangePanel, "Adaptive ", &adaptiveDepthRange, -1, gluiCallback);
    GLUI_Spinner *nearPlaneSpinner = glui->add_spinner_to_panel(depthRangePanel, "Near Plane ", GLUI_SPINNER_FLOAT, &nearPlane, -1, gluiCallback);
    nearPlaneSpinner->set_float_limits(10, 2000);
    GLUI_Spinner *farPlaneSpinner = glui->add_spinner_to_panel(depthRangePanel, "Far Plane ", GLUI_SPINNER_FLOAT, &farPlane, -1, gluiCallback);
    farPlaneSpinner->set_float_limits(10, 2000);

    //View maps
    GLUI_Rollout *mapRollout = glui->add_rollout("Maps", 0);
    mapRollout->set_w(218);
    glui->add_statictext_to_panel(mapRollout, "")->set_w(200);
    GLUI_RadioGroup *mapRadioGroup = glui->add_radiogroup_to_panel(mapRollout, &mapEffect->selectedMap, -1, gluiCallback);
    glui->add_radiobutton_to_group(mapRadioGroup, "Colour");
    glui->add_radiobutton_to_group(mapRadioGroup, "Depth");
    glui->add_radiobutton_to_group(mapRadioGroup, "Normals");

    GLUI_Panel* mapPreblurPanel = glui->add_panel_to_panel(mapRollout, "Pre-processing");
    GLUI_RadioGroup *mapPreblurRadioGroup = glui->add_radiogroup_to_panel(mapPreblurPanel, &mapEffect->selectedPreFilter, -1, gluiCallback);
    glui->add_radiobutton_to_group(mapPreblurRadioGroup, "None");
    glui->add_radiobutton_to_group(mapPreblurRadioGroup, "Blur");
    glui->add_radiobutton_to_group(mapPreblurRadioGroup, "Bilateral");

    GLUI_Spinner *mapPreblurPassesSpinner = glui->add_spinner_to_panel(mapPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &mapEffect->preblurFilterPasses, -1, gluiCallback);
    mapPreblurPassesSpinner->set_int_limits(0, 10);
    GLUI_Spinner *mapPreblurKernelSizeSpinner = glui->add_spinner_to_panel(mapPreblurPanel, "Kernel Size ", GLUI_SPINNER_INT, &mapEffect->preblurKernelSize, -1, gluiCallback);
    mapPreblurKernelSizeSpinner->set_int_limits(1, 100);
    GLUI_Spinner *mapPreblurSigmaSpinner = glui->add_spinner_to_panel(mapPreblurPanel, "Sample Deviation ", GLUI_SPINNER_FLOAT, &mapEffect->preblurSigma, -1, gluiCallback);
    mapPreblurSigmaSpinner->set_float_limits(0.001, 0.15);



    //FOG
    GLUI_Rollout *fogRollout = glui->add_rollout("Fog", 0);
    fogRollout->set_w(218);
    glui->add_statictext_to_panel(fogRollout, "")->set_w(200);
    GLUI_Spinner *fogDensitySpinner = glui->add_spinner_to_panel(fogRollout, "Density ", GLUI_SPINNER_FLOAT, &fogEffect->fogDensity, -1, gluiCallback);
    fogDensitySpinner->set_float_limits(0.0, 20.0);
    GLUI_Spinner *fogAmountSpinner = glui->add_spinner_to_panel(fogRollout, "Amount ", GLUI_SPINNER_FLOAT, &fogEffect->fogAmount, -1, gluiCallback);
    fogAmountSpinner->set_float_limits(0.0, 1);

    glui->add_statictext_to_panel(fogRollout, "");
    GLUI_Panel* fogPreblurPanel = glui->add_panel_to_panel(fogRollout, "Preblur");

    GLUI_Spinner *fogPreblurPassesSpinner = glui->add_spinner_to_panel(fogPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &fogEffect->preblurFilterPasses, -1, gluiCallback);
    fogPreblurPassesSpinner->set_int_limits(0, 10);
    GLUI_Spinner *fogPreblurKernelSizeSpinner = glui->add_spinner_to_panel(fogPreblurPanel, "Kernel Size ", GLUI_SPINNER_INT, &fogEffect->preblurKernelSize, -1, gluiCallback);
    fogPreblurKernelSizeSpinner->set_int_limits(1, 100);
    GLUI_Spinner *fogPreblurSigmaSpinner = glui->add_spinner_to_panel(fogPreblurPanel, "Sample Deviation ", GLUI_SPINNER_FLOAT, &fogEffect->preblurSigma, -1, gluiCallback);
    fogPreblurSigmaSpinner->set_float_limits(0.001, 0.15);


    glui->add_statictext_to_panel(fogRollout, "");
    GLUI_Panel* fogColourPanel = glui->add_panel_to_panel(fogRollout, "Colour", GLUI_PANEL_EMBOSSED);

    GLUI_Spinner *fogColourRedSpinner = glui->add_spinner_to_panel(fogColourPanel, "Red ", GLUI_SPINNER_FLOAT, &fogEffect->fogColourRed, -1, gluiCallback);
    fogColourRedSpinner->set_float_limits(0.0, 1);
    GLUI_Spinner *fogColourGreenSpinner = glui->add_spinner_to_panel(fogColourPanel, "Green ", GLUI_SPINNER_FLOAT, &fogEffect->fogColourGreen, -1, gluiCallback);
    fogColourGreenSpinner->set_float_limits(0.0, 1);
    GLUI_Spinner *fogColourBlueSpinner = glui->add_spinner_to_panel(fogColourPanel, "Blue ", GLUI_SPINNER_FLOAT, &fogEffect->fogColourBlue, -1, gluiCallback);
    fogColourBlueSpinner->set_float_limits(0.0, 1);


    //DEPTH OF FIELD
    GLUI_Rollout *DOFRollout = glui->add_rollout("Depth of Field", 0);
    DOFRollout->set_w(218);
    glui->add_statictext_to_panel(DOFRollout, "")->set_w(200);

    GLUI_Spinner *distributionSigmaSpinner = glui->add_spinner_to_panel(DOFRollout, "Sample Deviation ", GLUI_SPINNER_FLOAT, &dofEffect->distributionSigma, -1, gluiCallback);
    distributionSigmaSpinner->set_float_limits(0.001, 0.15);
    GLUI_Spinner *sampleRadiusSpinner = glui->add_spinner_to_panel(DOFRollout, "Sample Radius ", GLUI_SPINNER_INT, &dofEffect->sampleRadius, -1, gluiCallback);
    sampleRadiusSpinner->set_int_limits(1, 40);


    GLUI_Spinner *lensDiameterSpinner = glui->add_spinner_to_panel(DOFRollout, "Aperture Size ", GLUI_SPINNER_FLOAT, &dofEffect->lensDiameter, -1, gluiCallback);
    lensDiameterSpinner->set_float_limits(0.001, 1);
    GLUI_Spinner *focalLengthSpinner = glui->add_spinner_to_panel(DOFRollout, "Focal Length ", GLUI_SPINNER_FLOAT, &dofEffect->focalLength, -1, gluiCallback);
    focalLengthSpinner->set_float_limits(0.001, 1);
    GLUI_Spinner *focalDepthSpinner = glui->add_spinner_to_panel(DOFRollout, "Focal Depth ", GLUI_SPINNER_FLOAT, &dofEffect->focalPlaneDepth, -1, gluiCallback);
    focalDepthSpinner->set_float_limits(0.0, 1);

    glui->add_statictext_to_panel(DOFRollout, "");
    GLUI_Panel* DOFPreblurPanel = glui->add_panel_to_panel(DOFRollout, "Preblur");

    GLUI_Spinner *DOFPreblurPassesSpinner = glui->add_spinner_to_panel(DOFPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &dofEffect->preblurFilterPasses, -1, gluiCallback);
    DOFPreblurPassesSpinner->set_int_limits(0, 10);
    GLUI_Spinner *DOFPreblurKernelSizeSpinner = glui->add_spinner_to_panel(DOFPreblurPanel, "Kernel Size ", GLUI_SPINNER_INT, &dofEffect->preblurKernelSize, -1, gluiCallback);
    DOFPreblurKernelSizeSpinner->set_int_limits(1, 100);
    GLUI_Spinner *DOFPreblurSigmaSpinner = glui->add_spinner_to_panel(DOFPreblurPanel, "Sample Deviation ", GLUI_SPINNER_FLOAT, &dofEffect->preblurSigma, -1, gluiCallback);
    DOFPreblurSigmaSpinner->set_float_limits(0.001, 0.15);


    //Relighting
    GLUI_Rollout *relightingRollout = glui->add_rollout("Relighting", 0);
    relightingRollout->set_w(218);
    glui->add_statictext_to_panel(relightingRollout, "")->set_w(200);
    glui->add_rotation_to_panel(relightingRollout, "Light Direction", relightingEffect->lightDirection, -1, gluiCallback);


    GLUI_Panel* relightingPreblurPanel = glui->add_panel_to_panel(relightingRollout, "Pre-processing");
    GLUI_RadioGroup *relightingPreblurRadioGroup = glui->add_radiogroup_to_panel(relightingPreblurPanel, &relightingEffect->selectedPreFilter, -1, gluiCallback);
    glui->add_radiobutton_to_group(relightingPreblurRadioGroup, "None");
    glui->add_radiobutton_to_group(relightingPreblurRadioGroup, "Blur");
    glui->add_radiobutton_to_group(relightingPreblurRadioGroup, "Bilateral");

    GLUI_Spinner *relightingPreblurPassesSpinner = glui->add_spinner_to_panel(relightingPreblurPanel, "Filter Passes ", GLUI_SPINNER_INT, &relightingEffect->preblurFilterPasses, -1, gluiCallback);
    relightingPreblurPassesSpinner->set_int_limits(0, 10);
    GLUI_Spinner *relightingPreblurKernelSizeSpinner = glui->add_spinner_to_panel(relightingPreblurPanel, "Kernel Size ", GLUI_SPINNER_INT, &relightingEffect->preblurKernelSize, -1, gluiCallback);
    relightingPreblurKernelSizeSpinner->set_int_limits(1, 100);
    GLUI_Spinner *relightingPreblurSigmaSpinner = glui->add_spinner_to_panel(relightingPreblurPanel, "Sample Deviation ", GLUI_SPINNER_FLOAT, &relightingEffect->preblurSigma, -1, gluiCallback);
    relightingPreblurSigmaSpinner->set_float_limits(0.001, 0.15);




    GLUI_Rollout* materialRollout = glui->add_rollout_to_panel(relightingRollout, "Material", 0, GLUI_PANEL_EMBOSSED);

    GLUI_Panel* materialAmbientPanel = glui->add_panel_to_panel(materialRollout, "Ambient", GLUI_PANEL_EMBOSSED);
    GLUI_Spinner *materialAmbientRedSpinner = glui->add_spinner_to_panel(materialAmbientPanel, "Red ", GLUI_SPINNER_FLOAT, &relightingEffect->materialAmbient[0], -1, gluiCallback);
    materialAmbientRedSpinner->set_float_limits(0.0, 1);
    GLUI_Spinner *materialAmbientGreenSpinner = glui->add_spinner_to_panel(materialAmbientPanel, "Green ", GLUI_SPINNER_FLOAT, &relightingEffect->materialAmbient[1], -1, gluiCallback);
    materialAmbientGreenSpinner->set_float_limits(0.0, 1);
    GLUI_Spinner *materialAmbientBlueSpinner = glui->add_spinner_to_panel(materialAmbientPanel, "Blue ", GLUI_SPINNER_FLOAT, &relightingEffect->materialAmbient[2], -1, gluiCallback);
    materialAmbientBlueSpinner->set_float_limits(0.0, 1);

    GLUI_Panel* materialDiffusePanel = glui->add_panel_to_panel(materialRollout, "Diffuse", GLUI_PANEL_EMBOSSED);
    GLUI_Spinner *materialDiffuseRedSpinner = glui->add_spinner_to_panel(materialDiffusePanel, "Red ", GLUI_SPINNER_FLOAT, &relightingEffect->materialDiffuse[0], -1, gluiCallback);
    materialDiffuseRedSpinner->set_float_limits(0.0, 1);
    GLUI_Spinner *materialDiffuseGreenSpinner = glui->add_spinner_to_panel(materialDiffusePanel, "Green ", GLUI_SPINNER_FLOAT, &relightingEffect->materialDiffuse[1], -1, gluiCallback);
    materialDiffuseGreenSpinner->set_float_limits(0.0, 1);
    GLUI_Spinner *materialDiffuseBlueSpinner = glui->add_spinner_to_panel(materialDiffusePanel, "Blue ", GLUI_SPINNER_FLOAT, &relightingEffect->materialDiffuse[2], -1, gluiCallback);
    materialDiffuseBlueSpinner->set_float_limits(0.0, 1);

    GLUI_Panel* materialSpecularPanel = glui->add_panel_to_panel(materialRollout, "Specular", GLUI_PANEL_EMBOSSED);
    GLUI_Spinner *materialSpecularRedSpinner = glui->add_spinner_to_panel(materialSpecularPanel, "Red ", GLUI_SPINNER_FLOAT, &relightingEffect->materialSpecular[0], -1, gluiCallback);
    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);


}
Example #3
0
  virtual bool Initialize()
  {
    cur_link=0;
    cur_driver=0;
    link_value = 0;
    driver_value = 0;
    draw_geom = 1;
    draw_bbs = 0;
    draw_com = 0;
    draw_frame = 0;
    draw_expanded = 0;
    draw_self_collision_tests = 0;
    hoverLink=hoverWidget=-1;
    hoverPt.setZero();
    pose_ik = 0;
    if(!RobotViewProgram::Initialize()) return false;
    self_colliding.resize(robot->links.size(),false);   
    UpdateConfig();

    /*
    //TEST: robot-to-robot IK test.  only works for AL5Dx2
    IKGoal test;
    test.link = 8;
    test.destLink = 16;
    test.localPosition.set(0,0,0.05);
    test.endPosition.set(0,0,0.05);
    //test.SetFixedPosition(test.endPosition);
    Matrix3 R;
    R.setRotateZ(120);
    test.SetFixedRotation(R);

    vector<IKGoal> problem(1,test);
    int iters=100;
    bool res=SolveIK(*robot,problem,1e-3,iters);
    printf("Solved IK: %d, %d iters, error %g\n",(int)res,iters,RobotIKError(*robot,test));
    UpdateConfig();
    */

    //setup GUI 
    glui = GLUI_Master.create_glui_subwindow(main_window,GLUI_SUBWINDOW_RIGHT);
    glui->set_main_gfx_window(main_window);
    GLUI_Panel* panel = glui->add_panel("Link controls");
    link_spinner = glui->add_spinner_to_panel(panel,"Index",GLUI_SPINNER_INT,&cur_link,LINK_SPINNER_ID,ControlFunc);
    link_spinner->set_int_limits(0,robot->links.size()-1,GLUI_LIMIT_WRAP);

    link_listbox = glui->add_listbox_to_panel(panel,"Name",&cur_link,LINK_LISTBOX_ID,ControlFunc);
    for(size_t i=0;i<robot->links.size();i++) {
      char buf[256];
      strcpy(buf,robot->linkNames[i].c_str());
      link_listbox->add_item(i,buf);
    }

    link_value_spinner = glui->add_spinner_to_panel(panel,"Angle",GLUI_SPINNER_FLOAT,&link_value,LINK_VALUE_SPINNER_ID,ControlFunc);
    link_info = glui->add_statictext_to_panel(panel,"Info");
    UpdateLinkValueGUI();
    UpdateLinkInfoGUI();

    panel = glui->add_panel("Driver controls");
    glui->add_checkbox_to_panel(panel,"Pose by IK",&pose_ik);
    driver_spinner = glui->add_spinner_to_panel(panel,"Index",GLUI_SPINNER_INT,&cur_driver,DRIVER_SPINNER_ID,ControlFunc);
    driver_spinner->set_int_limits(0,(int)robot->drivers.size()-1,GLUI_LIMIT_WRAP);

    driver_listbox = glui->add_listbox_to_panel(panel,"Name",&cur_driver,DRIVER_LISTBOX_ID,ControlFunc);
    for(size_t i=0;i<robot->drivers.size();i++) {
      char buf[256];
      strcpy(buf,robot->driverNames[i].c_str());
      driver_listbox->add_item(i,buf);
    }

    driver_value_spinner = glui->add_spinner_to_panel(panel,"Angle",GLUI_SPINNER_FLOAT,&driver_value,DRIVER_VALUE_SPINNER_ID,ControlFunc);
    driver_info = glui->add_statictext_to_panel(panel,"Info");

    glui->add_checkbox("Draw geometry",&draw_geom);
    glui->add_checkbox("Draw COM",&draw_com);
    glui->add_checkbox("Draw frame",&draw_frame);
    glui->add_checkbox("Draw bboxes",&draw_bbs);
    glui->add_checkbox("Draw expanded",&draw_expanded,DRAW_EXPANDED_CHECKBOX_ID,ControlFunc);
    glui->add_checkbox("Draw collision tests",&draw_self_collision_tests);
    UpdateDriverValueGUI();
    UpdateDriverInfoGUI();
    return true;
  }