int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); glutInitWindowSize(800,600); glutCreateWindow("OpenGL SphereWorld Demo + Texture Maps"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); // Create the Menu glutCreateMenu(ProcessMenu); glutAddMenuEntry("Without Display Lists", 0); glutAddMenuEntry("With Display Lists",1); glutAttachMenu(GLUT_RIGHT_BUTTON); SetupRC(); glutTimerFunc(33, TimerFunction, 1); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { screenWidth = 800; screenHeight = 600; sampleCount = 0; useWeightedResolve = 1; gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(screenWidth,screenHeight); glutCreateWindow("HDR MSAA"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); glutKeyboardFunc(ProcessKeys); SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
/////////////////////////////////////////////////////////////////////////////// // Main entry point for GLUT based programs int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL); glutInitWindowSize(800, 600); glutCreateWindow("Pyramid"); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char * argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GL_DOUBLE | GL_DEPTH | GL_STENCIL); glutInitWindowSize(800, 600); glutCreateWindow("ToonShader Jingz"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); GLenum err = glewInit(); if (err != GLEW_OK) { fprintf(stderr, "GLEW ERROR:%s\n", glewGetErrorString(err)); return 1; } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { screenWidth = 800; screenHeight = 600; msFBO = 0; depthTextureName = 0; worldAngle = 0; mode = 1; blendMode = 1; gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(screenWidth,screenHeight); glutCreateWindow("HDR Imaging"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); glutKeyboardFunc(ProcessKeys); SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
/////////////////////////////////////////////////////////////////////////////// // Main entry point for GLUT based programs int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitContextVersion(3, 2); // glutInitContextProfile(GLUT_CORE_PROFILE); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL); glutInitWindowSize(800, 600); glutCreateWindow("Grass"); glutReshapeFunc(ChangeSize); glutKeyboardFunc(Keyboard); glutDisplayFunc(RenderScene); GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(800,600); glutCreateWindow("OpenGL MultiTexture"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char * argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GL_DEPTH | GL_DOUBLE | GLUT_RGB); glutInitWindowSize(1800,1600); glutCreateWindow("TextureRec Spheres @jingz"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); GLenum err = glewInit(); if (err != GLEW_OK) { fprintf(stderr, "GLEW ERROR:%s\n", glewGetErrorString(err)); return 1; } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
/////////////////////////////////////////////////////////////////////////////// // Main entry point for GLUT based programs int main(int argc, char* argv[]) { // set directory gltSetWorkingDirectory(argv[0]); // initialize GLUT glutInit(&argc, argv); // create graphics windows with defaults createGraphicsWindow(); // Set up the Render Context // Internal context (state) for the graphics chips SetupRC(); // Main Loop, stays running // Processes, messages, keystrokes until window is closed glutMainLoop(); // Closes the rendering context before quitting, removes textures ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { // Destroy the SDK manager and all the other objects it was handling. gltSetWorkingDirectory(argv[0]); glutInit(&argc,argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL); glutInitWindowSize(800,600); glutCreateWindow("test"); glutReshapeFunc(Reshape); glutDisplayFunc(Display); glutSpecialFunc(SpecialKeys); GLenum err= glewInit(); if(err != GLEW_OK) { fprintf(stderr,"glew error:%s\n",glewGetErrorString(err)); return 1; } Init(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { screenWidth = 614; screenHeight = 655; mapTexProg = 0; varExposureProg = 0; adaptiveProg = 0; curHDRTex = 0; fboName = 0; curProg = 0; exposure = 0.1f; gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(screenWidth,screenHeight); glutCreateWindow("HDR Imaging"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); glutKeyboardFunc(ProcessKeys); SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { screenWidth = 800; screenHeight = 600; bFullScreen = false; bAnimated = true; #ifndef OPENGL_ES bUseFBO = true; #else bUseFBO = false; #endif fboName = 0; depthBufferName = 0; gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(screenWidth,screenHeight); glutCreateWindow("FBO Drawbuffers"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { screenWidth = 800; screenHeight = 600; bFullScreen = false; bAnimated = true; bUsePBOPath = false; blurProg = 0; speedFactor = 1.0f; gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(screenWidth,screenHeight); glutCreateWindow("Pix Buffs"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutKeyboardFunc(ProccessKeys); SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
/////////////////////////////////////////////////////////////////////////////// // Main entry point for GLUT based programs int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); // We're using compatibility profile here because GLUT generates GL errors on // a core context. This application DOES NOT require a compatibility context. glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE); glutInitContextVersion(3, 3); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(800, 600); glutCreateWindow("Instancing"); glutReshapeFunc(ChangeSize); glutKeyboardFunc(Keyboard); glutDisplayFunc(RenderScene); GLenum err = glewInit(); if (GLEW_OK != err) { /* Problem: glewInit failed, something is seriously wrong. */ fprintf(stderr, "Error: %s\n", glewGetErrorString(err)); } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(800,600); glutCreateWindow("F-16 Thunderbird"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); SetupRC(); glutTimerFunc(5, TimerFunction, 1); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); glutInitWindowSize(800,600); glutCreateWindow("OpenGL SphereWorld Demo + Texture Maps"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); SetupRC(); glutTimerFunc(33, TimerFunction, 1); glutMainLoop(); ShutdownRC(); return 0; }
////////////////////////////////////////////////////// // Program entry point int main(int argc, char *argv[]) { gltSetWorkingDirectory(argv[0]); // Standard initialization stuff glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(800, 600); glutCreateWindow("Anisotropic Tunnel"); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); #ifdef ANGLE glutKeyboardFunc(KeyPressFunc); #else // Add menu entries to change filter glutCreateMenu(ProcessMenu); glutAddMenuEntry("GL_NEAREST",0); glutAddMenuEntry("GL_LINEAR",1); glutAddMenuEntry("GL_NEAREST_MIPMAP_NEAREST",2); glutAddMenuEntry("GL_NEAREST_MIPMAP_LINEAR", 3); glutAddMenuEntry("GL_LINEAR_MIPMAP_NEAREST", 4); glutAddMenuEntry("GL_LINEAR_MIPMAP_LINEAR", 5); glutAddMenuEntry("Anisotropic Filter", 6); glutAddMenuEntry("Anisotropic Off", 7); glutAttachMenu(GLUT_RIGHT_BUTTON); GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } #endif // Startup, loop, shutdown SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(800,600); glutCreateWindow("OpenGL SphereWorld with Texture Rectangle"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glfwInit(); glfwSetErrorCallback(OnError); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); GLFWwindow* window = glfwCreateWindow(800, 600, "Shaded Triangle", NULL, NULL); glfwSetFramebufferSizeCallback(window, ChangeSize); glfwMakeContextCurrent(window); glewExperimental = GL_TRUE; GLenum err = glewInit(); if (err != GLEW_OK) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } printf("GLSL Version: %s\nGL Renderer: %s\nGL Version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION), glGetString(GL_RENDERER), glGetString(GL_VERSION) ); SetupRC(); while(!glfwWindowShouldClose(window)) { glfwPollEvents(); RenderScene(window); } ShutdownRC(); return 0; }
int main(int argc, char * argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GL_DOUBLE | GL_DEPTH | GL_STENCIL); glutInitWindowSize(1440, 900); glutCreateWindow("Tunnel @Jingz"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glutSpecialFunc(SpecialKeys); glutCreateMenu(ProcessMenu); glutAddMenuEntry("GL_NEAREST", 0); glutAddMenuEntry("GL_LINEAR", 1); glutAddMenuEntry("GL_NEAREST_MIPMAP_NEAREST", 2); glutAddMenuEntry("GL_NEAREST_MIPMAP_LINEAR", 3); glutAddMenuEntry("GL_LINEAR_MIPMAP_NEAREST", 4); glutAddMenuEntry("GL_LINEAR_MIPMAP_LINEAR", 5); glutAddMenuEntry("Anisotropic Filter", 6); glutAddMenuEntry("Anisotropic Off", 7); glutAttachMenu(GLUT_RIGHT_BUTTON); GLenum err = glewInit(); if (err != GLEW_OK) { fprintf(stderr, "GLEW ERROR: %s\n", glewGetErrorString(err)); } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
///////////////////////////////////////////////////////////// // Main program entrypoint int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GL_DOUBLE); glutInitWindowSize(600 ,600); glutCreateWindow("OpenGL Imaging subset"); // Check for imaging subset, must be done after window // is create or there won't be an OpenGL context to query if(gltIsExtSupported("GL_ARB_imaging") == 0) { printf("Imaging subset not supported\r\n"); return 0; } glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); // Create the Menu and add choices glutCreateMenu(ProcessMenu); glutAddMenuEntry("Save Image",0); glutAddMenuEntry("Raw Stretched Image",1); glutAddMenuEntry("Increase Contrast",2); glutAddMenuEntry("Invert Color", 3); glutAddMenuEntry("Emboss Image", 4); glutAddMenuEntry("Sharpen Image", 5); glutAddMenuEntry("Histogram", 6); glutAttachMenu(GLUT_RIGHT_BUTTON); SetupRC(); // Do setup glutMainLoop(); // Main program loop ShutdownRC(); // Do shutdown return 0; }
int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL | GLUT_3_2_CORE_PROFILE); glutInitWindowSize(800, 600); glutCreateWindow("Textured Triangle"); glutReshapeFunc(ChangeSize); glutDisplayFunc(RenderScene); glewExperimental = GL_TRUE; GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); return 1; } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
///////////////////////////////////////////////////////////////// // Window procedure, handles all messages for this program LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HGLRC hRC; // Permenant Rendering context static HDC hDC; // Private GDI Device context switch (message) { // Window creation, setup for OpenGL case WM_CREATE: // Store the device context hDC = GetDC(hWnd); // The screen and desktop may have changed, so do this again FindBestPF(hDC, &startupOptions.nPixelFormat, &startupOptions.nPixelFormatMS); // Set pixelformat if(startupOptions.bFSAA == TRUE && (startupOptions.nPixelFormatMS != 0)) SetPixelFormat(hDC, startupOptions.nPixelFormatMS, NULL); else SetPixelFormat(hDC, startupOptions.nPixelFormat, NULL); // Create the rendering context and make it current hRC = wglCreateContext(hDC); wglMakeCurrent(hDC, hRC); SetupRC(hDC); break; // Check for ESC key case WM_CHAR: if(wParam == 27) DestroyWindow(hWnd); break; // Window is either full screen, or not visible case WM_ACTIVATE: { // Ignore this altogether unless we are in full screen mode if(startupOptions.bFullScreen == TRUE) { // Construct windowplacement structure WINDOWPLACEMENT wndPlacement; wndPlacement.length = sizeof(WINDOWPLACEMENT); wndPlacement.flags = WPF_RESTORETOMAXIMIZED; wndPlacement.ptMaxPosition.x = 0; wndPlacement.ptMaxPosition.y = 0; wndPlacement.ptMinPosition.x = 0; wndPlacement.ptMinPosition.y = 0; wndPlacement.rcNormalPosition.bottom = startupOptions.devMode.dmPelsHeight; wndPlacement.rcNormalPosition.left = 0; wndPlacement.rcNormalPosition.top = 0; wndPlacement.rcNormalPosition.right = startupOptions.devMode.dmPelsWidth; // Switching away from window if(LOWORD(wParam) == WA_INACTIVE) { wndPlacement.showCmd = SW_SHOWMINNOACTIVE; SetWindowPlacement(hWnd, &wndPlacement); ShowCursor(TRUE); } else // Switching back to window { wndPlacement.showCmd = SW_RESTORE; SetWindowPlacement(hWnd, &wndPlacement); ShowCursor(FALSE); } } } break; // Window is being destroyed, cleanup case WM_DESTROY: // Kill the timer that we created KillTimer(hWnd,101); ShutdownRC(); // Deselect the current rendering context and delete it wglMakeCurrent(hDC,NULL); wglDeleteContext(hRC); // Tell the application to terminate after the window // is gone. PostQuitMessage(0); break; // Window is resized. case WM_SIZE: // Call our function which modifies the clipping // volume and viewport ChangeSize(LOWORD(lParam), HIWORD(lParam)); break; // The painting function. This message sent by Windows // whenever the screen needs updating. case WM_PAINT: { // Only poll keyboard when this window has focus if(GetFocus() == hWnd) { float fTime; float fLinear, fAngular; // Get the time since the last time we rendered a frame LARGE_INTEGER lCurrent; QueryPerformanceCounter(&lCurrent); fTime = (float)(lCurrent.QuadPart - CameraTimer.QuadPart) / (float)CounterFrequency.QuadPart; CameraTimer = lCurrent; // Camera motion will be time based. This keeps the motion constant // regardless of frame rate. Higher frame rates produce smoother // animation and motion, they should not produce "faster" motion. fLinear = fTime * 1.0f; fAngular = (float)m3dDegToRad(60.0f * fTime); // Move the camera around, poll the keyboard if(GetAsyncKeyState(VK_UP)) frameCamera.MoveForward(fLinear); if(GetAsyncKeyState(VK_DOWN)) frameCamera.MoveForward(-fLinear); if(GetAsyncKeyState(VK_LEFT)) frameCamera.MoveForward(fAngular); if(GetAsyncKeyState(VK_RIGHT)) frameCamera.MoveForward(-fAngular); } // Call OpenGL drawing code RenderScene(); // Call function to swap the buffers SwapBuffers(hDC); // Not validated on purpose, gives and endless series // of paint messages... this is akin to having // a rendering loop //ValidateRect(hWnd,NULL); } break; default: // Passes it on if unproccessed return (DefWindowProc(hWnd, message, wParam, lParam)); } return (0L); }