Windows 8.1 - GLFW and GLEW Initialization Issue (GLFW-3.0.4 for 64 bit)

gav-kr wrote on Thursday, May 08, 2014:

Hello,

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.

Windows 8.1 64 bit

GLFW: glfw-3.0.4
GLEW: glew-1.0.9
GLM: 0.9.5.2

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
    if(!glfwInit())
        throw std::runtime_error("glfwInit failed");
    
    // open a window with GLFW
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_VERSION_MINOR, 2);
    //glfwWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
	window = glfwCreateWindow((int)SCREEN_SIZE.x, (int)SCREEN_SIZE.y, "GLEW and GLFW Test Run",NULL, NULL);
	if(!window)
	{
		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
    if(!GLEW_VERSION_3_2)
        throw std::runtime_error("OpenGL 3.2 API is not available.");

    // load vertex and fragment shaders into opengl
    LoadShaders();

    // create buffer and fill it with the points of the triangle
    LoadTriangle();

    // run while the window is open
	while(glfwGetWindowAttrib(window, GLFW_VISIBLE)){
        // draw one frame
        Render();
    }

    // clean up and exit
    glfwTerminate();

gav-kr wrote on Thursday, May 08, 2014:

LIBRARY ATTACHED INFO

glfw3.lib
glew32s.lib
opengl32.lib

INCLUDED FILES

#include "GL\glew.h"
#include "GL\glfw3.h"
#include <glm/glm.hpp>

dougbinks wrote on Thursday, May 08, 2014:

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.

elmindreda wrote on Thursday, May 08, 2014:

Set an error callback. This is what it’s for.

gav-kr wrote on Thursday, May 08, 2014:

Thanks,

Tried it!
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