Skip to content

Instantly share code, notes, and snippets.

@TheOpenDevProject
Created November 4, 2016 07:56
Show Gist options
  • Save TheOpenDevProject/fe927a4137ec08f7388cff852cf645c5 to your computer and use it in GitHub Desktop.
Save TheOpenDevProject/fe927a4137ec08f7388cff852cf645c5 to your computer and use it in GitHub Desktop.
#include <iostream>
#include "glad/glad.h"
#include <GLFW/glfw3.h>
using namespace std;
int main(int argc, char *argv[])
{
int width,height;
if(!glfwInit()){
std::cout << "Cant Init glfw";
return 1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); //Max OpenGL Version = 3
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); //Min Version = 2
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(640, 480, "Hello Triangle", NULL, NULL);
if(window == nullptr){
std::cout << "Unable to create GLFW Window, check to see if your OpenGL version is compatible. {2,3}";
}
glfwGetFramebufferSize(window,&width,&height);
glfwMakeContextCurrent(window);
const GLubyte* openGlVersion = glGetString(GL_VERSION);
printf("OpenGL version supported %s\n", openGlVersion);
while(1){
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment