Advertisement
Guest User

Untitled

a guest
Oct 5th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.00 KB | None | 0 0
  1. // Include standard headers
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. // Include GLEW
  6. #include <GL/glew.h>
  7.  
  8. // Include GLFW
  9. #include <GL/glfw.h>
  10.  
  11. // Include GLM
  12. #include <glm/glm.hpp>
  13. using namespace glm;
  14.  
  15. int main( void )
  16. {
  17.         GLFWwindow* window;
  18.  
  19.         // Initialise GLFW
  20.         if( !glfwInit() )
  21.         {
  22.                 fprintf( stderr, "Failed to initialize GLFW\n" );
  23.                 return -1;
  24.         }
  25.  
  26.         glfwWindowHint(GLFW_FSAA_SAMPLES, 4);
  27.         glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
  28.         glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
  29.         glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  30.  
  31.         // Create the window
  32.         window = glfwCreateWindow( 1024, 768, "Hello World", 0, 0);
  33.  
  34.         // Open a window and create its OpenGL context
  35.         if( !window )
  36.         {
  37.                 fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" );
  38.                 glfwTerminate();
  39.                 return -1;
  40.         }
  41.  
  42.         // Initialize GLEW
  43.         if (glewInit() != GLEW_OK) {
  44.                 fprintf(stderr, "Failed to initialize GLEW\n");
  45.                 return -1;
  46.         }
  47.  
  48.         // Set window as the one we currently use
  49.         glfwMakeContextCurrent(window);
  50.  
  51.         // Ensure we can capture the escape key being pressed below
  52.         glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
  53.  
  54.         // Dark blue background
  55.         glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
  56.  
  57.         do{
  58.                 // Draw nothing, see you in tutorial 2 !
  59.  
  60.                 // Swap buffers
  61.                 glfwSwapBuffers(window);
  62.  
  63.                 // Update events for the window
  64.                 glfwPollEvents()
  65.  
  66.         } // Check if the ESC key was pressed or the window was closed
  67.         while( !glfwWindowShouldClose(window) );
  68.  
  69.         // Close OpenGL window and terminate GLFW
  70.         glfwTerminate();
  71.  
  72.         return 0;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement