void Init(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glewInit(); glutInitContextVersion (3, 2); #ifdef _DEBUG glutInitContextFlags (GLUT_DEBUG); #endif glutInitWindowSize (WindowWidth, WindowHeight); glutInitWindowPosition(50, 50); glutCreateWindow (argv[0]); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc (keyboard); glutIdleFunc(display); glewInit(); #ifdef _DEBUG SetupOpenGLDebugCallback(); #endif gDemo.Init(); }
extern "C" void WinMainCRTStartup() { //Sleep(15000); HDC hDC; HGLRC context; CreateGLWindow(&hDC, &context); Demo demo; demo.Init(); MusicInit(music); sndPlaySoundA((const char*)&music, SND_ASYNC|SND_MEMORY|SND_LOOP); do { demo.Step(); demo.RenderFrame(); SwapBuffers(hDC); AppProcessMessages(); } while(!GetAsyncKeyState(VK_ESCAPE)); ExitProcess(0); }
void Init(int argc, char** argv) { Options options; printf("arguments: -vertex=Path -fragment=Path [-postposcess=Path -compute=Path]\n"); printf("compute modifies texture used by fragment shader\n"); GetOptions(argc, argv, &options); if(options.vertexFile == 0 || options.fragmentFile == 0) { printf("Missing vertex and/or fragment shader\n"); exit(0); } glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glewInit(); glutInitContextVersion (3, 2); #ifdef _DEBUG glutInitContextFlags (GLUT_DEBUG); #endif glutInitWindowSize (WindowWidth, WindowHeight); glutInitWindowPosition(50, 50); glutCreateWindow (argv[0]); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc (keyboard); glutIdleFunc(display); glewInit(); #ifdef _DEBUG SetupOpenGLDebugCallback(); #endif gDemo.Init(&options); }