int mainCPU(int argc, char **argv) { amiSmallptCPU = 1; //fprintf(stderr, "Usage: %s\n", argv[0]); //fprintf(stderr, "Usage: %s <window width> <window height> <scene file>\n", argv[0]); /* if (argc == 4) { width = atoi(argv[1]); height = atoi(argv[2]); ReadScene(argv[3]); } else if (argc == 1) { */ spheres = CornellSpheres; sphereCount = sizeof(CornellSpheres) / sizeof(Sphere); vinit(camera.orig, 50.f, 45.f, 205.6f); vinit(camera.target, 50.f, 45 - 0.042612f, 204.6); /* } else exit(-1); */ UpdateCamera(); /*------------------------------------------------------------------------*/ AllocateBuffers(); /*------------------------------------------------------------------------*/ InitGlut(argc, argv, "SmallPT CPU V1.6 (Written by David Bucciarelli)"); glutMainLoop( ); return 0; }
bool Kengine::Init(int argc, char** argv) { // Initialize GLUT and GLEW InitGlut(argc, argv); // TODO: Setup GLUI glewInit(); // Initialize Shader shader = new Shader; if (!shader->Init("vert.glsl", "frag.glsl")) return false; shader->Enable(); // Set the Renderable class to use the shader Renderable::BindShader(shader); camera = new Camera; camera->Init(glm::vec3(3.f, 4.f, 3.f), glm::vec3(.0f, .0f, .0f), glm::vec3(.0f, 1.f, .0f)); userInput = new UserInput; userInput->BindCamera(camera); level = new Level; level->Init(argv[1]); InitCallbacks(); return true; }
int main(int argc, char *argv[]) { amiMandelCPU = 1; fprintf(stderr, "Usage: %s\n", argv[0]); fprintf(stderr, "Usage: %s <window width> <window height> <max. iterations>\n", argv[0]); if (argc == 4) { width = atoi(argv[4]); height = atoi(argv[5]); maxIterations = atoi(argv[1]); } else if (argc != 1) exit(-1); AllocateBuffers(); UpdateMandel(); //-------------------------------------------------------------------------- InitGlut(argc, argv, "MandelCPU V1.3 (Written by David Bucciarelli)"); glutMainLoop(); //-------------------------------------------------------------------------- return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 702: Suspension and Torque"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 211: 6DOF Joint Limits, Springs"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 408: Fragmenting Objects"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 216: 6DOF Angular Driver"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 1006: Tearing"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 801: Hardware Scene Manager"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 703: Brakes and Steering"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 904: Fluid and Drain"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 503: Core Dump"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 213: 6DOF Motion Controller"); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { PrintControls(); InitGlut(argc, argv, "Lesson 405: Grass"); NewLight(); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false; gbThreadScheduler = true; PrintControls(); InitGlut(argc, argv); InitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { InitWin7(); InitDevIL(); InitRun(argc,argv); InitGlut(argc, argv); if (bFreshRun) InitNx(); else ReInitNx(); glutMainLoop(); ReleaseNx(); return 0; }
int main(int argc, char** argv) { #ifdef _DEBUG cout << "***DEBUG BUILD***" << endl; #endif ncc::whoami(); InitRun(argc,argv); InitGlut(argc,argv); InitHUD(); InitDevIL(); InitPhysX(); InitCUDA(); InitExperiment(); glutMainLoop(); // enter event processing return 0; // never actually reached. }
static void Draw(int argc, char *argv[]) { InitGlut(argc, argv, engine->width, engine->height); RunGlut(engine->width, engine->height); }
int main(int argc, char *argv[]) { /* Initialize Slideshow variables before the arguments are parsed..*/ InitSlideShow(); DisableScreenSaver(); strcpy((char * ) frame.album_directory,"album"); // album or test_album for debugging.. strcpy((char * ) frame.copy_directory,"Copied"); strcpy((char * ) frame.move_directory,"Moved"); strcpy((char * ) frame.resize_directory,"Resized"); strcpy((char * ) frame.link_directory,"Linked"); /* Parse Commandline arguments >>>>>>>>>>>>>>>>>> */ if (!parseArguments(argc,argv)) { fprintf(stderr,"Invalid arguments\n"); EnableScreenSaver(); return 1; } /* Turn on VSYNC to prevent tearing >>>>>>>>>>>>>>>>>> */ putenv( (char *) "__GL_SYNC_TO_VBLANK=1" ); //putenv( (char *) "__GL_SYNC_TO_VBLANK=1 __GL_YIELD=\"USLEEP\" " ); /* GLUT Initialization >>>>>>>>>>>>>>>>>> */ glutInit(&argc, argv); //Initializing Display Mode should be right after glutInit to ensure the window will get created using the correct flags..! ( double buffering etc ) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH ); // depth buffer and multisampling disabled for older systems..! |GLUT_MULTISAMPLE | GLUT_DEPTH glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE ,GLUT_ACTION_CONTINUE_EXECUTION); int width_x=glutGet(GLUT_SCREEN_WIDTH); int width_y=glutGet(GLUT_SCREEN_HEIGHT)-50; // 50 for the lxpanel bar :P fprintf(stderr,"System Resolution is %ux%u\n",width_x,width_y); if (width_x>1024) { width_x=1024; } if (width_y>600) { width_y=600; } char title[512]={0}; sprintf(title,"Flashy Slideshows v%s %s - build %u - %s/%s/%s ",AutoVersion::FULLVERSION_STRING,AutoVersion::STATUS,(unsigned int) AutoVersion::BUILDS_COUNT,AutoVersion::DATE,AutoVersion::MONTH,AutoVersion::YEAR); fprintf(stderr,"Window Resolution is %ux%u\n",width_x,width_y); glutInitWindowSize(width_x,width_y); glutInitWindowPosition(0,0); frame.windowX=0; frame.windowY=0; frame.windowWidth=width_x; frame.windowHeight=width_y; originalWindow = glutCreateWindow(title); if (frame.fullscreen) { frame.fullscreen=0; ToggleFullscreen(); } InitGlut(); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ /* OpenGL Initialization >>>>>>>>>>>>>>>>> */ glClearColor(0,0,0,0); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); //glEnable(GL_DEPTH_TEST); //glDepthFunc(GL_LESS); //glClearDepth(1.0); // Enables Clearing Of The Depth Buffer if (frame.try_for_best_render_quality) { glEnable(GL_NORMALIZE); glShadeModel(GL_SMOOTH); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); } else { glShadeModel(GL_FLAT); } /* LIGHTING , ENABLED ON GOOD RENDERING QUALITY ( TO ENABLE TRANSPARENCY ETC ) */ if (frame.try_for_best_render_quality) { frame.lighting_enabled=1; glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); //glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); //glLightfv(GL_LIGHT0, GL_POSITION, light_position); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); //glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); //glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); } else { frame.lighting_enabled=0; } /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ //Now that we have an OpenGL context we can query the maximum texture dimension.. QueryAndSaveGPUAndSystemCapabilities(); /* Initialize WxWidgets */ WxWidgetsContext wxlibstuff; wxlibstuff.OnInit(); fprintf(stderr,"Done with wxWidgets initialization\n"); LoadStockTexturesAndSounds(); InitEffects(); if (!LoadPicturesOfDirectory((char*)frame.album_directory,frame.sort_type,frame.sort_ascending,frame.sort_randomization,frame.recursive)) { EmmitDialogWarning( (char *) "Could not find any pictures in the directory of your selection"); return 0; } frame.total_images=GetTotalViewableFilesInDirectory(); if (!CreateSlideshowPictureStructure(GetTotalViewableFilesInDirectory())) { fprintf(stderr,"Unrecoverable error , could not allocate enough memory for %u Picture structure pointers..\nYou may try to re-run when more RAM will be availiable\n",GetTotalViewableFilesInDirectory()); return 1; } /*At this point we have initialized the picture structures and the slideshow structures so lets make sure that the camera is over an existing picture..! */ PutCameraOverExistingPictureIfItIsOff(); /* Initialize Joystick Thread (if a joystick is connected and detected )*/ StartJoystickControl(); /* Initialize Picture Loading Thread */ loadpicturesthread_id=0; pthread_create( &loadpicturesthread_id, NULL,ManageLoadingPicturesMemory_Thread,0); //This has to happen after LoadStockTexturesAndSounds in order for frame.app_clipart_dir to get populated if (frame.enable_web_interface) { if (!StartWebInterface((char*) "0.0.0.0", 8080 , (char*) frame.album_directory , ( char*) frame.app_clipart_dir)) { // EmmitDialogWarning( (char *) "Could not initialize web interface"); fprintf(stderr,"\n\nCould not initialize web interface\n\n"); } } gettimeofday(&last_frame,0x0); /* Start Rendering */ glutMainLoop(); fprintf(stderr,"Gracefully closing program\n"); if (frame.enable_web_interface) { StopWebInterface(); } EnableScreenSaver(); StopJoystickControl(); UnLoadStockTexturesAndSounds(); DestroySlideshowPictureStructure(); wxlibstuff.OnClose(); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { #if defined(__GNUC__) set_terminate(SLGTerminate); #endif try { cerr << "Usage: " << argv[0] << " [options] [configuration file]" << endl << " -o [configuration file]" << endl << " -f [scene file]" << endl << " -w [window width]" << endl << " -e [window height]" << endl << " -g <disable OpenCL GPU device>" << endl << " -p <enable OpenCL CPU device>" << endl << " -n [native thread count]" << endl << " -r [gpu thread count]" << endl << " -l [set high/low latency mode]" << endl << " -b <enable high latency mode>" << endl << " -s [GPU workgroup size]" << endl << " -t [halt time in secs]" << endl << " -T <enable the telnet server>" << endl << " -D [property name] [property value]" << endl << " -d [current directory path]" << endl << " -h <display this help and exit>" << endl; // Initialize FreeImage Library FreeImage_Initialise(TRUE); FreeImage_SetOutputMessage(FreeImageErrorHandler); bool batchMode = false; bool telnetServerEnabled = false; Properties cmdLineProp; for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { // I should check for out of range array index... if (argv[i][1] == 'h') exit(EXIT_SUCCESS); else if (argv[i][1] == 'o') { if (config) throw runtime_error("Used multiple configuration files"); config = new RenderingConfig(argv[++i]); } else if (argv[i][1] == 'e') cmdLineProp.SetString("image.height", argv[++i]); else if (argv[i][1] == 'w') cmdLineProp.SetString("image.width", argv[++i]); else if (argv[i][1] == 'f') cmdLineProp.SetString("scene.file", argv[++i]); else if (argv[i][1] == 'p') cmdLineProp.SetString("opencl.cpu.use", "1"); else if (argv[i][1] == 'g') cmdLineProp.SetString("opencl.gpu.use", "0"); else if (argv[i][1] == 'l') cmdLineProp.SetString("opencl.latency.mode", argv[++i]); else if (argv[i][1] == 'n') cmdLineProp.SetString("opencl.nativethread.count", argv[++i]); else if (argv[i][1] == 'r') cmdLineProp.SetString("opencl.renderthread.count", argv[++i]); else if (argv[i][1] == 's') cmdLineProp.SetString("opencl.gpu.workgroup.size", argv[++i]); else if (argv[i][1] == 't') cmdLineProp.SetString("batch.halttime", argv[++i]); else if (argv[i][1] == 'T') telnetServerEnabled = true; else if (argv[i][1] == 'D') { cmdLineProp.SetString(argv[i + 1], argv[i + 2]); i += 2; } else if (argv[i][1] == 'd') boost::filesystem::current_path(boost::filesystem::path(argv[++i])); else { cerr << "Invalid option: " << argv[i] << endl; exit(EXIT_FAILURE); } } else { string s = argv[i]; if ((s.length() >= 4) && (s.substr(s.length() - 4) == ".cfg")) { if (config) throw runtime_error("Used multiple configuration files"); config = new RenderingConfig(s); } else throw runtime_error("Unknow file extension: " + s); } } if (!config) config = new RenderingConfig("scenes/luxball/render-fast.cfg"); config->cfg.Load(cmdLineProp); const unsigned int halttime = config->cfg.GetInt("batch.halttime", 0); const unsigned int haltspp = config->cfg.GetInt("batch.haltspp", 0); if ((halttime > 0) || (haltspp > 0)) batchMode = true; else batchMode = false; if (batchMode) { config->Init(); return BatchMode(halttime, haltspp); } else { // It is important to initialize OpenGL before OpenCL unsigned int width = config->cfg.GetInt("image.width", 640); unsigned int height = config->cfg.GetInt("image.height", 480); InitGlut(argc, argv, width, height); config->Init(); if (telnetServerEnabled) { TelnetServer telnetServer(18081, config); RunGlut(); } else RunGlut(); } #if !defined(LUXRAYS_DISABLE_OPENCL) } catch (cl::Error err) { cerr << "OpenCL ERROR: " << err.what() << "(" << err.err() << ")" << endl; #endif } catch (runtime_error err) { cerr << "RUNTIME ERROR: " << err.what() << endl; } catch (exception err) { cerr << "ERROR: " << err.what() << endl; } return EXIT_SUCCESS; }
bool Kengine::Init(int argc, char** argv) { if (argc < 2) { return false; } kengine = this; InitGlut(argc, argv); glewInit(); // Initialize Shader shader = new Shader; if (!shader->Init("vert.glsl", "frag.glsl")) return false; shader->Enable(); // Set the Renderable class to use the shader Renderable::UseShader(shader); c[1] = new FreelookCamera; c[1]->Init(); c[0] = new ArcballCamera; c[0]->Init(); c[2] = new TopDown; c[2]->Init(); _projection = new Projection; _projection->Init(); _projection->fovy(45.f); _projection->znear(0.1f); _projection->zfar(10000.f); _projection->screenWidth(640); _projection->screenHeight(480); userInput = new UserInput; userInput->BindCamera(c[0]); _levelMgr = new LevelManager; _levelMgr->Initialize(); // can't fail yet if (_levelMgr->LoadLevels() != 0x1) { return false; } _levelMgr->_uin = userInput; _levelMgr->PlayLevel(0); userInput->SetLevelManager(_levelMgr); _menu = new GameMenu; _menu->Initialize(); _menu->SetLevelManager(_levelMgr); _menu->ActivateLevelManagerContext(); userInput->SetLevelMenuContext(_menu->LevelContext()); userInput->SetGameMenuContext(_menu->GameContext()); InitCallbacks(); return true; }
int main(int argc, char *argv[]) { #if defined(__GNUC__) && !defined(__CYGWIN__) set_terminate(SLGTerminate); #endif // This is required to run AMD GPU profiler //XInitThreads(); luxrays::sdl::LuxRaysSDLDebugHandler = SDLDebugHandler; try { // Initialize FreeImage Library FreeImage_Initialise(TRUE); FreeImage_SetOutputMessage(FreeImageErrorHandler); bool batchMode = false; bool telnetServerEnabled = false; Properties cmdLineProp; string configFileName; for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { // I should check for out of range array index... if (argv[i][1] == 'h') { SLG_LOG("Usage: " << argv[0] << " [options] [configuration file]" << endl << " -o [configuration file]" << endl << " -f [scene file]" << endl << " -w [window width]" << endl << " -e [window height]" << endl << " -t [halt time in secs]" << endl << " -T <enable the telnet server>" << endl << " -D [property name] [property value]" << endl << " -d [current directory path]" << endl << " -m Makes the mouse operations work in \"grab mode\"" << endl << " -h <display this help and exit>"); exit(EXIT_SUCCESS); } else if (argv[i][1] == 'o') { if (configFileName.compare("") != 0) throw runtime_error("Used multiple configuration files"); configFileName = string(argv[++i]); } else if (argv[i][1] == 'e') cmdLineProp.SetString("image.height", argv[++i]); else if (argv[i][1] == 'w') cmdLineProp.SetString("image.width", argv[++i]); else if (argv[i][1] == 'f') cmdLineProp.SetString("scene.file", argv[++i]); else if (argv[i][1] == 't') cmdLineProp.SetString("batch.halttime", argv[++i]); else if (argv[i][1] == 'T') telnetServerEnabled = true; else if (argv[i][1] == 'm') mouseGrabMode = true; else if (argv[i][1] == 'D') { cmdLineProp.SetString(argv[i + 1], argv[i + 2]); i += 2; } else if (argv[i][1] == 'd') boost::filesystem::current_path(boost::filesystem::path(argv[++i])); else { SLG_LOG("Invalid option: " << argv[i]); exit(EXIT_FAILURE); } } else { string s = argv[i]; if ((s.length() >= 4) && (s.substr(s.length() - 4) == ".cfg")) { if (configFileName.compare("") != 0) throw runtime_error("Used multiple configuration files"); configFileName = s; } else throw runtime_error("Unknown file extension: " + s); } } if (configFileName.compare("") == 0) configFileName = "scenes/luxball/luxball.cfg"; RenderConfig *config = new RenderConfig(&configFileName, &cmdLineProp); const unsigned int halttime = config->cfg.GetInt("batch.halttime", 0); const unsigned int haltspp = config->cfg.GetInt("batch.haltspp", 0); const float haltthreshold = config->cfg.GetFloat("batch.haltthreshold", -1.f); if ((halttime > 0) || (haltspp > 0) || (haltthreshold >= 0.f)) batchMode = true; else batchMode = false; if (batchMode) { session = new RenderSession(config); // Check if I have to do tile rendering if (config->cfg.IsDefined("batch.tile")) return BatchTileMode(haltspp, haltthreshold); else return BatchSimpleMode(halttime, haltspp, haltthreshold); } else { // It is important to initialize OpenGL before OpenCL // (for OpenGL/OpenCL inter-operability) u_int width, height; config->GetScreenSize(&width, &height); InitGlut(argc, argv, width, height); session = new RenderSession(config); // Start the rendering session->Start(); if (telnetServerEnabled) { TelnetServer telnetServer(18081, session); RunGlut(); } else RunGlut(); } #if !defined(LUXRAYS_DISABLE_OPENCL) } catch (cl::Error err) { SLG_LOG("OpenCL ERROR: " << err.what() << "(" << luxrays::utils::oclErrorString(err.err()) << ")"); return EXIT_FAILURE; #endif } catch (runtime_error err) { SLG_LOG("RUNTIME ERROR: " << err.what()); return EXIT_FAILURE; } catch (exception err) { SLG_LOG("ERROR: " << err.what()); return EXIT_FAILURE; } return EXIT_SUCCESS; }