| 532 | } |
| 533 | |
| 534 | void initGL(int *argc, char **argv) |
| 535 | { |
| 536 | // First initialize OpenGL context, so we can properly set the GL for CUDA. |
| 537 | // This is necessary in order to achieve optimal performance with OpenGL/CUDA |
| 538 | // interop. |
| 539 | glutInit(argc, argv); |
| 540 | glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); |
| 541 | glutInitWindowSize(720, 480); |
| 542 | glutCreateWindow("CUDA n-body system"); |
| 543 | |
| 544 | if (bFullscreen) { |
| 545 | glutFullScreen(); |
| 546 | } |
| 547 | |
| 548 | else if (!isGLVersionSupported(2, 0) |
| 549 | || !areGLExtensionsSupported("GL_ARB_multitexture " |
| 550 | "GL_ARB_vertex_buffer_object")) { |
| 551 | fprintf(stderr, "Required OpenGL extensions missing."); |
| 552 | exit(EXIT_FAILURE); |
| 553 | } |
| 554 | else { |
| 555 | #if defined(WIN32) |
| 556 | wglSwapIntervalEXT(0); |
| 557 | #elif defined(LINUX) |
| 558 | glxSwapIntervalSGI(0); |
| 559 | #endif |
| 560 | } |
| 561 | |
| 562 | glEnable(GL_DEPTH_TEST); |
| 563 | glClearColor(0.0, 0.0, 0.0, 1.0); |
| 564 | |
| 565 | checkGLErrors("initGL"); |
| 566 | } |
| 567 | |
| 568 | void initParameters() |
| 569 | { |
no test coverage detected