Created
October 12, 2016 18:44
-
-
Save shkesar/f648308339854c96fb5769ea899eaa10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GLEW | |
#define GLEW_STATIC | |
#include <GL/glew.h> | |
// GLFW | |
#include <GLFW/glfw3.h> | |
#include <stdio.h> | |
int main() | |
{ | |
glfwInit(); | |
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); | |
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); | |
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); | |
// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | |
glfwWindowHint(GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_CORE_PROFILE); | |
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); | |
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL); | |
if (window == NULL) | |
{ | |
printf("Failed to create GLFW window\n"); | |
glfwTerminate(); | |
return -1; | |
} | |
glfwMakeContextCurrent(window); | |
glewExperimental = GL_TRUE; | |
if (glewInit() != GLEW_OK) | |
{ | |
printf("Failed to initialize GLEW\n"); | |
return -1; | |
} | |
int width, height; | |
glfwGetFramebufferSize(window, &width, &height); | |
glViewport(0, 0, width, height); | |
while(!glfwWindowShouldClose(window)) | |
{ | |
glfwPollEvents(); | |
glfwSwapBuffers(window); | |
} | |
glfwTerminate(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment