made the header compatible with C++
[miniglut] / README.md
1 MiniGLUT
2 ========
3 MiniGLUT is a subset of GLUT (or more precisely a subset of FreeGLUT)
4 implemented in a single C source file, without any non-essential dependencies,
5 not even the C library.
6
7 You can use MiniGLUT by simply dropping two files: `miniglut.h` and `miniglut.c`
8 into your project source tree, or by building MiniGLUT as a static library and
9 linking with it.
10
11 MiniGLUT does not intend to replace a full GLUT library, like FreeGLUT, for
12 hacking small to medium OpenGL programs. The purpose of MiniGLUT is to
13 potentially replace a full GLUT library when it's time for release, in order to
14 minimize runtime dependencies of the resulting binary.
15
16 A second reason to use MiniGLUT is to ease porting of UNIX OpenGL programs to
17 Windows, especially when using the microsoft compiler, where setting up and
18 linking with a proper 3rd-party library is an ordeal in itself.  Even more so if
19 you decide to statically link, at which point you need to deal with the whole
20 "MSVC runtime" chaos. Even if you decide to link MiniGLUT as a static library,
21 instead of dropping it in your code, it still won't present any MSVC runtime
22 compatibility issues, since it doesn't call any C library functions whatsoever.
23
24 Build
25 -----
26 Under X11 MiniGLUT depends only on Xlib and OpenGL. Therefore to build a program
27 using MiniGLUT you'll need to link with `-lX11 -lGL`.
28
29 Under Windows MiniGLUT depends only on OpenGL, GDI and winmm. Therefore to build
30 a program using MiniGLUT you'll need to link with `-lopengl32 -lgdi32 -lwinmm`.
31 When building with MSVC, linking with the correct libraries is taken care by
32 pragmas in the header file. If you wish to avoid the winmm dependency, define
33 `MINIGLUT_NO_WINMM`.
34
35 To avoid calling C library functions, MiniGLUT uses inline assembly code for
36 system calls and trigonometric operations. This makes the default build
37 incompatible with non-x86 systems, and with MSVC x64 builds. If you don't mind
38 linking with the C library, you can define `MINIGLUT_USE_LIBC` to lift these
39 limitations.
40
41 License
42 -------
43 Copyright (C) 2020 John Tsiombikas <nuclear@member.fsf.org>
44
45 MiniGLUT is free software. Feel free to use, modify and/or redistribute it,
46 under the terms of the GNU General Public License v3, or at your option any
47 newer version published by the Free Software Foundation. See COPYING for
48 details.
49
50 The intention is not to dictate a specific free software license (GPL) but to
51 shut the door to proprietary programs. If you want to use MiniGLUT in a free
52 software project with an incompatible license, contact me and we will figure out
53 a way to enable that.
54
55 To learn more about GPL-incompatible free software licenses where this might
56 be an issue, see:
57 https://www.gnu.org/licenses/license-list.en.html#GPLIncompatibleLicenses
58
59 Known Issues
60 ------------
61 MiniGLUT being a subset of GLUT, is missing a number of features. Some of them
62 on purpose to keep it minimal, and some of them because I didn't happen to use
63 them in a program I wanted to link with MiniGLUT yet.
64
65 Missing GLUT features:
66  - The only supported systems are: UNIX with X11 (GLX), and Windows (WGL).
67  - Multiple windows.
68  - Subwindows.
69  - Overlays.
70  - Game mode (video mode switching).
71  - Menus.
72  - Font rendering.
73  - Some of the primitives.
74  - Buttons and Dials callbacks.
75  - Tablet callbacks.
76  - Spaceball callbacks are only implemented on UNIX/X11.
77  - Timer callback.
78
79 Missing FreeGLUT features:
80  - Mobile callbacks.
81  - Context version and profile selection and other context flags.
82  - Window close actions.
83  - Multi-touch/multi-pointer callbacks.
84  - User-pointer callbacks.
85  - Joystick callbacks.
86  - More missing primitives.
87
88 If wish to let me know how much you need one of the missing features, or even
89 better if you are volunteering to implement it yourself, send me an email at:
90 nuclear@member.fsf.org
91
92 Only plain-text emails, hard-wrapped at 72 columns will be accepted.