Translating the GLX Library

OpenGL X Window System programs use the OpenGL Extension with the X Window System (GLX) library. The library is a set of functions and routines that initialize the pixel format, control rendering, and perform other OpenGL specific tasks. It connects the OpenGL library to the X Window System by managing window handles and rendering contexts. You must translate these functions to their equivalent Windows functions. The following table lists the X Window System GLX functions and their equivalent Windows functions.

GLX/Xlib functionWindows function
glXChooseVisual ChoosePixelFormat
glXCopyContextNot applicable.
glXCreateContext wglCreateContext
glXCreateGLXPixmap CreateDIBitmap CreateDIBSection
glXDestroyContext wglDeleteContext
glXDestroyGLXPixmap DeleteObject
glXGetConfig DescribePixelFormat
glXGetCurrentContext wglGetCurrentContext
glXGetCurrentDrawable wglGetCurrentDC
glXIsDirectNot applicable.
glXMakeCurrent wglMakeCurrent
glXQueryExtension GetVersion
glXQueryVersion GetVersion
glXSwapBuffers SwapBuffers
glXUseXFont wglUseFontBitmaps
XGetVisualInfo GetPixelFormat
XCreateWindow CreateWindow, CreateWindowEx, GetDC, BeginPaint
XSync GdiFlush
Not applicable. SetPixelFormat


Some GLX functions don't have an equivalent Windows function. To port these functions to Windows, rewrite your code to achieve the same functionality. For example, glXWaitGL has no equivalent Windows function but you can achieve the same result, executing any pending OpenGL commands, by calling glFinish.

The following topics describe how to port GLX functions that set the pixel format, and manage rendering contexts, pixmaps and bitmaps.