/////////////////////////////////////////////////////////////////////////// Program main ///////////////////////////////////////////////////////////////////////////
| 348 | // Program main |
| 349 | //////////////////////////////////////////////////////////////////////////////// |
| 350 | int main(int argc, char **argv) |
| 351 | { |
| 352 | pArgc = &argc; |
| 353 | pArgv = argv; |
| 354 | |
| 355 | char *ref_file = NULL; |
| 356 | |
| 357 | #if defined(__linux__) |
| 358 | setenv("DISPLAY", ":0", 0); |
| 359 | #endif |
| 360 | |
| 361 | printf("%s Starting...\n\n", sSDKsample); |
| 362 | |
| 363 | if (checkCmdLineFlag(argc, (const char **)argv, "file")) { |
| 364 | fpsLimit = frameCheckNumber; |
| 365 | getCmdLineArgumentString(argc, (const char **)argv, "file", &ref_file); |
| 366 | } |
| 367 | |
| 368 | // use command-line specified CUDA device, otherwise use device with highest |
| 369 | // Gflops/s |
| 370 | findCudaDevice(argc, (const char **)argv); |
| 371 | |
| 372 | if (ref_file) { |
| 373 | loadVolumeData(argv[0]); |
| 374 | runAutoTest(ref_file, argv[0]); |
| 375 | } |
| 376 | else { |
| 377 | initGL(&argc, argv); |
| 378 | |
| 379 | // OpenGL buffers |
| 380 | initGLBuffers(); |
| 381 | |
| 382 | loadVolumeData(argv[0]); |
| 383 | } |
| 384 | |
| 385 | printf("Press space to toggle animation\n" |
| 386 | "Press '+' and '-' to change displayed slice\n"); |
| 387 | |
| 388 | #if defined(__APPLE__) || defined(MACOSX) |
| 389 | atexit(cleanup); |
| 390 | #else |
| 391 | glutCloseFunc(cleanup); |
| 392 | #endif |
| 393 | |
| 394 | glutMainLoop(); |
| 395 | |
| 396 | exit(EXIT_SUCCESS); |
| 397 | } |
nothing calls this directly
no test coverage detected