本文整理汇总了C++中GLUI类的典型用法代码示例。如果您正苦于以下问题:C++ GLUI类的具体用法?C++ GLUI怎么用?C++ GLUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GLUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
//OpenCVの初期化
cvInit();
//OpenGLとGLUTの初期化
//(OpenCVみたいにまとめないのはargcとargvが必要だから?)
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutInitWindowSize(width, height);
glutCreateWindow("IplImage");
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glInit();
GLUI *glui = GLUI_Master.create_glui("control");
glui->add_button("Exit", 0, gluiCallback);
//メインループ突入(displayを繰り返し実行)
glutMainLoop();
return 0;
}
示例2: initGui
//-----------------------------------------------------------------------------
void EmptyPlugin::initGui( void* pkUserdata )
{
GLUI* glui = ::getRootGLUI();
GLUI_Panel* pluginPanel = static_cast<GLUI_Panel*>( pkUserdata );
// glui->add_statictext_to_panel( pluginPanel, "no options" );
glui->add_checkbox_to_panel( pluginPanel, "Show Motionstate", &this->m_bShowMotionStatePlot);
glui->add_checkbox_to_panel( pluginPanel, "Show SamplePlot", &this->m_bShowSamplePlot);
}
示例3: initGui
//-----------------------------------------------------------------------------
void ZonePlugin::initGui( void* userdata )
{
#if 0
GLUI* glui = ::getRootGLUI();
GLUI_Panel* pluginPanel = static_cast<GLUI_Panel*>( userdata );
glui->add_checkbox_to_panel( pluginPanel, "Solid", &_solid);
BaseClass::initGui( userdata );
#endif
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: initGui
//-----------------------------------------------------------------------------
// implement to initialize additional gui functionality
void NetPedestrianPlugin::initGui( void* pkUserdata )
{
if( false == this->isRemoteObject() )
{
GLUI* glui = ::getRootGLUI();
GLUI_Panel* pluginPanel = static_cast<GLUI_Panel*>( pkUserdata );
glui->add_checkbox_to_panel( pluginPanel, "Wander randomly", &this->m_bWanderSwitch);
glui->add_checkbox_to_panel( pluginPanel, "Use direct path following", &this->m_bUseDirectedPathFollowing);
GLUI_Control* pkControl;
pkControl = glui->add_button_to_panel( pluginPanel, "Add", -1, addPedestrian );
pkControl->set_ptr_val( this );
pkControl = glui->add_button_to_panel( pluginPanel, "Remove", -1, removePedestrian );
pkControl->set_ptr_val( this );
}
};
示例8: MyButtons
/**
The callback function for the buttons in the GLUI window.
@param button the id of the button calling this callback function.
*/
void MyButtons(int button) {
switch (button) {
case(0) :
Framework::instance()->setUpPointsAndVectors();
Framework::instance()->spinVecMin = Framework::instance()->GetVectorMin();
Framework::instance()->spinVecMax = Framework::instance()->GetVectorMax();
break;
case(1) : {
printf("Entering Input\n");
std::string input = Framework::instance()->VectorDefinerString;
if ((int)strlen(Framework::instance()->VectorDefinerString) != 0) {
if (PathFileExists(input.c_str()) || input.find("<", 0) != std::string::npos) {
Framework::instance()->VectorInput = Framework::instance()->VectorDefinerString;
}else {
std::cout << "Either input existing file, or use the vector form <I(x,y,z),J(x,y,z),K(x,y,z)>"<<std::endl;
}
}
input = Framework::instance()->SpaceDefinerString;
if ((int)strlen(Framework::instance()->SpaceDefinerString) != 0 && input.find("<", 0) != std::string::npos) {
Framework::instance()->SpaceInput = Framework::instance()->SpaceDefinerString;
}
else {
std::cout << "Please use the vector form <I(x,y,z),J(x,y,z),K(x,y,z)>" << std::endl;
}
Framework::instance()->setUpPointsAndVectors();
Framework::instance()->spinVecMin = Framework::instance()->GetVectorMin();
Framework::instance()->spinVecMax = Framework::instance()->GetVectorMax();
break;
}
case(2) :
printf(".obj file saved");
break;
case(3) :
GLUI* fileselectglui = GLUI_Master.create_glui("Select a File!");
gluiFileBrowser = new GLUI_FileBrowser(fileselectglui, "File Selector",1,10, ((GLUI_Update_CB)GetFilePlease));
fileselectglui->add_statictext("Select a CSV File");
gluiFileBrowser->set_allow_change_dir(true);
//Framework::instance()->VectorInput = (char*)gfb.get_file();
//printf("%s\n", Framework::instance()->VectorInput);
break;
}
}
示例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);
}
示例10: build
bool
CurvatureUI::show()
{
if(glui){
cerr << "CurvatureUI::show() - Error! CurvatureUI is already shown!" << endl;
return false;
} else {
build();
if(!glui){
cerr << "CurvatureUI::show() - Error! CurvatureUI failed to build GLUI object!"
<< endl;
return false;
} else {
glui->show();
// Update the controls that don't use
// 'live' variables
//update_non_lives();
glui->sync_live();
return true;
}
}
}
示例11: 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);
}
示例12: main
//metodo main de la aplicacion
void main(int argc, char** argv){
//inicializar la glut y los buffers
glutInit(&argc, argv);
//frame buffer doble y z-bufer
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
//construir ventana
glutInitWindowSize(1280,650);
glutInitWindowPosition(20,20);
window=glutCreateWindow("Prueba Theremin");
std::cout << "Arranca el programa" << std::endl;
//registrar las callbacks
GLUI_Master.set_glutDisplayFunc(display);
//glutReshapeFunc(reshape);
GLUI_Master.set_glutKeyboardFunc(onKey);
GLUI_Master.set_glutReshapeFunc(reshape);
GLUI * glui;
glui = GLUI_Master.create_glui_subwindow (window,GLUI_SUBWINDOW_TOP);
bt1 = glui->add_button ("Play", 1, gluiMainWindow);
glui->add_column (0);
bt2 = glui->add_button ("Configuracion", 2, gluiMainWindow);
glui->add_column (0);
bt3 = glui->add_button ("Acerca de", 3, gluiMainWindow);
glui->add_column (0);
bt4 = glui->add_button ("Quit", -3, gluiMainWindow);
GLUI_Master.set_glutIdleFunc(idle);
glEnable(GL_DEPTH_TEST);
//Poner en marcha el bucle de eventos
glutMainLoop();
}
示例13: update
bool
CurvatureUI::update()
{
if(!glui){
cerr << "CurvatureUI::update() - Error! No GLUI object to update (not showing)!"
<< endl;
return false;
} else {
// Update the controls that don't use
// 'live' variables
//update_non_lives();
glui->sync_live();
return true;
}
}
示例14: 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);
//.........这里部分代码省略.........
示例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;
}