WGL: Failed to find a suitable pixel format

Using GLFW
Yifei
2013-12-03
2013-12-05
  • Yifei

    Yifei - 2013-12-03

    I got the above error when trying create a debug context. My machine is running windows 7, and I downloaded the latest glfw source code and installed the latest driver for my AMD Firepro M2000.

    In the choosePixelFormat function (in wgl_context.c), nativeCount is 36, however, usableCount equals 0.

    Here is my code:

    include <GL Regal.h="">

    include <GLFW glfw3.h="">

    include <iostream>

    static void error_callback(int error, const char* description) {
    std::cerr << description << std::endl;
    }

    int main(int argc, char *argv) {
    GLFWwindow
    window;
    glfwSetErrorCallback(error_callback);

    if( !glfwInit() )
        return 1;
    
    glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
    window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
    if( !window ) {
        glfwTerminate();
        return 1;
    }
    
    glfwDestroyWindow(window);
    glfwTerminate();
    return 0;
    

    }

     
  • Camilla Löwy

    Camilla Löwy - 2013-12-03

    Your graphics driver most likely doesn't support OpenGL. Many drivers shipping with Windows doesn't come with OpenGL support.

     
  • Yifei

    Yifei - 2013-12-03

    If I remove glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE), it works fine.

     
  • Camilla Löwy

    Camilla Löwy - 2013-12-03

    The debug context hint isn't used in choosePixelFormat and so cannot affect what is rejected by it.

     
  • Camilla Löwy

    Camilla Löwy - 2013-12-03

    What does the glfwinfo test output?

     
    • Yifei

      Yifei - 2013-12-03

      GLFW header version: 3.0.3
      GLFW library version: 3.0.3
      GLFW library version string: "3.0.3 Win32 WGL VisualC LoadLibrary(winmm)"
      Error: WGL: Failed to find a suitable pixel format

       
  • Yifei

    Yifei - 2013-12-03

    sorry. the above output is from a different machine. Here's the correct one:

    C:\Users\lyifei\Documents\Visual Studio 2012\Projects\OpenGLTest>glfwinfo.exe
    GLFW header version: 3.0.3
    GLFW library version: 3.0.3
    GLFW library version string: "3.0.3 Win32 WGL VisualC LoadLibrary(winmm)"
    OpenGL context version string: "4.2.11577 Compatibility Profile Context FireGL"
    OpenGL context version parsed by GLFW: 4.2.11577
    OpenGL context flags (0x00000000):
    OpenGL context flags parsed by GLFW:
    OpenGL profile mask (0x00000002): compat
    OpenGL profile mask parsed by GLFW: compat
    OpenGL context renderer string: "AMD FirePro M2000"
    OpenGL context vendor string: "ATI Technologies Inc."
    OpenGL context shading language version: "4.20"

     
  • Camilla Löwy

    Camilla Löwy - 2013-12-04

    What is the output of glfwinfo -d on that machine?

     
  • Yifei

    Yifei - 2013-12-05

    GLFW header version: 3.0.3
    GLFW library version: 3.0.3
    GLFW library version string: "3.0.3 Win32 WGL VisualC LoadLibrary(winmm)"
    OpenGL context version string: "4.2.11577 Compatibility Profile/Debug Context FireGL"
    OpenGL context version parsed by GLFW: 4.2.11577
    OpenGL context flags (0x00000002): debug
    OpenGL context flags parsed by GLFW: debug
    OpenGL profile mask (0x00000002): compat
    OpenGL profile mask parsed by GLFW: compat
    OpenGL context renderer string: "AMD FirePro M2000"
    OpenGL context vendor string: "ATI Technologies Inc."
    OpenGL context shading language version: "4.20"

     
  • Camilla Löwy

    Camilla Löwy - 2013-12-05

    Seems that context creation is working fine, with or without the debug context hint.