Porting Rendering Contexts

The X Window System and Windows render through rendering contexts. Six GLX functions manage rendering contexts and five of them have an equivalent Windows function.

The following table lists the GLX rendering functions and their equivalent Windows functions.

GLX rendering context functionWindows rendering context function
glXCopyContext( Display *dpy,
GLXContext src,
GLXContext dst,
GLuint mask)
Not applicable.
glXCreateContext( Display *dpy,
XVisualInfo *vis,
GLXContext shareList,
Bool direct)
HGLRC wglCreateContext( HDC hdc)
void glXDeleteContext
( Display *dpy,
GLXContext ctx)
BOOL wglDeleteContext( HGLRC hglrc)
GLXContext glXGetCurrentContext
HGLRC wglGetCurrentContext(VOID)
GLXDrawable glXGetCurrentDrawable(void)HDC wglGetCurrentDC(VOID)
glXMakeCurrent( Display *dpy,
GLXDrawable draw,
GLXContext ctx)
BOOL wglMakeCurrent( HDC hdc,
HGLRC hglrc)


Return types and other types have different names in the X Window System than in Windows. You can search for occurrences of GLXContext to help find parts of your code that need to be ported.

The following sections compare rendering context code samples in an X Window System program and the same code after it has been ported to Windows.

For more information on rendering contexts, see Rendering Contexts.