I have recently started working with OpenGL Shading Language but the most simple of the program is not running properly. I am working with the following versions of the extensions.
Below is the main function where the program is throwing a run-time exception after I create the GLFW window using glfwCreateWindow eventually saying "Cannot initialize window."
Can someone please identify the issue which is causing this.
// initialise GLFW
throw std::runtime_error("glfwInit failed");
// open a window with GLFW
window = glfwCreateWindow((int)SCREEN_SIZE.x, (int)SCREEN_SIZE.y, "GLEW and GLFW Test Run",NULL, NULL);
std::cout << "Cannot initialize window" << std::endl;
throw std::runtime_error("glfwOpenWindow failed. Can your hardware handle OpenGL 3.2?");
// initialise GLEW
glewExperimental = GL_TRUE; //stops glew crashing on OSX :-/
if(glewInit() != GLEW_OK)
throw std::runtime_error("glewInit failed");
// print out some info about the graphics drivers
std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;
std::cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
std::cout << "Vendor: " << glGetString(GL_VENDOR) << std::endl;
std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl;
// make sure OpenGL version 3.2 API is available
throw std::runtime_error("OpenGL 3.2 API is not available.");
// load vertex and fragment shaders into opengl
// create buffer and fill it with the points of the triangle
// run while the window is open
// draw one frame
// clean up and exit
LIBRARY ATTACHED INFO
I would recommend commenting out the glfwWindowHint function calls for now to see whether the problem is due to your hardware/driver not supporting OGL 3.2 core profile.
Still the same result. Program runs and immediately dies with run-time error.
I am doubtful that hardware is a issue, checkout the basic configuration below.
Intel Core i7 3630QM
12 GB RAM + 4 GB Nvidia Geforce GTX 680M DDR5
Set an error callback. This is what it's for.