• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Contribution Guide
2
3## Contents
4
5- [Asking a question](#asking-a-question)
6- [Reporting a bug](#reporting-a-bug)
7    - [Reporting a compile or link bug](#reporting-a-compile-or-link-bug)
8    - [Reporting a segfault or other crash bug](#reporting-a-segfault-or-other-crash-bug)
9    - [Reporting a context creation bug](#reporting-a-context-creation-bug)
10    - [Reporting a monitor or video mode bug](#reporting-a-monitor-or-video-mode-bug)
11    - [Reporting a window, input or event bug](#reporting-a-window-input-or-event-bug)
12    - [Reporting some other library bug](#reporting-some-other-library-bug)
13    - [Reporting a documentation bug](#reporting-a-documentation-bug)
14    - [Reporting a website bug](#reporting-a-website-bug)
15- [Requesting a feature](#requesting-a-feature)
16- [Contributing a bug fix](#contributing-a-bug-fix)
17- [Contributing a feature](#contributing-a-feature)
18
19
20## Asking a question
21
22Questions about how to use GLFW should be asked either in the [support
23section](https://discourse.glfw.org/c/support) of the forum, under the [Stack
24Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
25Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
26Stack Exchange.
27
28Questions about the design or implementation of GLFW or about future plans
29should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
30forum.  Please don't open a GitHub issue to discuss design questions without
31first checking with a maintainer.
32
33
34## Reporting a bug
35
36If GLFW is behaving unexpectedly at run-time, start by setting an [error
37callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling).
38GLFW will often tell you the cause of an error via this callback.  If it
39doesn't, that might be a separate bug.
40
41If GLFW is crashing or triggering asserts, make sure that all your object
42handles and other pointers are valid.
43
44For bugs where it makes sense, a short, self contained example is absolutely
45invaluable.  Just put it inline in the body text.  Note that if the bug is
46reproducible with one of the test programs that come with GLFW, just mention
47that instead.
48
49__Don't worry about adding too much information__.  Unimportant information can
50be abbreviated or removed later, but missing information can stall bug fixing,
51especially when your schedule doesn't align with that of the maintainer.
52
53__Please provide text as text, not as images__.  This includes code, error
54messages and any other text.  Text in images cannot be found by other users
55searching for the same problem and may have to be re-typed by maintainers when
56debugging.
57
58You don't need to manually indent your code or other text to quote it with
59GitHub Markdown; just surround it with triple backticks:
60
61    ```
62    Some quoted text.
63    ```
64
65You can also add syntax highlighting by appending the common file extension:
66
67    ```c
68    int five(void)
69    {
70        return 5;
71    }
72    ```
73
74There are issue labels for both platforms and GPU manufacturers, so there is no
75need to mention these in the subject line.  If you do, it will be removed when
76the issue is labeled.
77
78If your bug is already reported, please add any new information you have, or if
79it already has everything, give it a :+1:.
80
81
82### Reporting a compile or link bug
83
84__Note:__ GLFW needs many system APIs to do its job, which on some platforms
85means linking to many system libraries.  If you are using GLFW as a static
86library, that means your application needs to link to these in addition to GLFW.
87
88__Note:__ Check the [Compiling
89GLFW](https://www.glfw.org/docs/latest/compile.html) guide and or [Building
90applications](https://www.glfw.org/docs/latest/build.html) guide for before
91opening an issue of this kind.  Most issues are caused by a missing package or
92linker flag.
93
94Always include the __operating system name and version__ (e.g. `Windows
957 64-bit` or `Ubuntu 15.10`) and the __compiler name and version__ (e.g. `Visual
96C++ 2015 Update 2`).  If you are using an official release of GLFW,
97include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the
98__GLFW commit ID__ (e.g.  `3795d78b14ef06008889cc422a1fb8d642597751`) from Git.
99
100Please also include the __complete build log__ from your compiler and linker,
101even if it's long.  It can always be shortened later, if necessary.
102
103
104#### Quick template
105
106```
107OS and version:
108Compiler version:
109Release or commit:
110Build log:
111```
112
113
114### Reporting a segfault or other crash bug
115
116Always include the __operating system name and version__ (e.g. `Windows
1177 64-bit` or `Ubuntu 15.10`).  If you are using an official release of GLFW,
118include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the
119__GLFW commit ID__ (e.g.  `3795d78b14ef06008889cc422a1fb8d642597751`) from Git.
120
121Please also include any __error messages__ provided to your application via the
122[error
123callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and
124the __full call stack__ of the crash, or if the crash does not occur in debug
125mode, mention that instead.
126
127
128#### Quick template
129
130```
131OS and version:
132Release or commit:
133Error messages:
134Call stack:
135```
136
137
138### Reporting a context creation bug
139
140__Note:__ Windows ships with graphics drivers that do not support OpenGL.  If
141GLFW says that your machine lacks support for OpenGL, it very likely does.
142Install drivers from the computer manufacturer or graphics card manufacturer
143([Nvidia](https://www.geforce.com/drivers),
144[AMD](https://www.amd.com/en/support),
145[Intel](https://www-ssl.intel.com/content/www/us/en/support/detect.html)) to
146fix this.
147
148__Note:__ AMD only supports OpenGL ES on Windows via EGL.  See the
149[GLFW\_CONTEXT\_CREATION\_API](https://www.glfw.org/docs/latest/window_guide.html#window_hints_ctx)
150hint for how to select EGL.
151
152Please verify that context creation also fails with the `glfwinfo` tool before
153reporting it as a bug.  This tool is included in the GLFW source tree as
154`tests/glfwinfo.c` and is built along with the library.  It has switches for all
155GLFW context and framebuffer hints.  Run `glfwinfo -h` for a complete list.
156
157Always include the __operating system name and version__ (e.g. `Windows
1587 64-bit` or `Ubuntu 15.10`).  If you are using an official release of GLFW,
159include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the
160__GLFW commit ID__ (e.g.  `3795d78b14ef06008889cc422a1fb8d642597751`) from Git.
161
162If you are running your program in a virtual machine, please mention this and
163include the __VM name and version__ (e.g. `VirtualBox 5.1`).
164
165Please also include the __GLFW version string__ (`3.2.0 X11 EGL clock_gettime
166/dev/js`), as described
167[here](https://www.glfw.org/docs/latest/intro.html#intro_version_string), the
168__GPU model and driver version__ (e.g. `GeForce GTX660 with 352.79`), and the
169__output of `glfwinfo`__ (with switches matching any hints you set in your
170code) when reporting this kind of bug.  If this tool doesn't run on the machine,
171mention that instead.
172
173
174#### Quick template
175
176```
177OS and version:
178GPU and driver:
179Release or commit:
180Version string:
181glfwinfo output:
182```
183
184
185### Reporting a monitor or video mode bug
186
187__Note:__ On headless systems on some platforms, no monitors are reported.  This
188causes glfwGetPrimaryMonitor to return `NULL`, which not all applications are
189prepared for.
190
191__Note:__ Some third-party tools report more video modes than are approved of
192by the OS.  For safety and compatibility, GLFW only reports video modes the OS
193wants programs to use.  This is not a bug.
194
195The `monitors` tool is included in the GLFW source tree as `tests/monitors.c`
196and is built along with the library.  It lists all information GLFW provides
197about monitors it detects.
198
199Always include the __operating system name and version__ (e.g. `Windows
2007 64-bit` or `Ubuntu 15.10`).  If you are using an official release of GLFW,
201include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the
202__GLFW commit ID__ (e.g.  `3795d78b14ef06008889cc422a1fb8d642597751`) from Git.
203
204If you are running your program in a virtual machine, please mention this and
205include the __VM name and version__ (e.g. `VirtualBox 5.1`).
206
207Please also include any __error messages__ provided to your application via the
208[error
209callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and
210the __output of `monitors`__ when reporting this kind of bug.  If this tool
211doesn't run on the machine, mention this instead.
212
213
214#### Quick template
215
216```
217OS and version:
218Release or commit:
219Error messages:
220monitors output:
221```
222
223
224### Reporting a window, input or event bug
225
226__Note:__ The exact ordering of related window events will sometimes differ.
227
228__Note:__ Window moving and resizing (by the user) will block the main thread on
229some platforms.  This is not a bug.  Set a [refresh
230callback](https://www.glfw.org/docs/latest/window.html#window_refresh) if you
231want to keep the window contents updated during a move or size operation.
232
233The `events` tool is included in the GLFW source tree as `tests/events.c` and is
234built along with the library.  It prints all information provided to every
235callback supported by GLFW as events occur.  Each event is listed with the time
236and a unique number to make discussions about event logs easier.  The tool has
237command-line options for creating multiple windows and full screen windows.
238
239Always include the __operating system name and version__ (e.g. `Windows
2407 64-bit` or `Ubuntu 15.10`).  If you are using an official release of GLFW,
241include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the
242__GLFW commit ID__ (e.g.  `3795d78b14ef06008889cc422a1fb8d642597751`) from Git.
243
244If you are running your program in a virtual machine, please mention this and
245include the __VM name and version__ (e.g. `VirtualBox 5.1`).
246
247Please also include any __error messages__ provided to your application via the
248[error
249callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and
250if relevant, the __output of `events`__ when reporting this kind of bug.  If
251this tool doesn't run on the machine, mention this instead.
252
253__X11:__ If possible, please include what desktop environment (e.g. GNOME,
254Unity, KDE) and/or window manager (e.g. Openbox, dwm, Window Maker) you are
255running.  If the bug is related to keyboard input, please include any input
256method (e.g. ibus, SCIM) you are using.
257
258
259#### Quick template
260
261```
262OS and version:
263Release or commit:
264Error messages:
265events output:
266```
267
268
269### Reporting some other library bug
270
271Always include the __operating system name and version__ (e.g. `Windows
2727 64-bit` or `Ubuntu 15.10`).  If you are using an official release of GLFW,
273include the __GLFW release version__ (e.g. `3.1.2`), otherwise include the
274__GLFW commit ID__ (e.g.  `3795d78b14ef06008889cc422a1fb8d642597751`) from Git.
275
276Please also include any __error messages__ provided to your application via the
277[error
278callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling), if
279relevant.
280
281
282#### Quick template
283
284```
285OS and version:
286Release or commit:
287Error messages:
288```
289
290
291### Reporting a documentation bug
292
293If you found a bug in the documentation, including this file, then it's fine to
294just link to that web page or mention that source file.  You don't need to match
295the source to the output or vice versa.
296
297
298### Reporting a website bug
299
300If the bug is in the documentation (anything under `/docs/`) then please see the
301section above.  Bugs in the rest of the site are reported to the [website
302source repository](https://github.com/glfw/website/issues).
303
304
305## Requesting a feature
306
307Please explain why you need the feature and how you intend to use it.  If you
308have a specific API design in mind, please add that as well.  If you have or are
309planning to write code for the feature, see the section below.
310
311If there already is a request for the feature you need, add your specific use
312case unless it is already mentioned.  If it is, give it a :+1:.
313
314
315## Contributing a bug fix
316
317__Note:__ You must have all necessary [intellectual
318property rights](https://en.wikipedia.org/wiki/Intellectual_property) to any
319code you contribute.  If you did not write the code yourself, you must explain
320where it came from and under what license you received it.  Even code using the
321same license as GLFW may not be copied without attribution.
322
323__There is no preferred patch size__.  A one character fix is just as welcome as
324a thousand line one, if that is the appropriate size for the fix.
325
326In addition to the code, a complete bug fix includes:
327
328- Change log entry in `README.md`, describing the incorrect behavior
329- Credits entries in `CONTRIBUTORS.md` for all authors of the bug fix
330
331Bug fixes will not be rejected because they don't include all the above parts,
332but please keep in mind that maintainer time is finite and that there are many
333other bugs and features to work on.
334
335If the patch fixes a bug introduced after the last release, it should not get
336a change log entry.
337
338If you haven't already, read the excellent article [How to Write a Git Commit
339Message](https://chris.beams.io/posts/git-commit/).
340
341
342## Contributing a feature
343
344__Note:__ You must have all necessary rights to any code you contribute.  If you
345did not write the code yourself, you must explain where it came from and under
346what license.  Even code using the same license as GLFW may not be copied
347without attribution.
348
349__Note:__ If you haven't already implemented the feature, check first if there
350already is an open issue for it and if it's already being developed in an
351[experimental branch](https://github.com/glfw/glfw/branches/all).
352
353__There is no preferred patch size__.  A one-character change is just as welcome
354as one adding a thousand lines, if that is the appropriate size for the
355feature.
356
357In addition to the code, a complete feature includes:
358
359- Change log entry in `README.md`, listing all new symbols
360- News page entry in `docs/news.md`, briefly describing the feature
361- Guide documentation, with minimal examples, in the relevant guide in the `docs` folder
362- Reference documentation, with all applicable tags
363- Cross-references and mentions in appropriate places
364- Credits entries in `CONTRIBUTORS.md` for all authors of the feature
365
366If the feature requires platform-specific code, at minimum stubs must be added
367for the new platform function to all supported and experimental platforms.
368
369If it adds a new callback, support for it must be added to `tests/event.c`.
370
371If it adds a new monitor property, support for it must be added to
372`tests/monitor.c`.
373
374If it adds a new OpenGL, OpenGL ES or Vulkan option or extension, support
375for it must be added to `tests/glfwinfo.c` and the behavior of the library when
376the extension is missing documented in `docs/compat.md`.
377
378If you haven't already, read the excellent article [How to Write a Git Commit
379Message](https://chris.beams.io/posts/git-commit/).
380
381Features will not be rejected because they don't include all the above parts,
382but please keep in mind that maintainer time is finite and that there are many
383other features and bugs to work on.
384
385Please also keep in mind that any part of the public API that has been included
386in a release cannot be changed until the next _major_ version.  Features can be
387added and existing parts can sometimes be overloaded (in the general sense of
388doing more things, not in the C++ sense), but code written to the API of one
389minor release should both compile and run on subsequent minor releases.
390
391