当前位置: 首页>>代码示例>>C++>>正文


C++ GLUI_Spinner::set_float_val方法代码示例

本文整理汇总了C++中GLUI_Spinner::set_float_val方法的典型用法代码示例。如果您正苦于以下问题:C++ GLUI_Spinner::set_float_val方法的具体用法?C++ GLUI_Spinner::set_float_val怎么用?C++ GLUI_Spinner::set_float_val使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLUI_Spinner的用法示例。


在下文中一共展示了GLUI_Spinner::set_float_val方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv) {
    /* setup OpenGL */
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(INITIAL_WIDTH, INITIAL_HEIGHT);
    glutInitWindowPosition(50, 50);
    main_window = glutCreateWindow( "2DCube" );

    init();
    glutDisplayFunc(display);
    glutReshapeFunc(myReshape);

    /* setup user controls */
    GLUI *control_panel = GLUI_Master.create_glui( "Controls");
    new GLUI_StaticText( control_panel, "2DCube Controls" );
    new GLUI_Separator(control_panel);
    new GLUI_Button(control_panel, "Quit", 0, (GLUI_Update_CB)exit);

    new GLUI_Column(control_panel, true);
    GLUI_Spinner *spinner = new GLUI_Spinner(control_panel, "Size:", GLUI_SPINNER_FLOAT, &CubeSize);
    spinner->set_float_limits(2.0f, 8.0f, GLUI_LIMIT_CLAMP);

    new GLUI_Column(control_panel, true);
    GLUI_Rollout *eyePosRollout = new GLUI_Rollout(control_panel, "Eye Position", false);
    GLUI_Spinner *epX = new GLUI_Spinner(eyePosRollout, "X", GLUI_SPINNER_FLOAT, &EyePosX, 0, computeViewerAngle);
    GLUI_Spinner *epY = new GLUI_Spinner(eyePosRollout, "Y", GLUI_SPINNER_FLOAT, &EyePosY, 0, computeViewerAngle);
    GLUI_Spinner *epZ = new GLUI_Spinner(eyePosRollout, "Z", GLUI_SPINNER_FLOAT, &EyePosZ, 0, computeViewerAngle);
    epX->set_float_limits(-100.0f, 100.0f, GLUI_LIMIT_WRAP);
    epY->set_float_limits(-100.0f, 100.0f, GLUI_LIMIT_WRAP);
    epZ->set_float_limits(-100.0f, 100.0f, GLUI_LIMIT_WRAP);
    epX->set_float_val(EyePosX);
    epY->set_float_val(EyePosY);
    epZ->set_float_val(EyePosZ);
    
    GLUI_Rollout *lookAtRollout = new GLUI_Rollout(control_panel, "Looking At", false);
    GLUI_Spinner *laX = new GLUI_Spinner(lookAtRollout, "X", GLUI_SPINNER_FLOAT, &LookAtX, 0, computeViewerAngle);
    GLUI_Spinner *laY = new GLUI_Spinner(lookAtRollout, "Y", GLUI_SPINNER_FLOAT, &LookAtY, 0, computeViewerAngle);
    GLUI_Spinner *laZ = new GLUI_Spinner(lookAtRollout, "Z", GLUI_SPINNER_FLOAT, &LookAtZ, 0, computeViewerAngle);
    laX->set_float_limits(-100.0f, 100.0f, GLUI_LIMIT_WRAP);
    laY->set_float_limits(-100.0f, 100.0f, GLUI_LIMIT_WRAP);
    laZ->set_float_limits(-100.0f, 100.0f, GLUI_LIMIT_WRAP);
    laX->set_float_val(LookAtX);
    laY->set_float_val(LookAtY);
    laZ->set_float_val(LookAtZ);

    new GLUI_Column(control_panel, true);
    GLUI_Rollout *clippingRollout = new GLUI_Rollout(control_panel, "Clipping Parameters", false);
    GLUI_Spinner *hitherDistRollout = new GLUI_Spinner(clippingRollout, "Hither", GLUI_SPINNER_FLOAT, &HitherPlaneDist, 0, computePerspectiveMatrix);
    GLUI_Spinner *yonDistRollout = new GLUI_Spinner(clippingRollout, "Yon", GLUI_SPINNER_FLOAT, &YonPlaneDist, 0, computePerspectiveMatrix);
    GLUI_Spinner *viewDistRollout = new GLUI_Spinner(clippingRollout, "View", GLUI_SPINNER_FLOAT, &ViewPlaneDist, 0, refreshWindowAndPerspective);
    hitherDistRollout->set_float_limits(0.0f, 5.0f, GLUI_LIMIT_CLAMP);
    viewDistRollout->set_float_limits(5.0f, 10.0f, GLUI_LIMIT_CLAMP);
    yonDistRollout->set_float_limits(10.0f, 100.0f, GLUI_LIMIT_CLAMP);
    
    GLUI_Spinner *thetaSpinner = new GLUI_Spinner(control_panel, "Theta", GLUI_SPINNER_FLOAT, &Theta, 0, computeWindowMatrix);
    thetaSpinner->set_float_limits(0.0f, 360.0f, GLUI_LIMIT_WRAP);
    thetaSpinner->set_float_val(Theta);
 
    control_panel->set_main_gfx_window(main_window);

    glutMainLoop();
    return EXIT_SUCCESS;
} 
开发者ID:llovett,项目名称:2dcube,代码行数:63,代码来源:2dcube.cpp

示例2: main

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);
//.........这里部分代码省略.........
开发者ID:russellhaering,项目名称:cs450-project4,代码行数:101,代码来源:prog4.cpp


注:本文中的GLUI_Spinner::set_float_val方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。