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


C++ GLUI_Spinner类代码示例

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


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

示例1: AddControl

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;
}
开发者ID:stevekuznetsov,项目名称:Klampt,代码行数:27,代码来源:realtimeplanning.cpp

示例2: main

int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); // use double-buffering, RGB
    glutInitWindowSize(WIN_SIZE, WIN_SIZE);
    glutInitWindowPosition(50, 50);
    main_window = glutCreateWindow("3D Cube");

    init(); // call our init function
    glutDisplayFunc(display); // register display function
    glutReshapeFunc(reshape);

    // create the control panel, initialize some buttons
    GLUI *control_panel = GLUI_Master.create_glui("Control box");
    new GLUI_StaticText(control_panel, "3D Cube");
    new GLUI_Separator(control_panel);
    new GLUI_Button(control_panel, "Quit", 0, (GLUI_Update_CB) exit);
    new GLUI_Column(control_panel, true);

    // Size panel
    GLUI_Spinner *size = new GLUI_Spinner(control_panel, "SIZE", GLUI_SPINNER_FLOAT, &SIZE, 0, viewer_callback);
    size->set_float_limits(1.0, 20.0);
    new GLUI_Column(control_panel, true);
    // eye position / looking at panel
    // eye position rollout
    GLUI_Rollout *eye_pos_rollout = new GLUI_Rollout(control_panel, "Eye Position", false);
    GLUI_Spinner *x_pos= new GLUI_Spinner(eye_pos_rollout, "X", GLUI_SPINNER_FLOAT, &av, 0, viewer_callback);
    GLUI_Spinner *y_pos= new GLUI_Spinner(eye_pos_rollout, "Y", GLUI_SPINNER_FLOAT, &bv, 0, viewer_callback);
    GLUI_Spinner *z_pos= new GLUI_Spinner(eye_pos_rollout, "Z", GLUI_SPINNER_FLOAT, &cv, 0, viewer_callback);
    // looking at rollout
    GLUI_Rollout *look_at_rollout = new GLUI_Rollout(control_panel, "Looking At", false);
    GLUI_Spinner *x_look= new GLUI_Spinner(look_at_rollout, "X", GLUI_SPINNER_FLOAT, &lx, 0, viewer_callback);
    GLUI_Spinner *y_look= new GLUI_Spinner(look_at_rollout, "Y", GLUI_SPINNER_FLOAT, &ly, 0, viewer_callback);
    GLUI_Spinner *z_look= new GLUI_Spinner(look_at_rollout, "Z", GLUI_SPINNER_FLOAT, &lz, 0, viewer_callback);

    new GLUI_Column(control_panel, true);
    // clipping param panel
    GLUI_Rollout *clipping_rollout = new GLUI_Rollout(control_panel, "Clipping Parameters plane", false);
    GLUI_Spinner *dist_hither = new GLUI_Spinner(clipping_rollout, "Distance to Hither plane", GLUI_SPINNER_FLOAT, &H, 0, clipping_callback);
    dist_hither->set_float_limits(1.0, 20.0, GLUI_LIMIT_CLAMP);
    GLUI_Spinner *dist_picture = new GLUI_Spinner(clipping_rollout, "Distance to Picture plane", GLUI_SPINNER_FLOAT, &D, 0, clipping_callback);
    dist_picture->set_float_limits(5.0, 25.0, GLUI_LIMIT_CLAMP);
    GLUI_Spinner *dist_yon = new GLUI_Spinner(clipping_rollout, "Distance to Yon plane", GLUI_SPINNER_FLOAT, &Y, 0, clipping_callback);
    dist_yon->set_float_limits(10.0, 30.0, GLUI_LIMIT_CLAMP);


    // theta spinner
    GLUI_Spinner *theta_spinner= new GLUI_Spinner(control_panel, "THETA", GLUI_SPINNER_FLOAT, &theta, 0, theta_callback);
    theta_spinner->set_float_limits(30.0, 75.0, GLUI_LIMIT_CLAMP);

    control_panel->set_main_gfx_window(main_window);

    /* call the test function (for... testing) */
    //test1();

    //GLUI_Master.set_glutIdleFunc(spin);
    glutMainLoop();

    return EXIT_SUCCESS;
}
开发者ID:dan-f,项目名称:3D-Cube,代码行数:60,代码来源:3dcube.cpp

示例3: 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);
}
开发者ID:nickveys,项目名称:opengl-play,代码行数:34,代码来源:main.cpp

示例4: initGlui

// Initialize GLUI and the user interface
void initGlui()
{
    GLUI_Master.set_glutIdleFunc(NULL);

    // Create GLUI window
    glui = GLUI_Master.create_glui("Glui Window", 0, Win[0]+10, 0);

    /*
     * Add spinners and checkboxes for each degree of freedom.
     * The checkboxes determine whether or not that part should rotate
     * when the "animate" checkbox is on.
     *
     */

    addFloatSpinner("Leg 1", &leg1Rotation, 0.1, LIMB_MIN, LIMB_MAX);
    glui->add_checkbox("Animate Leg 1", &animateLeg1, 0, doNothing);

    addFloatSpinner("Leg 2", &leg2Rotation, 0.1, LIMB_MIN, LIMB_MAX);
    glui->add_checkbox("Animate Leg 2", &animateLeg2, 0, doNothing);

    addFloatSpinner("Foot 1", &foot1Rotation, 0.1, FOOT_MIN, FOOT_MAX);
    glui->add_checkbox("Animate Foot 1", &animateFoot1, 0, doNothing);

    addFloatSpinner("Foot 2", &foot2Rotation, 0.1, FOOT_MIN, FOOT_MAX);
	glui->add_checkbox("Animate Foot 2", &animateFoot2, 0, doNothing);

	addFloatSpinner("Arm", &armRotation, 0.1, LIMB_MIN, LIMB_MAX);
    glui->add_checkbox("Animate Arm", &animateArm, 0, doNothing);

    addFloatSpinner("Head", &headRotation, 0.1, HEAD_MIN, HEAD_MAX);
    glui->add_checkbox("Animate Head", &animateHead, 0, doNothing);

    /*
     * The beak spinner is an int value of the distance
     * between the top and bottom beaks
     *
     * The beak is also controlled by a checkbox
     */
    GLUI_Spinner *beakSpinner
		= glui->add_spinner("Beak", GLUI_SPINNER_INT, &beakDistance);
    beakSpinner->set_speed(1);
    beakSpinner->set_int_limits(BEAK_MIN, BEAK_MAX, GLUI_LIMIT_CLAMP);
    glui->add_checkbox("Animate Beak", &animateBeak, 0, doNothing);

    // Add button to specify animation mode 
    glui->add_separator();
    glui->add_checkbox("Animate Parts", &animate_mode, 0, animateButton);

    glui->add_checkbox("Play Animation", &animation_mode, 0, animationButton);

    // Add "Quit" button
    glui->add_separator();
    glui->add_button("Quit", 0, quitButton);

    // Set the main window to be the "active" window
    glui->set_main_gfx_window(windowID);
}
开发者ID:oceanchild,项目名称:goobleprojects,代码行数:58,代码来源:penguin.cpp

示例5: main

int main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(650, 650);
    glutInitWindowPosition(50, 50);
    main_window = glutCreateWindow("Ferris Wheel");

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
    glEnable(GL_NORMALIZE);

    p = gluNewQuadric();
    q = gluNewQuadric();
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);
    init();

    glEnable(GL_LIGHT0);
    setMaterial( &redPlasticMaterials );

    currentLighting = &whiteLighting;
    glLightfv(GL_LIGHT0, GL_AMBIENT, currentLighting->ambient);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, currentLighting->diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, currentLighting->specular);
    glLightfv(GL_LIGHT0, GL_POSITION, light0_pos);

    GLUI *control_panel = GLUI_Master.create_glui( "Controls",0, 50, 700 );

    new GLUI_Button(control_panel, "Quit", 0, (GLUI_Update_CB)exit);

    new GLUI_Column(control_panel, true);

    GLUI_Rollout *eyePosRollout = new GLUI_Rollout(control_panel, "Camera Position", false);
    GLUI_Rollout *lookAtRollout = new GLUI_Rollout(control_panel, "Lookat Point", false);

    GLUI_Spinner *epxSpin = new GLUI_Spinner(eyePosRollout, "Camera X", GLUI_SPINNER_FLOAT, &EyeX, 0, look);
    GLUI_Spinner *epySpin = new GLUI_Spinner(eyePosRollout, "Camera Y", GLUI_SPINNER_FLOAT, &EyeY, 0, look);
    GLUI_Spinner *epzSpin = new GLUI_Spinner(eyePosRollout, "Camera Z", GLUI_SPINNER_FLOAT, &EyeZ, 0, look);


    GLUI_Spinner *laxSpin = new GLUI_Spinner(lookAtRollout, "Lookat X", GLUI_SPINNER_FLOAT, &LookAtX, 0, look);
    GLUI_Spinner *laySpin = new GLUI_Spinner(lookAtRollout, "Lookat Y", GLUI_SPINNER_FLOAT, &LookAtY, 0, look);
    GLUI_Spinner *lazSpin = new GLUI_Spinner(lookAtRollout, "Lookat Z", GLUI_SPINNER_FLOAT, &LookAtZ, 0, look);

    new GLUI_Column(control_panel, true);

    GLUI_Spinner *speedSpin = new GLUI_Spinner(control_panel, "Rotation Speed", GLUI_SPINNER_FLOAT, &Speed, 0, (GLUI_Update_CB)NULL);
    speedSpin->set_float_limits(-5.0f, 5.0f, GLUI_LIMIT_CLAMP);
    GLUI_Spinner *recSpin = new GLUI_Spinner(control_panel, "Recursive Depth", GLUI_SPINNER_INT, &RecursiveDepth, 0, (GLUI_Update_CB)NULL);
    recSpin->set_int_limits(0, 5, GLUI_LIMIT_CLAMP);

    control_panel->set_main_gfx_window(main_window);
    GLUI_Master.set_glutIdleFunc(update);

    glutMainLoop();
}
开发者ID:llovett,项目名称:ferriswheel,代码行数:56,代码来源:ferriswheel.cpp

示例6: buildInterface

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);
}
开发者ID:warunikar,项目名称:meshview,代码行数:55,代码来源:main.cpp

示例7: add_spinner_to_panel

GLUI_Spinner  *GLUI::
add_spinner_to_panel( GLUI_Panel *panel, char *name, 
		      int data_type, void *data,
		      int id, GLUI_Update_CB callback)
{
  GLUI_Spinner *control;
  int           text_type;

  control = new GLUI_Spinner;
 
  if ( NOT strcmp( name, "Spinner Test" ))
    id=id;


  if ( control ) {
    if ( data_type == GLUI_SPINNER_INT ) {
      text_type = GLUI_EDITTEXT_INT;
      /*      control->live_type = GLUI_LIVE_INT;              */
    }
    else if ( data_type == GLUI_SPINNER_FLOAT ) {
      text_type = GLUI_EDITTEXT_FLOAT;
      /*      control->live_type = GLUI_LIVE_FLOAT;              */
    }
    else {
      return NULL;   /* Did not pass in a valid data type */
    }

    GLUI_EditText *edittext = 
      add_edittext_to_panel( (GLUI_Panel*) control, name, text_type, data,
			     id, callback );

    if ( edittext ) {
      control->set_name( name );
      control->edittext    = edittext;  /* Link the edittext to the spinner */
      /*      control->ptr_val     = data;               */
      control->user_id     = id;
      control->data_type   = data_type;
      control->callback    = callback;
    
      edittext->spinner    = control; /* Link the spinner to the edittext */
            
      add_control( panel, control );
      
      return control;
    }
    else {
      return NULL;
    }
  }
  else {
    return NULL;
  }

}
开发者ID:ryanfb,项目名称:homer,代码行数:54,代码来源:glui_add_controls.cpp

示例8: spinner_edittext_callback

void  spinner_edittext_callback( int id )
{
  GLUI_Spinner *spinner;

  putchar( '.' ); flushout;
  
  spinner = (GLUI_Spinner*) id;

  if ( NOT spinner )
    return;

  spinner->do_callbacks();
}
开发者ID:4ian,项目名称:GD,代码行数:13,代码来源:glui_spinner.cpp

示例9: _KeepUpdateOn

//////////////////// CGlutWin methods //////////////////// 
void 
CPCPView::_InitFunc()
{
	_KeepUpdateOn();
	
	/////////////////////////////////////////////
	// set up GLUI
	GLUI *pcGlui = PCGetGluiSubwin();

	GLUI_Panel *pcPanel_Line = pcGlui->add_rollout("Line");
	GLUI_Panel *pcPanel_Color = pcGlui->add_panel_to_panel(pcPanel_Line, "Color");
	static char* pszChannels[] = {"R", "G", "B", "A"};
	float *pfColor = &f4Color.x;
	for(int c = 0; c < sizeof(pszChannels)/sizeof(pszChannels[0]); c++)
	{
		GLUI_Spinner* pcSpinner = pcGlui->add_spinner_to_panel(pcPanel_Color, pszChannels[c], GLUI_SPINNER_FLOAT, &pfColor[c]);
		pcSpinner->set_float_limits(0.0f, 1.0f);
	}
	GLUI_Spinner* pcSpinner_Width = pcGlui->add_spinner_to_panel(pcPanel_Line, "Width", GLUI_SPINNER_FLOAT, &fWidth);
		pcSpinner_Width->set_float_limits(1.0f, 16.0f);

	cFilter._AddGlui(this, pcGlui, NULL, pcBlockTree->uMaxLevel + 1);
}
开发者ID:Stanley-Lima,项目名称:wavelet-sat,代码行数:24,代码来源:SATSepDWTPCPView.cpp

示例10: 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"); 

}
开发者ID:mayank127,项目名称:cs296-project,代码行数:53,代码来源:main.cpp

示例11: 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( 800, 600 );
 
  main_window = glutCreateWindow( "GLUI Example 5" );
  glutDisplayFunc( myGlutDisplay );
  GLUI_Master.set_glutReshapeFunc( myGlutReshape );  
  GLUI_Master.set_glutKeyboardFunc( myGlutKeyboard );
  GLUI_Master.set_glutSpecialFunc( NULL );
  GLUI_Master.set_glutMouseFunc( myGlutMouse );
  glutMotionFunc( myGlutMotion );

  /****************************************/
  /*       Set up OpenGL lights           */
  /****************************************/

  glEnable(GL_LIGHTING);
  glEnable( GL_NORMALIZE );

  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_LIGHT1);
  glLightfv(GL_LIGHT1, GL_AMBIENT, light1_ambient);
  glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
  glLightfv(GL_LIGHT1, GL_POSITION, light1_position);

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

  glEnable(GL_DEPTH_TEST);

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

  printf( "GLUI version: %3.2f\n", GLUI_Master.get_version() );

  /*** Create the side subwindow ***/
  glui = GLUI_Master.create_glui_subwindow( main_window, 
					    GLUI_SUBWINDOW_RIGHT );

  obj_panel = new GLUI_Rollout(glui, "Properties", false );

  /***** Control for object params *****/

  new GLUI_Checkbox( obj_panel, "Wireframe", &wireframe, 1, control_cb );
  GLUI_Spinner *spinner = 
    new GLUI_Spinner( obj_panel, "Segments:", &segments);
  spinner->set_int_limits( 3, 60 );
  spinner->set_alignment( GLUI_ALIGN_RIGHT );

  GLUI_Spinner *scale_spinner = 
    new GLUI_Spinner( obj_panel, "Scale:", &scale);
  scale_spinner->set_float_limits( .2f, 4.0 );
  scale_spinner->set_alignment( GLUI_ALIGN_RIGHT );


  /******** Add some controls for lights ********/

  GLUI_Rollout *roll_lights = new GLUI_Rollout(glui, "Lights", false );

  GLUI_Panel *light0 = new GLUI_Panel( roll_lights, "Light 1" );
  GLUI_Panel *light1 = new GLUI_Panel( roll_lights, "Light 2" );

  new GLUI_Checkbox( light0, "Enabled", &light0_enabled,
                     LIGHT0_ENABLED_ID, control_cb );
  light0_spinner = 
    new GLUI_Spinner( light0, "Intensity:", 
                      &light0_intensity, LIGHT0_INTENSITY_ID,
                      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_ID,control_cb);
  sb->set_float_limits(0,1);
  sb = new GLUI_Scrollbar( light0, "Green",GLUI_SCROLL_HORIZONTAL,
                           &light0_diffuse[1],LIGHT0_INTENSITY_ID,control_cb);
  sb->set_float_limits(0,1);
  sb = new GLUI_Scrollbar( light0, "Blue",GLUI_SCROLL_HORIZONTAL,
                           &light0_diffuse[2],LIGHT0_INTENSITY_ID,control_cb);
  sb->set_float_limits(0,1);
  new GLUI_Checkbox( light1, "Enabled", &light1_enabled,
                     LIGHT1_ENABLED_ID, control_cb );
  light1_spinner = 
    new GLUI_Spinner( light1, "Intensity:",
                      &light1_intensity, LIGHT1_INTENSITY_ID,
                      control_cb );
  light1_spinner->set_float_limits( 0.0, 1.0 );
  sb = new GLUI_Scrollbar( light1, "Red",GLUI_SCROLL_HORIZONTAL,
//.........这里部分代码省略.........
开发者ID:libglui,项目名称:glui,代码行数:101,代码来源:example5.cpp

示例12: createColorSpinner

GLUI_Spinner* createColorSpinner(GLUI_Panel* pan, const char* label, float* pointer)
{
	GLUI_Spinner* spinner = new GLUI_Spinner(pan, label, pointer);
	spinner->set_float_limits(0, 1);
    return spinner;
}
开发者ID:Bananattack,项目名称:uoguelph,代码行数:6,代码来源:qix.cpp

示例13: addColumnToPanel

void Interface::initGUI()
{
	GLUI_Panel *geral =addPanel("Opcoes", 1);
	addColumnToPanel(geral);
	GLUI_Panel *luzesPanel = addPanelToPanel(geral,"Luzes", 1);

	for(unsigned int i=0;i<((ANFScene *) scene)->parser.lights.size();i++){

		string str=((ANFScene *) scene)->parser.lights[i]->id;
		char * writable = new char[str.size() + 1];
		copy(str.begin(), str.end(), writable);
		writable[str.size()] = '\0';


		if(((ANFScene *) scene)->parser.lights[i]->enabled==true){
			addCheckboxToPanel(luzesPanel,writable,NULL,i)->set_int_val(1);
		}
		else{
			addCheckboxToPanel(luzesPanel,writable,NULL,i)->set_int_val(0);
		}
		delete[] writable;

	}

	addColumnToPanel(geral);
	GLUI_Panel *camerasPanel = addPanelToPanel(geral,"Camaras", 1);
	GLUI_RadioGroup *cameraList = addRadioGroupToPanel(camerasPanel,&(((ANFScene *) scene)->parser.activeCam));
	
	for(unsigned int i=0;i<((ANFScene *) scene)->parser.cameras.size();i++){

		string str=((ANFScene *) scene)->parser.cameras[i]->id;
		char * writable = new char[str.size() + 1];
		copy(str.begin(), str.end(), writable);
		writable[str.size()] = '\0';

		if(i == ((ANFScene *) scene)->parser.activeCam)
			addRadioButtonToGroup(cameraList, writable)->set_int_val(1);
		else
			addRadioButtonToGroup(cameraList, writable);

		delete[] writable;

	}
	addRadioButtonToGroup(cameraList, "Default");

	addColumnToPanel(geral);
	GLUI_Panel *drawPanel = addPanelToPanel(geral,"Draw Mode", 1);
	GLUI_RadioGroup *drawList = addRadioGroupToPanel(drawPanel,&(((ANFScene *) scene)->parser.globals->drawing.mode));
	addRadioButtonToGroup(drawList, "Fill");
	addRadioButtonToGroup(drawList, "Line");
	addRadioButtonToGroup(drawList, "Point");

	addColumnToPanel(geral);
	GLUI_Panel *windPanel = addPanelToPanel(geral,"Wind Value", 1);

	GLUI_Spinner *spinner = addSpinnerToPanel(windPanel, "windScale",GLUI_SPINNER_INT,&(((ANFScene *) scene)->parser.wind),9);
	
	spinner->set_speed(0.5);
	spinner->set_int_limits(0,10,GLUI_LIMIT_WRAP);

	
	GLUI_Panel *varPanel= addPanelToPanel(geral,"Animations", 1);
	addButtonToPanel(varPanel, "Reset", 8);
}
开发者ID:ZPaulo,项目名称:LAIG,代码行数:64,代码来源:Interface.cpp

示例14: glutAndGluiInit

void glutAndGluiInit(int argc, char* argv[]) {
	//////////////////////////////////////////
	//   Initialize GLUT and create window  
	//////////////////////////////////////////
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowPosition(-1, -1);
	glutInitWindowSize(640, 480);
 
	int main_window = glutCreateWindow("Scenegraph");
	glutDisplayFunc(display);
	GLUI_Master.set_glutReshapeFunc(reshape);  

	//////////////////////////////////////////
	//         GLUI UI setup         
	//////////////////////////////////////////
	// Create the side subwindow 
	GLUI* glui = GLUI_Master.create_glui_subwindow( main_window, GLUI_SUBWINDOW_RIGHT );
	glui->set_main_gfx_window( main_window );

	////////// Buttons 
	GLUI_Panel* panel = glui->add_panel("Add Object");
	glui->add_button_to_panel(panel, "Cone",    CONE_ID,    control_cb);
	glui->add_button_to_panel(panel, "Sphere",  SPHERE_ID,  control_cb);
	glui->add_button_to_panel(panel, "Spindle", SPINDLE_ID, control_cb);
	glui->add_button_to_panel(panel, "Teapot",  TEAPOT_ID,  control_cb);
	glui->add_button_to_panel(panel, "Torus",   TORUS_ID,   control_cb);

	panel = glui->add_panel("Grouping");
	glui->add_button_to_panel(panel, "Add Selected", ADD_ID,    control_cb);
	glui->add_button_to_panel(panel, "Select Next",  NEXT_ID,   control_cb);
	glui->add_button_to_panel(panel, "Close Group",  CLOSE_ID,  control_cb);
	glui->add_button_to_panel(panel, "Reopen Group", REOPEN_ID, control_cb);

	panel = glui->add_panel("Other");
	glui->add_button_to_panel(panel, "Print Graph", PRINT_ID, control_cb);
	glui->add_button_to_panel(panel, "Quit",        0,        control_cb);

	///////////// Create the bottom subwindow 
	GLUI* glui2 = GLUI_Master.create_glui_subwindow( main_window, GLUI_SUBWINDOW_BOTTOM );
	glui2->set_main_gfx_window( main_window );

	///////////// View rotation
	GLUI_Rotation *view_rot   = glui2->add_rotation( "View", &root.view_rotate.m[0]);
	view_rot->set_spin( 1.0 );  glui2->add_column( false );

	///////////// Object Translations
	GLUI_Translation *trans_x = glui2->add_translation("Xlate X", GLUI_TRANSLATION_X, &root.obj_xlate[0], 0, xformCallback);
	trans_x->set_speed( .005 ); glui2->add_column( false );
	GLUI_Translation *trans_y = glui2->add_translation("Xlate Y", GLUI_TRANSLATION_Y, &root.obj_xlate[1], 0, xformCallback);
	trans_y->set_speed( .005 ); glui2->add_column( false );
	GLUI_Translation *trans_z = glui2->add_translation("Xlate Z", GLUI_TRANSLATION_Z, &root.obj_xlate[2], 0, xformCallback);
	trans_z->set_speed( .005 ); glui2->add_column( false );

	///////////// Object Rotations
	GLUI_Translation *r_x = glui2->add_translation("Rotate X", GLUI_TRANSLATION_X, &root.obj_rdelta[0], 0, xformCallback);
	r_x->set_speed( .005 ); glui2->add_column( false );
	GLUI_Translation *r_y = glui2->add_translation("Rotate Y", GLUI_TRANSLATION_X, &root.obj_rdelta[1], 0, xformCallback);
	r_y->set_speed( .005 ); glui2->add_column( false );
	GLUI_Translation *r_z = glui2->add_translation("Rotate Z", GLUI_TRANSLATION_X, &root.obj_rdelta[2], 0, xformCallback);
	r_z->set_speed( .005 ); glui2->add_column( false );

	////////// Object Scale
	GLUI_Spinner *xspin = glui2->add_spinner("XScale:", GLUI_SPINNER_FLOAT, &root.obj_scale[0], 0, xformCallback);
	xspin->set_float_limits( .5f, 4.0 ); xspin->set_alignment( GLUI_ALIGN_RIGHT );
	GLUI_Spinner *yspin = glui2->add_spinner("YScale:", GLUI_SPINNER_FLOAT, &root.obj_scale[1], 0, xformCallback);
	yspin->set_float_limits( .5f, 4.0 ); yspin->set_alignment( GLUI_ALIGN_RIGHT );
	GLUI_Spinner *zspin = glui2->add_spinner("ZScale:", GLUI_SPINNER_FLOAT, &root.obj_scale[2], 0, xformCallback);
	zspin->set_float_limits( .5f, 4.0 ); zspin->set_alignment( GLUI_ALIGN_RIGHT );
}
开发者ID:nickveys,项目名称:opengl-play,代码行数:70,代码来源:main.cpp

示例15: InitGlui

/**
Sets up the GLUI window.
*/
void InitGlui() {

	//User Input Section 
	GLUI_Panel *UserInput;
	GLUI_Rollout *UserInputRollout;
	//GLUI_Rollout * ReadInFileRollout;

	//Visualization Settings:
	GLUI_Panel *settings;

	//Transformation Settings:
	GLUI_Panel * transformationPanel;
	GLUI_Rollout * TransformationRollout;
	GLUI_Rotation *rotation;
	GLUI_Translation *trans, *scale;

	//Color Options Settings:
	GLUI_Rollout * ColorOptions;
	GLUI_Spinner * backgroundColorSpinnerR;
	GLUI_Spinner * backgroundColorSpinnerG;
	GLUI_Spinner * backgroundColorSpinnerB;
	GLUI_Spinner * boxColorSpinner;

	//Graphics Options Settings:
	GLUI_Panel * graphicsOptions;

	//Graphics Rollouts:
	GLUI_Panel * CustomSettings;





	GLUI_Rollout * ArrowSettings;
	GLUI_Rollout * AnimationSettings;
	GLUI_Rollout * IsosurfaceSettings;
	GLUI_Rollout * PointsSettings;
	GLUI_Rollout * StreamlineSettings;
	GLUI_Rollout * VectorBlobSettings; 
	GLUI_Rollout * CuttingPlaneSettings;
	
	//ObjFileSettings:
	//GLUI_Panel * ObjFileSettings;

	//Arrow Settings:
	GLUI_Spinner * spinArrowLength;
	GLUI_Spinner * spinNumPoints;
	GLUI_Spinner * spinMinVector;
	GLUI_Spinner * spinMaxVector;
	//GLUI_Spinner * alphaVector;

	//Isosurface Settings
	GLUI_Spinner * spinIsoValue;
	GLUI_Spinner * spinNumContours;
	GLUI_Spinner * spinIsoResolution;
	//GLUI_Spinner * spinZPlaneVal;

	//Streamline Controls:
	GLUI_Spinner * spinNumStreamlines;

	//Probe Controls:
	//GLUI_Panel * probePanel;
	GLUI_Spinner * ProbeX;
	GLUI_Spinner * ProbeY;
	GLUI_Spinner * ProbeZ;

	//Vector Sheet Controls:
	//GLUI_Spinner * VectorBlobTime;
	GLUI_Spinner * VectorBlobXLoc;
	GLUI_Spinner * VectorBlobYLoc;
	GLUI_Spinner * VectorBlobZLoc;
	GLUI_Spinner * VectorBlobXVec;
	GLUI_Spinner * VectorBlobYVec;
	GLUI_Spinner * VectorBlobZVec;

	//Cutting Plane Controls:
	//GLUI_Spinner * VectorBlobTime;
	GLUI_Spinner * CuttingPlaneXLoc;
	GLUI_Spinner * CuttingPlaneYLoc;
	GLUI_Spinner * CuttingPlaneZLoc;
	GLUI_Spinner * CuttingPlaneXVec;
	GLUI_Spinner * CuttingPlaneYVec;
	GLUI_Spinner * CuttingPlaneZVec;
	GLUI_Spinner * Tolerence;
	GLUI_Spinner * ContDist;

	//dot point animation controls:
	GLUI_Spinner * dotPointColorSpinnerR;
	GLUI_Spinner * dotPointColorSpinnerG;
	//GLUI_Spinner * dotPointColorSpinnerB;

	//Strings for Sliders:
	//char tempstr[128];
	//char xstr[128];
	//char ystr[128];
	//char zstr[128];
	//char radstr[128];
//.........这里部分代码省略.........
开发者ID:Nekel-Seyew,项目名称:Complex-3D-Vector-Fields,代码行数:101,代码来源:Main.cpp


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