Ok... I hope no one has to ever go through what I did trying to figure this out, so here's the solution:
Although OpenTK will attempt to use wglChoosePixelFormatARB
, it fails on Mesa 3D and falls back to ChoosePixelFormat
. However, the function that OpenTK calls ChoosePixelFormat
actually DllImports
wglChoosePixelFormat
and NOT ChoosePixelFormat
.
Yes, there are two versions of ChoosePixelFormat
: one prefixed with wgl
and one not prefixed. From OpenGL.org documentation:
On the Win32 platform a number of platform specific function calls are duplicated in the OpenGL ICD mechanism and the GDI. This may cause confusion as they appear to be functionally identical, the only difference being whether wgl precedes the rest of the function name. To ensure correct operation of OpenGL use ChoosePixelformat, DescribePixelformat, GetPixelformat, SetPixelformat, and SwapBuffers, instead of the wgl equivalents, wglChoosePixelformat, wglDescribePixelformat, wglGetPixelformat, wglSetPixelformat, and wglSwapBuffers. In all other cases use the wgl function where available. Using the five wgl functions is only of interest to developers run-time linking to an OpenGL driver. Not using the functions as described may result in a black OpenGL window, or a correctly functioning application in Windows 9x that produces a black OpenGL window on Windows NT/2000.
As I'm attempting to to run-time link to an OpenGL driver (Mesa 3D), the five wgl
functions are of interest to me. Once I replaced my ChoosePixelFormat
, SetPixelformat
, and SwapBuffers
with wglChoosePixelFormat
, wglSetPixelformat
, and wglSwapBuffers
Mesa 3D worked excellently! Mystery solved.