Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Include standard headers
- #include <stdio.h>
- #include <stdlib.h>
- // Include GLEW. Always include it before gl.h and glfw.h, since it's a bit magic.
- #include <GL/glew.h>
- // Include GLFW
- #include <GL/glfw.h>
- // Include GLM
- #include <glm/glm.hpp>
- using namespace glm;
- int main() {
- // Initialise GLFW
- if( !glfwInit() )
- {
- fprintf( stderr, "Failed to initialize GLFW\n" );
- return -1;
- }
- glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // 4x antialiasing
- glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // We want OpenGL 3.3
- glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
- glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL
- // Open a window and create its OpenGL context
- if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
- {
- fprintf( stderr, "Failed to open GLFW window\n" );
- glfwTerminate();
- return -1;
- }
- // Initialize GLEW
- glewExperimental=true; // Needed in core profile
- if (glewInit() != GLEW_OK) {
- fprintf(stderr, "Failed to initialize GLEW\n");
- return -1;
- }
- glfwSetWindowTitle( "Tutorial 01" );
- // Ensure we can capture the escape key being pressed below
- glfwEnable( GLFW_STICKY_KEYS );
- do{
- // Draw nothing, see you in tutorial 2 !
- // Swap buffers
- glfwSwapBuffers();
- } // Check if the ESC key was pressed or the window was closed
- while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS &&
- glfwGetWindowParam( GLFW_OPENED ) );
Advertisement
Add Comment
Please, Sign In to add comment