# GLFW 2.7.9 Win32 binary distribution

1. Introduction
2. Using GLFW
3. Version history
4. Directory structure of the GLFW distribution
5. Contacting the project
6. Acknowledgements

## 1. Introduction

Welcome to version 2.7.9 of the GLFW library. GLFW is a free, Open Source, multi-platform library for OpenGL application development that provides a powerful API for handling operating system specific tasks such as opening an OpenGL window, reading keyboard, mouse, joystick and time input, creating threads, and more.

GLFW 2.7 is expected to be the last major release of the 2.x series, with most development now being done on what will become version 3.0.

This release adds fixes for multiple cursor motion bugs on Windows and fixes support for the `LFLAGS` environment variable on OS X.

For a full list of changes, see the version history.

Please note that this is the Windows 32-bit binary only distribution of GLFW. It contains static, dynamic and link libraries built with and using the runtimes of a number of common Windows compilers. More specifically, it contains files for the following compilers:

- MinGW
- Visual C++ 2008 (release runtime)
- Visual C++ 2010 (release runtime)
- Visual C++ 2012 (release runtime)

For the full source distribition, go to the GLFW website or to the project page on SF.net.

## 2. Using GLFW

There are two aspects to using GLFW:

1. How does the GLFW API work
2. How to compile programs that use GLFW

The first point is covered in the GLFW Users Guide and the GLFW Reference Manual, and we suggest that you read at least the Users Guide, since it's a good introduction to the GLFW API.

Designing and compiling programs that use GLFW is not very difficult. A few rules for successfully designing GLFW-based programs are presented in the following sections.

### 2.1 Include the GLFW header file

In the files of your program where you use OpenGL or GLFW, you should include the `GL/glfw.h` header file, i.e.:

> `#include <GL/glfw.h>`

This defines all the constants, types and function prototypes of the GLFW API. It also includes the OpenGL and GLU header files, and defines all the necessary constants and types that are necessary for these headers to work on that particular platform.

For example, under Microsoft Windows you are normally required to include `windows.h` before you include `GL/gl.h`. This would however make your code dependent on the Windows platform, or at least require your program to check which platform it is being compiled on.

The GLFW header file takes care of this for you, not by including `windows.h`, but rather by itself duplicating the necessary parts of it. This way, the namespace won't be cluttered by the entire Windows API.

By default, the regular `gl.h` OpenGL header is included. If you wish to include the draft `gl3.h` header instead, define `GLFW_INCLUDE_GL3` before the inclusion of the GLFW header.

By default, the `glu.h` GLU header is included. If you wish to avoid this, define `GLFW_NO_GLU` before the inclusion of the GLFW header.

In other words:

- Do not include `gl.h` or `glu.h` yourself, as GLFW does this for you
- Do not include `windows.h` unless you need direct access to the Windows API
- If you do include `windows.h`, do it before including `GL/glfw.h`. The GLFW header will detect this and act appropriately.

Also note that if you are using an OpenGL extension loading library such as GLEW, you should include the GLEW header before the GLFW one. The GLEW header defines macros that disable any `gl.h` that the GLFW header includes and GLEW will work as expected.

### 2.2 Link with the right libraries

#### 2.2.1 Windows static library

If you link with the static version of GLFW, it is also necessary to link with some system libraries that GLFW uses.

When linking a program under Windows that uses the static version of GLFW, you must also link with the following libraries: `opengl32`, `user32` and `kernel32`. Some of these libraries may be linked with by default by your compiler. In the table below you can see the minimum required link options for each supported Windows compiler (you may want to add other libraries as well, such as `glu32`):

Compiler | Link options
Borland C++ Builder | `glfw.lib opengl32.lib`
Cygwin | See Unix static library below
LCC-Win32 | `glfw.lib opengl32.lib`
Microsoft Visual C++ | `glfw.lib opengl32.lib`
MinGW and MinGW-w64 | `-lglfw -lopengl32`
OpenWatcom | `glfw.lib opengl32.lib user32.lib`

#### 2.2.2 Windows DLL

To compile a program that uses the DLL version of GLFW, you need to define the `GLFW_DLL` constant. This can either be done with a compiler switch, typically by adding `-DGLFW_DLL` to the list of compiler options. You can also do it by adding the following line to all your source files before including the GLFW header file:

> `#define GLFW_DLL`

When linking a program under Windows that uses the DLL version of GLFW, the only library you need to link with for GLFW to work is `glfwdll`. In the table below you can see the minimum required link options for each supported Windows compiler (you may want to add other libraries as well, such as `opengl32` and `glu32`):

Compiler | Link options
Borland C++ Builder | `glfwdll.lib`
Cygwin | `-lglfwdll`
LCC-Win32 | `glfwdll.lib`
Microsoft Visual C++ | `glfwdll.lib`
MinGW and MinGW-w64 | `-lglfwdll`
OpenWatcom | `glfwdll.lib`

#### 2.2.3 Unix static library

GLFW supports pkg-config, and a `libglfw.pc` file is generated and installed when you install the library. For systems that do not provide pkg-config, you should look in this file for the proper compile and link flags for your system, as determined by compile.sh at compile time.

A typical compile and link command-line when using the GLFW static library may look like this:

> `cc `pkg-config --cflags libglfw` -o myprog myprog.c `pkg-config --static --libs libglfw``

When using the GLFW sharedd library it may look like this:

> `cc `pkg-config --cflags libglfw` -o myprog myprog.c `pkg-config --libs libglfw``

If you use GLU functions in your program you should also add `-lGLU` to your link flags.

#### 2.2.5 Mac OS X static library

When compiling and linking a program under Mac OS X that uses GLFW, you must also link with Cocoa and OpenGL frameworks.

If you are using Xcode, you simply add the GLFW library `libglfw.a` and these frameworks to your project. If, however, you are building your program from the command-line, there are two methods for correctly linking your GLFW program.

GLFW supports pkg-config, and a libglfw.pc file is generated and installed when you install the library. You can find pkg-config in most packaging systems, such as Fink and MacPorts, so if you have one of them installed, simply install pkg-config. Once you have pkg-config available, the command-line for compiling and linking your program is:

> `cc `pkg-config --cflags libglfw` -o myprog myprog.c `pkg-config --libs libglfw``

If you do not wish to use pkg-config, you will need to add the required frameworks and libraries to your command-line using the `-l` and `-framework` switches, i.e.:

> `cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit`

Note that you do not add the .framework extension to a framework when adding it from the command-line.

These frameworks contain all OpenGL and GLU functions, so there is no need to add additional libraries or frameworks when using GLU functionality. Also note that even though your machine may have Unix-style OpenGL libraries, they are for use with the X Window System, and will not work with the Mac OS X native version of GLFW.

## 3. Version history

### v2.7.9

- [Cocoa] Bugfix: The dynamic library makefile rule did not use `LFLAGS`
- [Win32] Bugfix: Enabling or disabling the cursor for an inactive window did nothing (backported from 3.0)
- [Win32] Bugfix: The locked cursor was re-centered when the window was inactive (backported from 3.0)
- [Win32] Bugfix: The cursor clip rectangle included the title bar (backported from 3.0)

## 4. Directory structure of the GLFW distribution

Here is an overview of the directory structure of the GLFW distribution:

`docs` | GLFW manuals in PDF format
`include` |
`GL` | The GLFW C/C++ include file
`lib-mingw` | Binaries for MinGW
`lib-msvc90` | Binaries for Visual C++ 2008 release configuration
`lib-msvc100` | Binaries for Visual C++ 2010 release configuration
`lib-msvc110` | Binaries for Visual C++ 2012 release configuration

## 5. Contacting the project

The official website for GLFW is glfw.org. It contains the latest version of GLFW, news and other information that is useful for OpenGL development.

If you have questions related to the use of GLFW, we have a user's web forum, and the registered IRC channel `#glfw` on Freenode.

If you have a bug to report, a patch to submit or a feature you'd like to request, please file an issue in the issue trackers.

Finally, if you're interested in helping out with the development of GLFW or porting it to your favorite platform, we have a developer's mailing list, or you could join us on `#glfw`.

## 6. Acknowledgements

GLFW exists because people around the world donated their time and lent their skills. Special thanks go out to:

- artblanc, for a patch replacing a deprecated Core Graphics call
- Bobyshev Alexander and Martins Mozeiko, for the original proposal of an FSAA hint and their work on the Win32 implementation of FSAA
- Keith Bauer, for his invaluable help with porting and maintaining GLFW on Mac OS X, and for his many ideas
- Jarrod Davis, for the Delphi port of GLFW
- Olivier Delannoy, for the initial implementation of FSAA support on X11, cross-compiling support for MinGW and general extreme usefulness
- Paul R. Deppe, who helped with Cygwin support, and made an adaption of PLIB so that it can use GLFW (instead of GLUT)
- Jonathan Dummer, for submitting a patch fixing an input bug on Win32 and adding logic for the GLFW_ICON resource
- Gerald Franz, who made GLFW compile under IRIX, and supplied patches for the X11 keyboard translation routine
- Marcus Geelnard, the original author and long-time maintainer of GLFW, without whose brilliant work none of this would have happened
- Stefan Gustavson, for quick and thorough testing of GLFW on many and varied operating systems and hardware configurations
- Sylvain Hellegouarch, for support, bug reports and testing
- Alex Holkner, for writing the code from which the Compiz/Intel fix was stolen
- Toni Jovanoski, for helping with the MASM32 port of GLFW, and supplying the example program and fixed OpenGL and GLU bindings for MASM32
- Cameron King, for reporting a hidden cursor mouse bug on X11
- Peter Knut, for his many and detailed reports of difficult to find input bugs
- Robin Leffmann, for his work on Mac OS X and other platforms, and his invaluable support
- Glenn Lewis, for helping out with support for the D programming language
- Shane Liesegang, for providing a bug fix relating to Cocoa window restoration and reporting several Cocoa bugs
- Tristam MacDonald, for his bug reports and feedback on the Cocoa port
- David Medlock, for doing the initial Lua port
- Kenneth Miller, for his many and detailed bug reports on Win32
- Jeff Molofee, the author of the excellent OpenGL tutorials at NeHe Productions. Much of the Windows code of GLFW was originally based on Jeff's code
- Douglas C. Schmidt and Irfan Pyarali, for their excellent article Strategies for Implementing POSIX Condition Variables on Win32
- Sebastian Schuberth, for the OpenWatcom makefiles
- Matt Sealey, for helping with the MorphOS port
- Steve Sexton, for reporting an input bug in the Carbon port
- Dmitri Shuralyov, for support, bug reports, bug fixes and testing
- Daniel Skorupski, for reporting a bug in the Win32 DEF file
- Bradley Smith, for his updates of the D support and his ports of the remaining examples to the D language
- Julian Squires, for submitting a patch for a bug in the key repeat logic on X11
- Liam Staskawicz, for finding a bug in the termination logic of the OS X port
- Johannes Stein, for maintaining the Pascal bindings
- Cort Stratton, for reporting two bugs related to the creation of debug contexts
- Sergey Tikhomirov, for the initial implementation of joystick support on Mac OS X
- Samuli Tuomola, for support, bug reports and testing
- Frank Wille, for helping with the AmigaOS port and making GLFW compile under IRIX 5.3
- Yaniel, for fixing a bug with fullscreen windows using OpenGL 3.0 contexts on Cocoa
- Santi Zupancic, for support, bug reports and testing
- Lasse Öörni, for submitting patches for the input code of the Win32 and X11 ports
- Дмитри Малышев, for the idea of a GLFW_NO_GLU macro
- blanco, for submitting a patch for a deprecation bug in the Cocoa port
- heromyth, for reporting a bug in the D bindings
- Ozzy @ Orkysquad, for his dedication to GLFW, for debugging my source, and for his valuable experience with game development
- Peoro, for reporting a bug in the `_NET_WM_PING` response
- TTK-Bandit, for submitting a number of input patches adding many missing keys to the Win32 and X11 ports
- yuriks, for reporting a bug in Win32 context creation
- All the unmentioned and anonymous contributors in the GLFW community, for bug reports, patches, feedback and encouragement
- OpenGL.org, and all the people on the discussion forums there that have provided help during the development of GLFW