int main() { Rect bounds = {44,12,330,500}/*,zoomFrom,zoomTo*/; //Rect tempRect1; //used for carbonization InitStuff(); gWindow = NewWindow(nil,&bounds,"\pDrag Two Rects to Zoom",true,documentProc,(WindowPtr)-1L,true,0); //SetPort(window); SetPortWindowPort(gWindow); /*do { if (GetRects(&zoomFrom,&zoomTo)) ZoomRect(kZoomLarger,&zoomFrom,&zoomTo); //EraseRect(&window->portRect); EraseRect(GetPortBounds(GetWindowPort(window), &tempRect1)); } while (!gDone);*/ doEventLoop(); FlushEvents(everyEvent,0); return 0; }
int main (int argc, char * argv[]) { srand(time(NULL)); srand((unsigned int)time((time_t *)NULL)); printf("Instructions:\n" "Hold down the left mouse button to rotate image: \n" "\n" "Hold 'm' while holding down the right mouse to move the end\n" "Hold 't' while holding down the right mouse to rotate the tangent \n" "\n" "Press 'Esc' to quit\n" ); InitGLUT(argc, argv); InitLights(); InitStuff (); InitThread(argc, argv); glutMainLoop (); }
/* Init most of all firms of client */ void InitUser (struct client * user, struct clientlist *clList, int fd) { //user->number = clList->cnt; It's not need.fn better GetUserId() user->next = NULL; user->contact = (struct settings*)malloc(sizeof(struct settings)); InitSettings (user->contact, fd, clList->cnt); user->f = (struct userFlags *) malloc (sizeof(struct userFlags)); InitFlags (user->f); user->sell = (struct auction *) malloc (sizeof(struct auction)); InitBuyOrSell (user->sell); user->buy = (struct auction *) malloc (sizeof(struct auction)); InitBuyOrSell (user->buy); user->data = (struct stuff *) malloc (sizeof(struct stuff)); InitStuff (user->data); user->buf = (struct buffer * ) malloc (sizeof(struct buffer)); InitBuffer (user->buf); user->cmd = (struct command * ) malloc (sizeof(struct command)); InitCommand (user->cmd); }
ICPClass::ICPClass() { if(!g_bRealisticAvionics) { //MI Original code strcpy(mpSelectedModeName, ICPModeNames[NAV_MODE]); mICPPrimaryMode = AA_MODE; mICPSecondaryMode = NONE_MODE; mICPTertiaryMode = COMM1_MODE; mpTertiaryExclusiveButton = NULL; mpSecondaryExclusiveButton = NULL; mpPrimaryExclusiveButton = NULL; mWPIndex = 0; mMarkIndex = 0; mDLinkIndex = 0; mList = STPT_LIST; HomeWP = 1; *mpLine1 = '\0'; *mpLine2 = '\0'; *mpLine3 = '\0'; //Wombat778 10-20-2003 Initialize the PFL in easy avionics. Should fix easy avionics CTD. Should I just put the whole InitStuff() line here? m_FaultDisplay = false; m_subsystem = FaultClass::amux_fault; m_function = FaultClass::nofault; //end of PFL Initialization mUpdateFlags = CNI_UPDATE; } else { //MI modified for ICP stuff strcpy(mpSelectedModeName, ICPModeNames[NAV_MODE]); mICPPrimaryMode = NAV_MODE; mICPSecondaryMode = NONE_MODE; mICPTertiaryMode = NONE_MODE; mpTertiaryExclusiveButton = NULL; mpSecondaryExclusiveButton = NULL; mpPrimaryExclusiveButton = NULL; LastMode = CNI_MODE; mWPIndex = 0; mMarkIndex = 0; mDLinkIndex = 0; mList = STPT_LIST; *mpLine1 = '\0'; *mpLine2 = '\0'; *mpLine3 = '\0'; //Init our stuff InitStuff(); mUpdateFlags = CNI_UPDATE; } }
int main (int argc, char * argv[]) { //srand(time(NULL)); //srand((unsigned int)time((time_t *)NULL)); printf("Instructions:\n" "Hold down the left mouse button to rotate image: \n" "\n" "Hold 'm' while holding down the right mouse to move the end\n" "Hold 't' while holding down the right mouse to rotate the tangent \n" "\n" "Press 'Esc' to quit\n" ); InitGLUT(argc, argv); InitLights(); InitStuff (); InitThread(argc, argv); signal(SIGINT, &interruptHandler); cout << "Running with CPU Threads = " << NUM_CPU_THREADS << endl; glutMainLoop (); }
/* * InitGame: * Initializes core game components */ void InitGame() { // open the error file, useful for debugging OpenErrorFile("error.dat"); WriteError("\n ====== INITIALIZATION ======"); // Generate trig lookup tables WriteError("\n Generating trig lookup tables..."); GenerateTabs(); WriteError("\n Trig lookups generated..."); // Initialize directdraw #ifdef WINDOWED WriteError("\n Initializing DirectDraw Windowed mode..."); DDInitWindowed(640, 480, 16, g_hWnd, RestoreGraphics); WriteError("\n DirectDraw Windowed mode initialized..."); #else WriteError("\n Initializing DirectDraw FullScreen mode..."); DDInitFullscreen(640, 480, 16, g_hWnd, RestoreGraphics); WriteError("\n DirectDraw FullScreen mode initialized..."); #endif // initialize Digital FX WriteError("\n Initializing DigitalFX..."); DFXInit(lpDDSPrimary); WriteError("\n DigitalFX Initialized..."); // initialize directsound WriteError("\n Initializing DirectSound..."); DSInit(g_hWnd); WriteError("\n DirectSound Initialized..."); // initialize Directinput WriteError("\n Initializing DirectInput..."); DIInit(g_hInstance); WriteError("\n DirectInput Initialized..."); // initialize all input devices WriteError("\n Initializing Keyboard Input Device..."); DIInitKeyboard(g_hWnd); WriteError("\n Keyboard initialized..."); WriteError("\n Initializing Joystick Input Device..."); DIInitJoystick(g_hWnd); WriteError("\n Joystick initialized..."); // Pick which memcpy we should use WriteError("\n Determining fastest Memcpy() method..."); Pickmemcpy(); // Initialize the pixel shade table WriteError("\n Initializing Pixel Shade lookup..."); InitPixelShade(); WriteError("\n Pixel Shade lookup initialized..."); // Initialize game stuff InitStuff(); WriteError("\n ====== END INITIALIZATION ======"); // Hide the mouse cursor ShowCursor(FALSE); }
int main (int argc, char * argv[]) { srand(time(NULL)); srand((unsigned int)time((time_t *)NULL)); #ifdef READ_THREADS traj_reader.read_threads_from_file(); all_threads = traj_reader.get_all_threads(); #endif /* int me, numprocs; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); std::cout << "num processors: " << numprocs << std::endl; MPI_Comm_rank(MPI_COMM_WORLD, &me);*/ printf("Instructions:\n" "Hold down the left mouse button to rotate image: \n" "\n" "Hold 'm' while holding down the right mouse to move the end\n" "Hold 't' while holding down the right mouse to rotate the tangent \n" "\n" "Press 'q' to quit\n" ); /* initialize glut */ glutInit (&argc, argv); //can i do that? glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(900,900); glutCreateWindow ("Thread"); glutDisplayFunc (DrawStuff); glutMotionFunc (MouseMotion); glutMouseFunc (processMouse); glutKeyboardFunc(processNormalKeys); glutKeyboardUpFunc(processKeyUp); /* create popup menu */ glutCreateMenu (JoinStyle); glutAddMenuEntry ("Exit", 99); glutAttachMenu (GLUT_MIDDLE_BUTTON); /* initialize GL */ glClearDepth (1.0); glEnable (GL_DEPTH_TEST); glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); glMatrixMode (GL_PROJECTION); /* roughly, measured in centimeters */ glFrustum (-30.0, 30.0, -30.0, 30.0, 50.0, 500.0); glMatrixMode(GL_MODELVIEW); /* initialize lighting */ glLightfv (GL_LIGHT0, GL_POSITION, lightOnePosition); glLightfv (GL_LIGHT0, GL_DIFFUSE, lightOneColor); glEnable (GL_LIGHT0); glLightfv (GL_LIGHT1, GL_POSITION, lightTwoPosition); glLightfv (GL_LIGHT1, GL_DIFFUSE, lightTwoColor); glEnable (GL_LIGHT1); glLightfv (GL_LIGHT2, GL_POSITION, lightThreePosition); glLightfv (GL_LIGHT2, GL_DIFFUSE, lightThreeColor); glEnable (GL_LIGHT2); glLightfv (GL_LIGHT3, GL_POSITION, lightFourPosition); glLightfv (GL_LIGHT3, GL_DIFFUSE, lightFourColor); glEnable (GL_LIGHT3); glEnable (GL_LIGHTING); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable (GL_COLOR_MATERIAL); InitStuff (); #ifdef READ_THREADS thread = &all_threads[thread_ind]; #else initThread(); thread->minimize_energy(); #endif updateThreadPoints(); updateIms(_start_pt); thread_vision.set_max_length(98); thread_vision.setInitPt(_start_pt); thread_vision.optimizeThread(); for (int i=0; i < NUM_PTS; i++) { radii[i]=THREAD_RADII; } glutMainLoop (); // return 0; /* ANSI C requires main to return int. */ }
int main (int argc, char * argv[]) { srand(time(NULL)); srand((unsigned int)time((time_t *)NULL)); /* int me, numprocs; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); std::cout << "num processors: " << numprocs << std::endl; MPI_Comm_rank(MPI_COMM_WORLD, &me);*/ printf("Instructions:\n" "Hold down the left mouse button to rotate image: \n" "\n" "Hold 'm' while holding down the right mouse to move the end\n" "Hold 't' while holding down the right mouse to rotate the tangent \n" "\n" "Press 'q' to recalculate the thread from initial\n" ); /* initialize glut */ glutInit (&argc, argv); //can i do that? glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(900,900); glutCreateWindow ("Thread"); glutDisplayFunc (DrawStuff); glutMotionFunc (MouseMotion); glutMouseFunc (processMouse); glutKeyboardFunc(processNormalKeys); glutKeyboardUpFunc(processKeyUp); /* create popup menu */ glutCreateMenu (JoinStyle); glutAddMenuEntry ("Exit", 99); glutAttachMenu (GLUT_MIDDLE_BUTTON); /* initialize GL */ glClearDepth (1.0); glEnable (GL_DEPTH_TEST); glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); glMatrixMode (GL_PROJECTION); /* roughly, measured in centimeters */ glFrustum (-30.0, 30.0, -30.0, 30.0, 50.0, 500.0); glMatrixMode(GL_MODELVIEW); /* initialize lighting */ glLightfv (GL_LIGHT0, GL_POSITION, lightOnePosition); glLightfv (GL_LIGHT0, GL_DIFFUSE, lightOneColor); glEnable (GL_LIGHT0); glLightfv (GL_LIGHT1, GL_POSITION, lightTwoPosition); glLightfv (GL_LIGHT1, GL_DIFFUSE, lightTwoColor); glEnable (GL_LIGHT1); glLightfv (GL_LIGHT2, GL_POSITION, lightThreePosition); glLightfv (GL_LIGHT2, GL_DIFFUSE, lightThreeColor); glEnable (GL_LIGHT2); glLightfv (GL_LIGHT3, GL_POSITION, lightFourPosition); glLightfv (GL_LIGHT3, GL_DIFFUSE, lightFourColor); glEnable (GL_LIGHT3); glEnable (GL_LIGHTING); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable (GL_COLOR_MATERIAL); InitStuff (); /* positions[0](0) = 50.0; positions[0](1) = 0.0; positions[0](2) = 0.0; positions[1](0) = -40.0; positions[1](1) = 80.0; positions[1](2) = 80.0; tangents[0](0) = 0.0; tangents[0](1) = 0.0; tangents[0](2) = 1.0; tangents[1](0) = 1.0; tangents[1](1) = 0.0; tangents[1](2) = 1.0;*/ positions[0](0) = 10.0; positions[0](1) = 0.0; positions[0](2) = 0.0; positions[1](0) = -50.0; positions[1](1) = 50.0; positions[1](2) = 10.0; tangents[0](0) = 0.0; tangents[0](1) = 0.0; tangents[0](2) = 1.0; tangents[1](0) = -1.0; tangents[1](1) = 1.0; tangents[1](2) = 0.0; tangents[0].normalize(); tangents[1].normalize(); thread = new Thread(curvature, torsion, length, num, positions, tangents); // thread->turnOnNoise(0.4); thread->minimize_energy_fixedPieces(); if (image_record_mode != NONE_IMAGE) traj_recorder.add_thread_to_list(new Thread(thread)); //see if we need to load motions if (traj_mode == PLAYBACK) { traj_reader.read_motions_from_file(); /* traj_reader.read_threads_from_file(); traj_reader.estimate_init_thread(); thread = new Thread(traj_reader.start_thread()); thread->getWantedEndPosition(positions[1]); thread->getWantedEndTangent(tangents[1]); Matrix4d startTransEst; thread->getStartTransform(startTransEst); positions[0] = startTransEst.corner(Eigen::TopRight,3,1); tangents[0] = startTransEst.corner(Eigen::TopLeft,3,1); */ } for (int i=0; i < NUM_PTS; i++) { radii[i]=THREAD_RADII; } glutMainLoop (); // return 0; /* ANSI C requires main to return int. */ }
int main (int argc, char * argv[]) { /* initialize glut */ glutInit (&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow ("texture"); glutDisplayFunc (DrawStuff); glutMotionFunc (MouseMotion); /* create popup menu */ glutCreateMenu (TextureStyle); glutAddMenuEntry ("Texture Off", 301); glutAddMenuEntry ("Texture On", 302); glutAddMenuEntry ("--------------", 9999); glutAddMenuEntry ("Vertex Flat", 501); glutAddMenuEntry ("Normal Flat", 502); glutAddMenuEntry ("Vertex Cylinder", 503); glutAddMenuEntry ("Normal Cylinder", 504); glutAddMenuEntry ("Vertex Sphere", 505); glutAddMenuEntry ("Normal Sphere", 506); glutAddMenuEntry ("--------------", 9999); glutAddMenuEntry ("Model Vertex Flat", 507); glutAddMenuEntry ("Model Normal Flat", 508); glutAddMenuEntry ("Model Vertex Cylinder", 509); glutAddMenuEntry ("Model Normal Cylinder", 510); glutAddMenuEntry ("Model Vertex Sphere", 511); glutAddMenuEntry ("Model Normal Sphere", 512); glutAddMenuEntry ("--------------", 9999); glutAddMenuEntry ("Check Texture", 701); glutAddMenuEntry ("Barberpole Texture", 702); glutAddMenuEntry ("Wild Tooth Texture", 703); glutAddMenuEntry ("Molten Lava Texture", 704); glutAddMenuEntry ("--------------", 9999); glutAddMenuEntry ("Exit", 99); glutAttachMenu (GLUT_MIDDLE_BUTTON); /* initialize GL */ glClearDepth (1.0); glEnable (GL_DEPTH_TEST); glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); glMatrixMode (GL_PROJECTION); /* roughly, measured in centimeters */ glFrustum (-9.0, 9.0, -9.0, 9.0, 50.0, 150.0); glMatrixMode(GL_MODELVIEW); /* initialize lighting */ glLightfv (GL_LIGHT0, GL_POSITION, lightOnePosition); glLightfv (GL_LIGHT0, GL_DIFFUSE, lightOneColor); glEnable (GL_LIGHT0); glLightfv (GL_LIGHT1, GL_POSITION, lightTwoPosition); glLightfv (GL_LIGHT1, GL_DIFFUSE, lightTwoColor); glEnable (GL_LIGHT1); glEnable (GL_LIGHTING); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable (GL_COLOR_MATERIAL); glColor3f (0.8, 0.3, 0.6); /* initialize and enable texturing */ setup_textures (); gluBuild2DMipmaps (GL_TEXTURE_2D, 3, current_texture -> size, current_texture -> size, GL_RGB, GL_UNSIGNED_BYTE, (void *) (current_texture->pixmap)); glMatrixMode (GL_TEXTURE); glLoadIdentity (); glScalef (1.0, 0.1, 1.0); glMatrixMode (GL_MODELVIEW); glEnable (GL_TEXTURE_2D); /* some stuff to play with .... glTexGeni (GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glTexGeni (GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glEnable (GL_TEXTURE_GEN_S); glEnable (GL_TEXTURE_GEN_T); */ gleTextureMode (GLE_TEXTURE_ENABLE | GLE_TEXTURE_VERTEX_CYL); InitStuff (); glutMainLoop (); return 0; /* ANSI C requires main to return int. */ }
int main (int argc, char * argv[]) { /* int me, numprocs; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); std::cout << "num processors: " << numprocs << std::endl; MPI_Comm_rank(MPI_COMM_WORLD, &me);*/ printf("Instructions:\n" "Hold down the left mouse button to rotate image: \n" "\n" "Hold 'm' while holding down the right mouse to move the end\n" "Hold 't' while holding down the right mouse to rotate the tangent \n" "\n" "Press 'q' to recalculate the thread from initial\n" ); /* initialize glut */ glutInit (&argc, argv); //can i do that? glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(900,900); glutCreateWindow ("Thread"); glutDisplayFunc (DrawStuff); glutMotionFunc (MouseMotion); glutMouseFunc (processMouse); glutKeyboardFunc(processNormalKeys); glutKeyboardUpFunc(processKeyUp); /* create popup menu */ glutCreateMenu (JoinStyle); glutAddMenuEntry ("Exit", 99); glutAttachMenu (GLUT_MIDDLE_BUTTON); /* initialize GL */ glClearDepth (1.0); glEnable (GL_DEPTH_TEST); glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); glMatrixMode (GL_PROJECTION); /* roughly, measured in centimeters */ glFrustum (-30.0, 30.0, -30.0, 30.0, 50.0, 500.0); glMatrixMode(GL_MODELVIEW); /* initialize lighting */ glLightfv (GL_LIGHT0, GL_POSITION, lightOnePosition); glLightfv (GL_LIGHT0, GL_DIFFUSE, lightOneColor); glEnable (GL_LIGHT0); glLightfv (GL_LIGHT1, GL_POSITION, lightTwoPosition); glLightfv (GL_LIGHT1, GL_DIFFUSE, lightTwoColor); glEnable (GL_LIGHT1); glLightfv (GL_LIGHT2, GL_POSITION, lightThreePosition); glLightfv (GL_LIGHT2, GL_DIFFUSE, lightThreeColor); glEnable (GL_LIGHT2); glLightfv (GL_LIGHT3, GL_POSITION, lightFourPosition); glLightfv (GL_LIGHT3, GL_DIFFUSE, lightFourColor); glEnable (GL_LIGHT3); glEnable (GL_LIGHTING); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable (GL_COLOR_MATERIAL); InitStuff (); positions[0](0) = 50.0; positions[0](1) = 0.0; positions[0](2) = 0.0; positions[1](0) = -40.0; positions[1](1) = 80.0; positions[1](2) = 80.0; tangents[0](0) = 0.0; tangents[0](1) = 0.0; tangents[0](2) = 1.0; tangents[1](0) = 1.0; tangents[1](1) = 0.0; tangents[1](2) = 1.0; thread = new Thread(curvature, torsion, length, num, positions, tangents); thread->minimize_energy(); for (int i=0; i < NUM_PTS; i++) { radii[i]=THREAD_RADII; } //initialize images threadStereo = new ThreadStereo(); Point2i start; updateIms(start); vision_draw.resize(0); threadStereo->optimizeThread(vision_draw, start); threadStereo->display(); glutMainLoop (); // return 0; /* ANSI C requires main to return int. */ }
int main (int argc, char * argv[]) { srand(time(NULL)); srand((unsigned int)time((time_t *)NULL)); printf("Instructions:\n" "Hold down the left mouse button to rotate image: \n" "\n" "Hold 'm' while holding down the right mouse to move the end\n" "Hold 't' while holding down the right mouse to rotate the tangent \n" "\n" "Press 'Esc' to quit\n" ); InitGLUT(argc, argv); InitLights(); InitStuff (); InitThread(argc, argv); traj_reader_good.read_threads_from_file(); traj_reader_bad.read_threads_from_file(); #ifdef NYLON thread_vision.set_reproj_fix_canny(POINTFILE_NYLON); #elif defined PURPLE thread_vision.set_reproj_fix_canny(POINTFILE_PURPLE); #elif defined BLACK thread_vision.set_reproj_fix_canny(POINTFILE_BLACK); #endif // for (int i=0; i < NUM_PTS; i++) // { // radii[i]=THREAD_RADII; // } // // /* std::cout << (traj_reader.get_all_threads()[0].start_pos() - traj_reader.get_all_threads()[0].end_pos()).norm() << std::endl; std::cout << (traj_reader.get_all_threads()[10].start_pos() - traj_reader.get_all_threads()[10].end_pos()).norm() << std::endl; std::cout << (traj_reader.get_all_threads()[20].start_pos() - traj_reader.get_all_threads()[20].end_pos()).norm() << std::endl; std::cout << (traj_reader.get_all_threads()[30].start_pos() - traj_reader.get_all_threads()[30].end_pos()).norm() << std::endl; std::cout << (traj_reader.get_all_threads()[40].start_pos() - traj_reader.get_all_threads()[40].end_pos()).norm() << std::endl; std::cout << (traj_reader.get_all_threads()[50].start_pos() - traj_reader.get_all_threads()[50].end_pos()).norm() << std::endl; std::cout << (traj_reader.get_all_threads().back().start_pos() - traj_reader.get_all_threads().back().end_pos()).norm() << std::endl; */ if (TRY_ALL) { char filename_errs[256]; #ifdef NYLON sprintf(filename_errs, "%s%s.txt", POINTS_ERR_SAVE_BASE, "nylon"); #elif defined PURPLE sprintf(filename_errs, "%s%s.txt", POINTS_ERR_SAVE_BASE, "purple"); #elif defined BLACK sprintf(filename_errs, "%s%s.txt", POINTS_ERR_SAVE_BASE, "black"); #else sprintf(filename_errs, "%s%s.txt", POINTS_ERR_SAVE_BASE, "notype"); #endif std::ofstream points_err_out; points_err_out.precision(10); points_err_out.open(filename_errs); while (thread_ind < all_threads.size()) { processNormalKeys('v', lastx_R, lasty_R); points_err_out << thread_ind << " " << err_fullopt << " " << err_visiononly << " " << twistAngle_correct << " " <<score_correct_twist << " " << " " << twistAngle_best << " " << score_best_twist << "\n"; points_err_out.flush(); processNormalKeys('s', lastx_R, lasty_R); } points_err_out.close(); exit(0); } glutMainLoop (); }