Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Original code by opengl-tutorials.org
- // Include standard headers
- #include <stdio.h>
- #include <stdlib.h>
- // Include GLEW
- #include <GL/glew.h>
- // Include GLFW
- #include <GL/glfw.h>
- // Include GLM
- #include <glm/glm.hpp>
- using namespace glm;
- int main( void )
- {
- GLFWwindow* window;
- // Initialise GLFW
- if( !glfwInit() )
- {
- fprintf( stderr, "Failed to initialize GLFW\n" );
- return -1;
- }
- glfwWindowHint(GLFW_FSAA_SAMPLES, 4);
- glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- // Create the window
- window = glfwCreateWindow( 1024, 768, "Hello World", 0, 0);
- // Open a window and create its OpenGL context
- if( !window )
- {
- 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" );
- glfwTerminate();
- return -1;
- }
- // Initialize GLEW
- if (glewInit() != GLEW_OK) {
- fprintf(stderr, "Failed to initialize GLEW\n");
- return -1;
- }
- // Set window as the one we currently use
- glfwMakeContextCurrent(window);
- // Ensure we can capture the escape key being pressed below
- glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
- // Dark blue background
- glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
- do{
- // Draw nothing, see you in tutorial 2 !
- // Swap buffers
- glfwSwapBuffers(window);
- // Update events for the window
- glfwPollEvents()
- } // Check if the ESC key was pressed or the window was closed
- while( !glfwWindowShouldClose(window) );
- // Close OpenGL window and terminate GLFW
- glfwTerminate();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement