These are notes about getting X11 applications with OpenGL support to work on Cygwin.

The Cygwin X User Guide is the canonical source for information on using X11 with Cygwin.


The Cygwin framework needs to be installed on your machine as a prerequisite to this tutorial.

From Cygwin setup, select these packages from the X11 group.


Under Graphics, select the opengl package, also.

If you are reconfiguring an existing installation, make sure to select keep from the options at the top of the setup box or all packages will be reinstalled.

After these packages are installed, reboot the machine.

Now, X11 with OpenGL support should be enabled on your machine.

Starting the X Server

In order to start the X11 server and create an xterm to work in, go to Start -> Run, type startxwin.bat and press Enter. You should now see an xterm.

Any session in which you want to use X11 needs to take place in an xterm, as the "plain" Cygwin shell does not support it.

The run script can also be invoked from the Cygwin Bash Shell. When launched this way, all the output from X11 will go to the screen, which can be useful for debugging.

Starting a Local Application

Start the xclock X11 application.

xclock &

You should see the famous xclock, now.

From the command-line, if the "&" is placed after the command (as above), the shell will not "hang" and you can continue to do work in it. Otherwise, you will have to wait for the application to finish. This can useful, because using the Ctrl-C escape sequence will kill the application, which can be useful if it hangs.

Other example X programs that come with XFree86.


Using X from Remote Clients with SSH

One of the primary benefits of X11 is that applications can be started remotely and all of their graphical output can be tunnelled to your local machine.

To connect with command line SSH, use the following command.

ssh -Y -l [username] [host]

The "-Y" option enables X11 tunneling and also eases some of the security restrictions and checks that can prevent certain extensions (such as OpenGL) from working correctly. The plain "-X" option keeps these in place, and so certain extensions may fail in this more strict mode.

From a remote terminal, you can launch applications in the same way as described for local ones.


If you see error messages about the "GLX" library not being enabled, this may mean that you did not install either OpenGL or all the X11 dependencies. Also, if the command-line SSH options are not correct, OpenGL may not work (see above). I had a problem with the "-X" option where OpenGL windows would not be created on my local machine.

On the remote side, all applications that use GL need to be compiled to support it (along with X11, obviously). For instance, Qt has OpenGL support enabled by default on Linux. I know wxWidgets does, too, and probably GTK. I have not tried Java 3D, yet.

  • No labels