Skip to content

Instantly share code, notes, and snippets.

@tai2
Created October 2, 2014 10:07
Show Gist options
  • Select an option

  • Save tai2/0cc3dda8fd4a35f13c00 to your computer and use it in GitHub Desktop.

Select an option

Save tai2/0cc3dda8fd4a35f13c00 to your computer and use it in GitHub Desktop.
// gcc -framework OpenGL -lglfw3 glfwtest.c -o glfwtest
#include <stdio.h>
#include <stdlib.h>
#include <GLFW/glfw3.h>
int main()
{
GLFWwindow* window;
if (!glfwInit()) {
fprintf(stderr, "glfwInit() failed\n");
abort();
}
window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
if (!window) {
fprintf(stderr, "glfwCreateWindow() failed\n");
abort();
}
printf("GLFW_CONTEXT major=%d minor=%d\n",
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR),
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment