/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Scene constructor - initalize any values and register GLUI callbacks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ Scene::Scene(){ rubberbanding = false; rbStartX = 0; rbStartY = 0; GLUI_Master.set_glutDisplayFunc( redraw_cb ); // register redraw function glutCreateMenu( processRightButtonMenu_cb ); glutAddMenuEntry( "Clear scene", CLEAR_CMD ); glutAddMenuEntry( "Exit", EXIT_CMD ); //attach current menu to a right-click glutAttachMenu( GLUT_RIGHT_BUTTON ); // Default Values current_shape = newX = newY = 0; borderColor = fillColor = new Color(1,0,0); drawBoundary = drawFill = true; }
static void make_2nd_level_psf_menu(){ char tmp_menu[1024]; char psf_name[LENGTHBUF]; int num_psf = send_num_loaded_PSF(); int num_fld = send_nfield_current_psf(); int if_psf = send_draw_field_current_psf(); int ic_psf = send_draw_comp_id_current_psf(); int num_comp = send_ncomp_current_psf(if_psf); int id_coord = send_coordinate_id_current_psf(); int iflag_solid = send_kemoview_psf_draw_flags(PSFSOLID_TOGGLE); int iflag_grid = send_kemoview_psf_draw_flags(PSFGRID_TOGGLE); glut_menu_id->psf_root_menu = glutCreateMenu(psf_handler); if(num_psf > 1){ send_current_psf_file_header(psf_name); sprintf(tmp_menu, "Current: %s", psf_name); glutAddSubMenu(tmp_menu, glut_menu_id->ichoose_current_psf_menu); } else { }; send_current_psf_data_name(tmp_menu,if_psf); if (num_fld > 1) { glutAddSubMenu(tmp_menu, glut_menu_id->ichoose_field_menu); } else { glutAddMenuEntry(tmp_menu, PSF_NOTHING_TODO); }; if (num_comp > 1) { set_PSF_component_name(num_comp,ic_psf,id_coord,tmp_menu); glutAddSubMenu(tmp_menu, glut_menu_id->ichoose_comp_menu); }; glut_PSF_draw_menu(); if(iflag_solid > 0){glutAddSubMenu("Surface color", glut_menu_id->ichoose_psf_patchcolor_menu);}; if(iflag_grid > 0) {glutAddSubMenu("Line color", glut_menu_id->ichoose_psf_linecolor_menu);}; glut_PSF_range_menu(); glutAddMenuEntry("Close Current PSF data", PSF_OFF); return; };
void setupMenu(void) { int numClades,menu,i; extern Hash subclades; Entry e; if (!subclades) return; menu=glutCreateMenu(handleMenuClicks); glutAddMenuEntry("Root tree",0); // 0th menu item is the root tree numClades = subclades->numElements; for (i=0;i<numClades;i++) { e= hashGetKthEntry(subclades,i); if (e) glutAddMenuEntry(e->key,i+1);// index is a code for which entry; 0 = root tree; 1...n are the subclades } glutAttachMenu(GLUT_RIGHT_BUTTON); }
void initMenus() { glutCreateMenu(mainMenu); glutAddMenuEntry("Reset block [g]", 'g'); glutAddMenuEntry("Reset random [a]", 'a'); glutAddMenuEntry("Add sphere [e]", 'e'); glutAddMenuEntry("Shoot ball [b]", 'b'); glutAddMenuEntry("View mode [v]", 'v'); glutAddMenuEntry("Move cursor mode [m]", 'm'); glutAddMenuEntry("Toggle point rendering [p]", 'p'); glutAddMenuEntry("Toggle Bullet simulation[s]", 's'); glutAddMenuEntry("Toggle animation [ ]", ' '); glutAddMenuEntry("Step animation [ret]", 13); glutAddMenuEntry("Toggle sliders [h]", 'h'); glutAddMenuEntry("Quit (esc)", '\033'); glutAttachMenu(GLUT_RIGHT_BUTTON); }
void createMenu(void){ //animeringsmeny = glutCreateMenu(menu); //glutAddMenuEntry("menu 1", 1); //glutAddMenuEntry("menu 2", 2); //springmeny = glutCreateMenu(menu); //glutAddMenuEntry("menu 3", 3); //glutAddMenuEntry("menu 4", 4); menyid = glutCreateMenu(menu); //glutAddSubMenu("menu 5", animeringsmeny); //glutAddSubMenu("menu 6", springmeny); glutAddMenuEntry("snapshot", 7); glutAddMenuEntry("exit", 0); glutAttachMenu(GLUT_RIGHT_BUTTON); }
int main(int argc, char* argv[]) { GLint i; glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(windowWidth, windowHeight); glutCreateWindow("Vertex Blending Demo"); glutReshapeFunc(ChangeSize); glutKeyboardFunc(KeyPressFunc); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); SetupRC(); // Create the menus mainMenu = glutCreateMenu(ProcessMenu); glutAddMenuEntry("Toggle vertex blending (currently ON)", 1); glutAddMenuEntry("Show bones (currently OFF)", 2); if (lowLevelAvailable && highLevelAvailable) { if (useHighLevel) { glutAddMenuEntry("Switch to low-level vertex shader", 3); } else { glutAddMenuEntry("Switch to high-level vertex shader", 3); } } glutAttachMenu(GLUT_RIGHT_BUTTON); glutMainLoop(); if (glDeleteObjectARB) { for (i = 0; i < TOTAL_SHADERS; i++) { glDeleteObjectARB(progObj[i]); glDeleteObjectARB(vShader[i]); } } return 0; }
int main (int argc, char ** argv) { //You will be creating a menu to load in scenes //The test.xml is the default scene and you will modify this code if (!g_RayTrace.m_Scene.Load (xmlFile)) { printf ("failed to load scene\n"); exit(1); } glutInit(&argc,argv); /* create a window */ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT); glutCreateWindow("Assignment 5 - Ray Tracer"); /* tells glut to use a particular display function to redraw */ glutDisplayFunc(display); /* create a right mouse button menu */ g_iMenuId = glutCreateMenu(menufunc); glutSetMenu(g_iMenuId); glutAddMenuEntry("Render RayTrace",0); glutAddMenuEntry("Render Normal",1); glutAddMenuEntry("Scene 1",3); glutAddMenuEntry("Scene 2",4); glutAddMenuEntry("Scene 3",5); glutAddMenuEntry("Quit",2); glutAttachMenu(GLUT_RIGHT_BUTTON); /* callback for mouse button changes */ glutMouseFunc(mousebutton); /* callback for idle function */ glutIdleFunc(doIdle); /* do initialization */ myinit(); glutMainLoop(); return 0; }
int main(int argc, char **argv) { Server::getInstance(); unsigned int i; glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DEPTH|GLUT_DOUBLE ); main_window = glutCreateWindow( "OpenGL Remote Rendering Server" ); glutDisplayFunc( cb_display ); glutReshapeFunc( cb_reshape ); glutIdleFunc( cb_idle ); glutCreateMenu( cb_menu ); for( i = 0; i < NUMBEROF( font_map ); ++i ) glutAddMenuEntry( font_map [ i ].name, i ); glutAddMenuEntry( "Quit", i ); glutAttachMenu( 2 ); font = GLUT_BITMAP_HELVETICA_12; //GLUT_BITMAP_8_BY_13; printf("glut window id: %d\n", glutGetWindow()); /* ffmpeg init */ width = glutGet(GLUT_WINDOW_WIDTH); height = glutGet(GLUT_WINDOW_HEIGHT); ffmpeg = fopen("output.h264", "wb"); encoder = new Encoder(); if (!encoder->bootstrap(AV_CODEC_ID_H264, width, height, 25)) //MPEG1VIDEO exit(EXIT_FAILURE); buffer = new uint8_t[3*width*height]; for (;;) { glutPostRedisplay(); glutMainLoopEvent(); } encoder->writeEndFile(ffmpeg); fclose(ffmpeg); delete[] buffer; return EXIT_SUCCESS; }
//--Main int main(int argc, char **argv) { // Initialize glut glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(w, h); // Name and create the Window glutCreateWindow("Matrix Example"); // Create menu glutCreateMenu(menu); glutAddMenuEntry("Start Cube Spin", 1); glutAddMenuEntry("Stop Cube Spin", 2); glutAddMenuEntry("Exit", 3); glutAttachMenu(GLUT_RIGHT_BUTTON); // Now that the window is created the GL context is fully set up // Because of that we can now initialize GLEW to prepare work with shaders GLenum status = glewInit(); if( status != GLEW_OK) { std::cerr << "[F] GLEW NOT INITIALIZED: "; std::cerr << glewGetErrorString(status) << std::endl; return -1; } // Set all of the callbacks to GLUT that we need glutDisplayFunc(render);// Called when its time to display glutReshapeFunc(reshape);// Called if the window is resized glutIdleFunc(update);// Called if there is nothing else to do glutKeyboardFunc(keyboard);// Called if there is keyboard input glutMouseFunc(mouse); // Initialize all of our resources(shaders, geometry) bool init = initialize(); if(init) { t1 = std::chrono::high_resolution_clock::now(); glutMainLoop(); } // Clean up after ourselves cleanUp(); return 0; }
void createGLUTMenus() { // create the menu and // tell glut that "processMenuEvents" will // handle the events glutCreateMenu(processMenuEvents); //add entries to our menu glutAddMenuEntry("Start",1); glutAddMenuEntry("Stop",2); glutAddMenuEntry("Exit",3); // attach the menu to the right button glutAttachMenu(GLUT_RIGHT_BUTTON); }
void createGLUTMenus() { int menu; // create the menu and // tell glut that "processMenuEvents" will // handle the events menu = glutCreateMenu(processMenuEvents); //add entries to our menu glutAddMenuEntry("SAVE",RED); glutAddMenuEntry("Undo",BLUE); glutAddMenuEntry("Green",GREEN); glutAddMenuEntry("Orange",ORANGE); // attach the menu to the right button glutAttachMenu(GLUT_RIGHT_BUTTON); }
static void initApp () { printf("initApp \n"); initGraphics(); initShaders(); /* Make sure we did everything right */ CheckGL(); chooseShader(0); Menu = glutCreateMenu(menuChoice); glutSetMenu(Menu); glutAddMenuEntry("Fragment shader", cmdToggleFragment); glutAddMenuEntry("Sphere", cmdSphere); glutAddMenuEntry("Teapot", cmdTeapot); glutAddMenuEntry("----", 0); glutAddMenuEntry("Exit", cmdExit); glutAttachMenu(GLUT_RIGHT_BUTTON); }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); glutCreateWindow("dinoball (Spaceball demo)"); glutDisplayFunc(redraw); glutMouseFunc(mouse); glutMotionFunc(motion); glutTabletMotionFunc(tablet); glutSpaceballMotionFunc(translate); glutSpaceballRotateFunc(rotate); glutSpaceballButtonFunc(button); glutDialsFunc(dials); glutCreateMenu(controlLights); glutAddMenuEntry("Toggle right light", 1); glutAddMenuEntry("Toggle left light", 2); glutAttachMenu(GLUT_RIGHT_BUTTON); makeDinosaur(); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glMatrixMode(GL_PROJECTION); gluPerspective( /* field of view in degree */ 40.0, /* aspect ratio */ 1.0, /* Z near */ 1.0, /* Z far */ 100.0); glMatrixMode(GL_MODELVIEW); gluLookAt(0.0, 0.0, 30.0, /* eye is at (0,0,30) */ 0.0, 0.0, 0.0, /* center is at (0,0,0) */ 0.0, 1.0, 0.); /* up is in positive Y direction */ glPushMatrix(); /* dummy push so we can pop on model recalc */ glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); glLightfv(GL_LIGHT0, GL_POSITION, lightZeroPosition); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); glLightfv(GL_LIGHT1, GL_POSITION, lightOnePosition); glLightfv(GL_LIGHT1, GL_DIFFUSE, lightOneColor); glEnable(GL_LIGHT0); glEnable(GL_LIGHT1); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ }
/******************************************************************************* Main function *******************************************************************************/ int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutCreateWindow("Point Manipulation Example"); /* Set glut callback functions. */ glutDisplayFunc(glutDisplay); glutReshapeFunc(glutReshape); glutIdleFunc(glutIdle); glutMouseFunc(glutMouse); glutMotionFunc(glutMotion); glutCreateMenu(glutMenu); glutAttachMenu(GLUT_RIGHT_BUTTON); glutAddMenuEntry("Free Manipulation", IHapticDeviceManager::FREE_MANIPULATION); glutAddMenuEntry("Spring Manipulation", IHapticDeviceManager::SPRING_MANIPULATION); glutAddMenuEntry("Friction Manipulation", IHapticDeviceManager::FRICTION_MANIPULATION); glutAddMenuEntry("Plane Manipulation", IHapticDeviceManager::PLANE_MANIPULATION); glutAddMenuEntry("Quit", 5); /* The GLUT main loop won't return control, so we need to perform cleanup using an exit handler. */ atexit(exitHandler); initScene(); std::cout << "This example demonstrates point snapping \ and manipulation." << std::endl; std::cout << "Use the right mouse button to select \ different manipulation styles." << std::endl; glutMainLoop(); return 0; }
int main(int argc, char *argv[]) { int mainMenu, redMenu, greenMenu, blueMenu; glutInitWindowSize(680, 440); glutInit(&argc, argv); splatConfig = splatDefault; glutCreateWindow("splatlogo"); glutReshapeFunc(reshape); glutDisplayFunc(display); glutMouseFunc(mouse); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glAlphaFunc(GL_GEQUAL, 0.5); glDisable(GL_ALPHA_TEST); glEnable(GL_DITHER); glClearColor(1.0, 1.0, 1.0, 0.0); redMenu = glutScaleBiasMenu(0 << 4); greenMenu = glutScaleBiasMenu(1 << 4); blueMenu = glutScaleBiasMenu(2 << 4); mainMenu = glutCreateMenu(mainSelect); glutAddMenuEntry("Reset splays", 0); glutAddMenuEntry("Reset splat config", 1); glutAddSubMenu("Red control", redMenu); glutAddSubMenu("Green control", greenMenu); glutAddSubMenu("Blue control", blueMenu); glutAddMenuEntry("+25% zoom", 2); glutAddMenuEntry("-25% zoom", 3); glutAddMenuEntry("X flip", 4); glutAddMenuEntry("Y flip", 5); glutAddMenuEntry("Enable alpha test", 6); glutAddMenuEntry("Disable alpha test", 7); glutSetMenu(mainMenu); glutAddMenuEntry("Query raster position", 411); glutAddMenuEntry("Quit", 666); glutAttachMenu(GLUT_RIGHT_BUTTON); glutMainLoop(); return 0; /* Never reached; make ANSI C happy. */ }
void InitMenus( ) { glutSetWindow( MainWindow ); int numColors = sizeof( Colors ) / ( 3*sizeof(int) ); int colormenu = glutCreateMenu( DoColorMenu ); for( int i = 0; i < numColors; i++ ) { glutAddMenuEntry( ColorNames[i], i ); } int axesmenu = glutCreateMenu( DoAxesMenu ); glutAddMenuEntry( "Off", 0 ); glutAddMenuEntry( "On", 1 ); int depthcuemenu = glutCreateMenu( DoDepthMenu ); glutAddMenuEntry( "Off", 0 ); glutAddMenuEntry( "On", 1 ); int debugmenu = glutCreateMenu( DoDebugMenu ); glutAddMenuEntry( "Off", 0 ); glutAddMenuEntry( "On", 1 ); int projmenu = glutCreateMenu( DoProjectMenu ); glutAddMenuEntry( "Orthographic", ORTHO ); glutAddMenuEntry( "Perspective", PERSP ); int viewmenu = glutCreateMenu( DoViewMenu ); glutAddMenuEntry( "Outside", OUTSIDE ); glutAddMenuEntry( "Inside", INSIDE ); int mainmenu = glutCreateMenu( DoMainMenu ); glutAddSubMenu( "Axes", axesmenu); glutAddSubMenu( "Colors", colormenu); glutAddSubMenu( "Depth Cue", depthcuemenu); glutAddSubMenu( "Projection", projmenu ); glutAddSubMenu( "View", viewmenu ); glutAddMenuEntry( "Reset", RESET ); glutAddSubMenu( "Debug", debugmenu); glutAddMenuEntry( "Quit", QUIT ); // attach the pop-up menu to the right mouse button: glutAttachMenu( GLUT_RIGHT_BUTTON ); }
/****************************************************************************** Initializes GLUT. ******************************************************************************/ void initGlut(int argc, char* argv[]) { // Initialize GLUT. glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutCreateWindow("GLUT/Coulomb Forces Demo"); // Setup GLUT callbacks. glutDisplayFunc(displayFunction); glutIdleFunc(handleIdle); // Setup GLUT popup menu. glutCreateMenu(handleMenu); glutAddMenuEntry("Reverse Charge", 1); glutAttachMenu(GLUT_RIGHT_BUTTON); glutAddMenuEntry("Quit", 0); glutAttachMenu(GLUT_RIGHT_BUTTON); }
void OpenGLApplicationBase::setupMenus() { GLuint menu1id = createPolygonMenu(); GLuint menu2id = createFrontFaceMenu(); GLuint menu3id = createPointSizeMenu(); GLuint menu4id = createLineWidthMenu(); GLuint menu5id = createAntiAliasingMenu(); //Create main menu topMenu = glutCreateMenu(mainMenu); glutAddSubMenu("Polygon Mode", menu1id); glutAddSubMenu("Rendered Polygon Face", menu2id); glutAddSubMenu("Point Size", menu3id); glutAddSubMenu("Line Width", menu4id); glutAddSubMenu("Anti-aliasing", menu5id); glutAddMenuEntry("Quit", 1); //Quit identifier. glutAttachMenu(GLUT_RIGHT_BUTTON);//Menu responds to right button }
int main (int argc, char ** argv) { // main function if (argc<2) { printf ("usage: %s <trackfile>\n", argv[0]); exit(0); } loadSplines(argv[1]); // load up the splines // used to get the second spline, offset it to get two tracks for (int i=0; i<g_Splines[1].numControlPoints; i++) { // load up the second spline double x_offset = g_Splines[1].points[i].x; double y_offset = g_Splines[1].points[i].y; double z_offset = g_Splines[1].points[i].z; double normal = sqrt(pow(x_offset,2)+pow(y_offset,2)+pow(z_offset,2)); // normalize x_offset = x_offset/normal*-1.1; // to offset y_offset = y_offset/normal*-1.1; z_offset = z_offset/normal*-1.1; g_Splines[1].points[i].x = g_Splines[0].points[i].x + x_offset; // offset slightly from the original track g_Splines[1].points[i].y = g_Splines[0].points[i].y + y_offset; g_Splines[1].points[i].z = g_Splines[0].points[i].z + z_offset; } glutInit(&argc,argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE); glutInitWindowPosition(200,200); // window position on screen at 200,200 glutInitWindowSize(640, 480); // window size is 640x480 glutCreateWindow("CSCI480 Assignment 2 - Jeremy Chen"); // window title glutDisplayFunc(display); g_iMenuId = glutCreateMenu(menu); // create menu glutSetMenu(g_iMenuId); glutAddMenuEntry("Quit", 0); glutAddMenuEntry("Restart",1); glutAttachMenu(GLUT_RIGHT_BUTTON); // use right-button to get menu glutIdleFunc(doIdle); myinit(); glutMainLoop(); }
// register callbacks with GLUT void registerCallbacks(void) { glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutReshapeFunc(reshape); glutMotionFunc(mouseMotion); glutMouseFunc(mouse); glutCreateMenu(mouseMenu); glutAddMenuEntry("quit",1); glutAddMenuEntry("torso",2); // XXX: allow selecting/transforming // other body parts as well // INSERT YOUR CODE HERE // END XXX glutAttachMenu(GLUT_RIGHT_BUTTON); return; }
int main(void) { glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowPosition(0, 0); glutInitWindowSize(512, 512); glutCreateWindow("Triangle"); glutCreateMenu(ProcessMenu); glutAddMenuEntry("은면 제거", 1); glutAddMenuEntry("깊이 테스트", 2); glutAddMenuEntry("뒷면 라인 그리기", 3); glutAttachMenu(GLUT_RIGHT_BUTTON); glutDisplayFunc(RenderScene); glutReshapeFunc(ChangeSize); glutSpecialFunc(KeyControl); SetupRC(); glutMainLoop(); }
void createMenu(void) { glutCreateMenu(menu); // submenu_id = glutCreateMenu(menu); // glutAddMenuEntry("Sphere", 1); // menu_id = glutCreateMenu(menu); glutAddMenuEntry("Pause", Pause); glutAddMenuEntry("Resume", Resume); glutAddMenuEntry("Quit", Quit); glutAddMenuEntry("XPlus", XPlus); glutAddMenuEntry("XMinus", XMinus); glutAddMenuEntry("YPlus", YPlus); glutAddMenuEntry("YMinus", YMinus); glutAddMenuEntry("ZPlus", ZPlus); glutAddMenuEntry("ZMinus", ZMinus); // glutAddSubMenu("Draw", submenu_id); // glutAddMenuEntry("Quit", 0); glutAttachMenu(GLUT_RIGHT_BUTTON); }
////////////////////////////////////////////////////// // Program entry point int main(int argc, char *argv[]) { gltSetWorkingDirectory(argv[0]); // Standard initialization stuff glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(800, 600); glutCreateWindow("Anisotropic Tunnel"); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); #ifdef ANGLE glutKeyboardFunc(KeyPressFunc); #else // Add menu entries to change filter glutCreateMenu(ProcessMenu); glutAddMenuEntry("GL_NEAREST",0); glutAddMenuEntry("GL_LINEAR",1); glutAddMenuEntry("GL_NEAREST_MIPMAP_NEAREST",2); glutAddMenuEntry("GL_NEAREST_MIPMAP_LINEAR", 3); glutAddMenuEntry("GL_LINEAR_MIPMAP_NEAREST", 4); glutAddMenuEntry("GL_LINEAR_MIPMAP_LINEAR", 5); glutAddMenuEntry("Anisotropic Filter", 6); glutAddMenuEntry("Anisotropic Off", 7); glutAttachMenu(GLUT_RIGHT_BUTTON); GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } #endif // Startup, loop, shutdown SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutCreateWindow("Zadanie 3"); Init(); glutCreateMenu(Menu); glutAddMenuEntry("GL_LINEAR", SWITCH_TO_LINEAR); glutAddMenuEntry("GL_NEAREST", SWITCH_TO_NEAREST); glutAttachMenu(GLUT_RIGHT_BUTTON); glutDisplayFunc(Display); glutMainLoop(); return 0; }
// Main int main(int argc, char **argv) { printInteraction(0x80); glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize (500, 500); glutInitWindowPosition (50, 50); glutCreateWindow ("Graphics II Project"); glutCreateMenu(menu); createMenu(); setup(); glutDisplayFunc(drawScene); glutReshapeFunc(resize); glutKeyboardFunc(keyInput); glutIdleFunc(animate); glutMainLoop(); return 0; }
void init() { glEnable(GL_DEPTH_TEST); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE); glEnable(GL_LIGHTING); GLfloat globalAmbient[ ] = { 1.00, 1.00, 1.00, 0.0 }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient); glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE, mat_ambient_diffuse); glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular); glMaterialf(GL_FRONT,GL_SHININESS,mat_shininess); glClearColor(0.0,0.0,0.0,0.0); glutCreateMenu(menu); glutAddMenuEntry("pause/unpause (p)", 1); glutAddMenuEntry("restart game (r)", 2); glutAddMenuEntry("quit", 0); glutAttachMenu(GLUT_RIGHT_BUTTON); }
void createPopupMenus() { lightMenu_one = glutCreateMenu(processLightMenu_one); glutAddMenuEntry("Off",0); glutAddMenuEntry("White Light",1); glutAddMenuEntry("Red Light",2); glutAddMenuEntry("Blue Light",3); glutAddMenuEntry("Green Light",4); lightMenu_two = glutCreateMenu(processLightMenu_two); glutAddMenuEntry("Off",0); glutAddMenuEntry("White Light",1); glutAddMenuEntry("Red Light",2); glutAddMenuEntry("Blue Light",3); glutAddMenuEntry("Green Light",4); lightMenu_three = glutCreateMenu(processLightMenu_three); glutAddMenuEntry("Off",0); glutAddMenuEntry("White Light",1); glutAddMenuEntry("Red Light",2); glutAddMenuEntry("Blue Light",3); glutAddMenuEntry("Green Light",4); materialsMenu = glutCreateMenu (processMaterialsMenu); glutAddMenuEntry("Gold",GLD); glutAddMenuEntry("Silver",SVR); glutAddMenuEntry("Copper",CPR); elementsMenu = glutCreateMenu (processElementsMenu); glutAddMenuEntry("Ambient only",AMB); glutAddMenuEntry("Ambient and Diffuse",DIF); glutAddMenuEntry("Ambient, Diffuse and Specular",SPC); mainMenu = glutCreateMenu(processMainMenu); glutAddSubMenu("Light 1", lightMenu_one); glutAddSubMenu("Light 2", lightMenu_two); glutAddSubMenu("Light 3", lightMenu_three); glutAddSubMenu("Material Properties", materialsMenu); glutAddSubMenu("Light Elements", elementsMenu); glutAddMenuEntry("Quit",0); // attach the menu to the right button glutAttachMenu(GLUT_RIGHT_BUTTON); // this will allow us to know if the menu is active glutMenuStatusFunc(processMenuStatus); }
void Graphics::MainLoop(void) { m_graphics = this; //create window static int argc = 1; static char *args = (char*)"args"; glutInit(&argc, &args); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize(1000, 600); glutInitWindowPosition(0, 0); glutCreateWindow("Bug Algorithms"); //register callback functions glutDisplayFunc(CallbackEventOnDisplay); glutMouseFunc(CallbackEventOnMouse); glutIdleFunc(NULL); glutTimerFunc(0, CallbackEventOnTimer, 0); glutKeyboardFunc(CallbackEventOnKeyPress); glutSpecialFunc(CallbackEventOnSpecialKeyPress); //create menu glutCreateMenu(CallbackEventOnMenu); MENU_RUN_MOTION_PLANNER = 1; MENU_SET_MAX_TIME_MOTION_PLANNER = 2; MENU_GET_BEST_PATH = 3; MENU_SET_TIMER_ANIMATE_BEST_PATH = 4; MENU_DRAW_MOTION_PLANNER = 5; glutAddMenuEntry("Run motion planner", MENU_RUN_MOTION_PLANNER); glutAddMenuEntry("Set max time to run motion planner", MENU_SET_MAX_TIME_MOTION_PLANNER); glutAddMenuEntry("Get highest reward path", MENU_GET_BEST_PATH); glutAddMenuEntry("Set timer to animate highest reward path", MENU_SET_TIMER_ANIMATE_BEST_PATH); glutAddMenuEntry("Draw motion planner [yes/no]", MENU_DRAW_MOTION_PLANNER); glutAttachMenu(GLUT_RIGHT_BUTTON); //enter main event loop glutMainLoop(); }
int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(800, 600); glutCreateWindow("Smoothing Out The Jaggies"); // Create the Menu glutCreateMenu(ProcessMenu); glutAddMenuEntry("Antialiased Rendering",1); glutAddMenuEntry("Normal Rendering",2); glutAttachMenu(GLUT_RIGHT_BUTTON); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); SetupRC(); glutMainLoop(); return 0; }
static void menu_init(void) { glutCreateMenu(menu_selected); glutAddMenuEntry("1 Subdivision", 1); glutAddMenuEntry("2 Subdivisions", 2); glutAddMenuEntry("3 Subdivisions", 3); glutAddMenuEntry("4 Subdivisions", 4); glutAddMenuEntry("5 Subdivisions", 5); glutAddMenuEntry("6 Subdivisions", 6); glutAddMenuEntry("7 Subdivisions", 7); glutAddMenuEntry("10 Subdivisions", 10); glutAddMenuEntry("50 Subdivisions", 50); glutAddMenuEntry("100 Subdivisions", 100); glutAddMenuEntry("500 Subdivisions", 500); glutAddMenuEntry("Quit", QUIT); glutAttachMenu(GLUT_RIGHT_BUTTON); }