Skip to content

Instantly share code, notes, and snippets.

@adventureloop
Created May 7, 2013 19:56
Show Gist options
  • Save adventureloop/5535611 to your computer and use it in GitHub Desktop.
Save adventureloop/5535611 to your computer and use it in GitHub Desktop.
#define GLFW_INCLUDE_GL3
#include <GL/glfw.h>
#include <SOIL/SOIL.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int
main(int argc,char **argv)
{
int running = GL_TRUE;
if(!glfwInit()) {
exit(EXIT_FAILURE);
}
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT,GL_TRUE);
glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE,GL_TRUE);
//Open an OpenGL window and create the context
if(!glfwOpenWindow(640,480,0,0,0,8,24,0,GLFW_WINDOW)) {
glfwTerminate();
exit(EXIT_FAILURE);
}
int major,minor,rev;
glfwGetVersion(&major,&minor,&rev);
cout << "GLFW Version: " << major << "." << minor << "." << rev << endl;
glfwGetGLVersion(&major,&minor,&rev);
cout << "OpenGL Version: " << major << "." << minor << "." << rev << endl;
int texture = SOIL_load_OGL_texture("test.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_INVERT_Y);
glfwTerminate();
exit(EXIT_SUCCESS);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment