View difference between Paste ID: c9kxNndt and V7WccHjx
SHOW: | | - or go back to the newest paste.
1
// Include standard headers
2
#include <stdio.h>
3
#include <stdlib.h>
4
// Include GLEW. Always include it before gl.h and glfw.h, since it's a bit magic.
5
#include <GL/glew.h>
6
// Include GLFW
7
#include <GL/glfw.h>
8
// Include GLM
9
#include <glm/glm.hpp>
10
using namespace glm;
11
int main() {
12
	// Initialise GLFW
13
if( !glfwInit() )
14
{
15
    fprintf( stderr, "Failed to initialize GLFW\n" );
16
    return -1;
17
}
18
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // 4x antialiasing
19
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // We want OpenGL 3.3
20
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
21
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL
22
 
23
// Open a window and create its OpenGL context
24
if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
25
{
26
    fprintf( stderr, "Failed to open GLFW window\n" );
27
    glfwTerminate();
28
    return -1;
29
}
30
 
31
// Initialize GLEW
32
glewExperimental=true; // Needed in core profile
33
if (glewInit() != GLEW_OK) {
34
    fprintf(stderr, "Failed to initialize GLEW\n");
35
    return -1;
36
}
37
 
38
glfwSetWindowTitle( "Tutorial 01" );
39
// Ensure we can capture the escape key being pressed below
40
glfwEnable( GLFW_STICKY_KEYS );
41
 
42
do{
43
    // Draw nothing, see you in tutorial 2 !
44
 
45
    // Swap buffers
46
    glfwSwapBuffers();
47
 
48
} // Check if the ESC key was pressed or the window was closed
49
while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS &&
50
glfwGetWindowParam( GLFW_OPENED ) );