/////////////////////////////////////////////////////////////////////////// Run standard demo loop with or without GL verification ///////////////////////////////////////////////////////////////////////////
| 946 | //! Run standard demo loop with or without GL verification |
| 947 | //////////////////////////////////////////////////////////////////////////////// |
| 948 | void runStdProgram(int argc, char **argv) |
| 949 | { |
| 950 | // First initialize OpenGL context, so we can properly set the GL for CUDA. |
| 951 | // This is necessary in order to achieve optimal performance with OpenGL/CUDA |
| 952 | // interop. |
| 953 | if (false == initGL(&argc, argv)) { |
| 954 | return; |
| 955 | } |
| 956 | |
| 957 | // Now initialize CUDA context |
| 958 | findCudaDevice(argc, (const char **)argv); |
| 959 | |
| 960 | sdkCreateTimer(&timer); |
| 961 | sdkResetTimer(&timer); |
| 962 | |
| 963 | // register callbacks |
| 964 | glutDisplayFunc(display); |
| 965 | glutKeyboardFunc(keyboard); |
| 966 | glutReshapeFunc(reshape); |
| 967 | glutTimerFunc(REFRESH_DELAY, timerEvent, 0); |
| 968 | |
| 969 | // create menu |
| 970 | glutCreateMenu(mainMenu); |
| 971 | glutAddMenuEntry("Toggle CUDA Post Processing (on/off) [ ]", ' '); |
| 972 | glutAddMenuEntry("Toggle Animation (on/off) [a]", 'a'); |
| 973 | glutAddMenuEntry("Increase Blur Radius [=]", '='); |
| 974 | glutAddMenuEntry("Decrease Blur Radius [-]", '-'); |
| 975 | glutAddMenuEntry("Quit (esc)", '\033'); |
| 976 | glutAttachMenu(GLUT_RIGHT_BUTTON); |
| 977 | |
| 978 | initGLBuffers(); |
| 979 | #ifndef USE_TEXSUBIMAGE2D |
| 980 | initCUDABuffers(); |
| 981 | #endif |
| 982 | |
| 983 | // Creating the Auto-Validation Code |
| 984 | if (ref_file) { |
| 985 | g_CheckRender = new CheckBackBuffer(window_width, window_height, 4); |
| 986 | g_CheckRender->setPixelFormat(GL_RGBA); |
| 987 | g_CheckRender->setExecPath(argv[0]); |
| 988 | g_CheckRender->EnableQAReadback(true); |
| 989 | } |
| 990 | |
| 991 | printf("\n" |
| 992 | "\tControls\n" |
| 993 | "\t(right click mouse button for Menu)\n" |
| 994 | "\t[ ] : Toggle CUDA Post Processing (on/off)\n" |
| 995 | "\t[a] : Toggle Animation (on/off)\n" |
| 996 | "\t[=] : Increase Blur Radius\n" |
| 997 | "\t[-] : Decrease Blur Radius\n" |
| 998 | "\t[esc] - Quit\n\n"); |
| 999 | |
| 1000 | // start rendering mainloop |
| 1001 | glutMainLoop(); |
| 1002 | |
| 1003 | // Normally unused return path |
| 1004 | Cleanup(EXIT_SUCCESS); |
| 1005 | } |
no test coverage detected