WGL: Failed to find a suitable pixel format

yifli wrote on Tuesday, December 03, 2013:

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

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;

}

elmindreda wrote on Tuesday, December 03, 2013:

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

yifli wrote on Tuesday, December 03, 2013:

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

elmindreda wrote on Tuesday, December 03, 2013:

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

elmindreda wrote on Tuesday, December 03, 2013:

What does the glfwinfo test output?

yifli wrote on Tuesday, December 03, 2013:

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

yifli wrote on Tuesday, December 03, 2013:

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”

elmindreda wrote on Wednesday, December 04, 2013:

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

yifli wrote on Thursday, December 05, 2013:

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”

elmindreda wrote on Thursday, December 05, 2013:

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