MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / initGL

Function initGL

cpp/5_Domain_Specific/nbody/nbody.cpp:534–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534void 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
568void initParameters()
569{

Callers 2

mainFunction · 0.70
keyboardFuncFunction · 0.50

Calls 3

isGLVersionSupportedFunction · 0.85
areGLExtensionsSupportedFunction · 0.85
checkGLErrorsFunction · 0.70

Tested by

no test coverage detected