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 NT and Windows 95 functions. The following table lists the X Window System GLX functions and their equivalent Win32 functions.

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

Some GLX functions don't have an equivalent Win32 function. To port these functions to Win32, rewrite your code to achieve the same functionality. For example, glXWaitGL has no equivalent Win32 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.