Cannot deploy GLFW 3.2

后端 未结 2 1898
我在风中等你
我在风中等你 2021-02-09 19:01

So this one is a doozie;
I\'ve got a pretty large OpenGL solution, written in version 3.2 core with GLSL 1.5 in Windows 7. I am using GLEW and GLM as helper libraries. When

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 19:50

    Try asking for a forward-compatible GLFW window:

    GLFW_OPENGL_FORWARD_COMPAT - Specify whether the OpenGL contextshould be forward-compatible (i.e. disallow legacy functionality). This should only beused when requesting OpenGL version 3.0 or above.

    And try not setting the profile hint and let the system choose:

    // Use OpenGL Core v3.2
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
    glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    

    Also, make sure that you actually get a version you want:

    int major, minor, rev;
    
    glfwGetGLVersion(&major, &minor, &rev);
    
    fprintf(stderr, "OpenGL version recieved: %d.%d.%d", major, minor, rev);
    

    Not sure whether you also run for Macs, but read this anyway:

    A.4 OpenGL 3.0+ on Mac OS X

    Support for OpenGL 3.0 and above was introduced with Mac OS X 10.7, and even then forward-compatible OpenGL 3.2 core profile contexts are supported and there is no mechanism for requesting debug contexts. Earlier versions of Mac OS X supports at most OpenGL version 2.1.

    Because of this, on Mac OS X 10.7, the GLFW_OPENGL_VERSION_MAJOR and GLFW_OPENGL_VERSION_MINOR hints will fail if given a version above 3.2, the GLFW_OPENGL_DEBUG_CONTEXT and GLFW_FORWARD_COMPAT hints are ignored, and setting the GLFW_OPENGL_PROFILE hint to anything except zero or GLFW_OPENGL_CORE_PROFILE will cause glfwOpenWindow to fail.

    Also, on Mac OS X 10.6 and below, the GLFW_OPENGL_VERSION_MAJOR and GLFW_OPENGL_VERSION_MINOR hints will fail if given a version above 2.1, the GLFW_OPENGL_DEBUG_CONTEXT hint will have no effect, and setting the GLFW_OPENGL_PROFILE or GLFW_FORWARD_COMPAT hints to a non-zero value will cause glfwOpenWindow to fail.

提交回复
热议问题