3 (:shadow
#:sleep
#:+red-bits
+ #:+green-bits
+ #:+blue-bits
+
4 #:+alpha-bits
+ #:+stencil-bits
+ #:+depth-bits
+
5 #:+accum-red-bits
+ #:+accum-green-bits
+ #:+accum-blue-bits
+
6 #:+accum-alpha-bits
+ #:+aux-buffers
+ #:+stereo
+
9 (:export
#:+accelerated
+ #:+accum-alpha-bits
+ #:+accum-blue-bits
+ #:+accum-green-bits
+ #:+accum-red-bits
+ #:+active
+ #:+alpha-bits
+ #:+alpha-map-bit
+ #:+auto-poll-events
+ #:+aux-buffers
+ #:+axes
+ #:+blue-bits
+ #:+build-mipmaps-bit
+ #:+buttons
+ #:+depth-bits
+ #:+fsaa-samples
+ #:+fullscreen
+ #:+green-bits
+ #:+iconified
+ #:+infinity
+ #:+joystick-1
+ #:+joystick-10
+ #:+joystick-11
+ #:+joystick-12
+ #:+joystick-13
+ #:+joystick-14
+ #:+joystick-15
+ #:+joystick-16
+ #:+joystick-2
+ #:+joystick-3
+ #:+joystick-4
+ #:+joystick-5
+ #:+joystick-6
+ #:+joystick-7
+ #:+joystick-8
+ #:+joystick-9
+ #:+joystick-last
+ #:+key-backspace
+ #:+key-del
+ #:+key-down
+ #:+key-end
+ #:+key-enter
+ #:+key-esc
+ #:+key-f1
+ #:+key-f10
+ #:+key-f11
+ #:+key-f12
+ #:+key-f13
+ #:+key-f14
+ #:+key-f15
+ #:+key-f16
+ #:+key-f17
+ #:+key-f18
+ #:+key-f19
+ #:+key-f2
+ #:+key-f20
+ #:+key-f21
+ #:+key-f22
+ #:+key-f23
+ #:+key-f24
+ #:+key-f25
+ #:+key-f3
+ #:+key-f4
+ #:+key-f5
+ #:+key-f6
+ #:+key-f7
+ #:+key-f8
+ #:+key-f9
+ #:+key-home
+ #:+key-insert
+ #:+key-kp-0
+ #:+key-kp-1
+ #:+key-kp-2
+ #:+key-kp-3
+ #:+key-kp-4
+ #:+key-kp-5
+ #:+key-kp-6
+ #:+key-kp-7
+ #:+key-kp-8
+ #:+key-kp-9
+ #:+key-kp-add
+ #:+key-kp-decimal
+ #:+key-kp-divide
+ #:+key-kp-enter
+ #:+key-kp-equal
+ #:+key-kp-multiply
+ #:+key-kp-subtract
+ #:+key-lalt
+ #:+key-last
+ #:+key-lctrl
+ #:+key-left
+ #:+key-lshift
+ #:+key-pagedown
+ #:+key-pageup
+ #:+key-ralt
+ #:+key-rctrl
+ #:+key-repeat
+ #:+key-right
+ #:+key-rshift
+ #:+key-space
+ #:+key-special
+ #:+key-tab
+ #:+key-unknown
+ #:+key-up
+ #:+mouse-button-1
+ #:+mouse-button-2
+ #:+mouse-button-3
+ #:+mouse-button-4
+ #:+mouse-button-5
+ #:+mouse-button-6
+ #:+mouse-button-7
+ #:+mouse-button-8
+ #:+mouse-button-last
+ #:+mouse-button-left
+ #:+mouse-button-middle
+ #:+mouse-button-right
+ #:+mouse-cursor
+ #:+no-rescale-bit
+ #:+nowait
+ #:+opened
+ #:+origin-ul-bit
+ #:+present
+ #:+press
+ #:+red-bits
+ #:+refresh-rate
+ #:+release
+ #:+stencil-bits
+ #:+stereo
+ #:+sticky-keys
+ #:+sticky-mouse-buttons
+ #:+system-keys
+ #:+wait
+ #:+window
+ #:+window-no-resize
+ #:broadcast-cond
#:close-window
#:create-cond
#:create-mutex
#:create-thread
#:defcfun
+doc
#:defcfun
+out
+doc
#:destroy-cond
#:destroy-mutex
#:destroy-thread
#:disable
#:do-window
#:enable
#:extension-supported
#:free-image
#:get-desktop-mode
#:get-gl-version
#:get-joystick-buttons
#:get-joystick-param
#:get-joystick-pos
#:get-key
#:get-mouse-button
#:get-mouse-pos
#:get-mouse-wheel
#:get-number-of-processors
#:get-proc-address
#:get-thread-id
#:get-time
#:get-version
#:get-video-modes
#:get-window-param
#:get-window-size
#:iconify-window
#:init
#:load-memory-texture-2d
#:load-texture-2d
#:load-texture-image-2d
#:lock-mutex
#:open-window
#:open-window-hint
#:poll-events
#:read-image
#:read-memory-image
#:restore-window
#:set-char-callback
#:set-key-callback
#:set-mouse-button-callback
#:set-mouse-pos
#:set-mouse-pos-callback
#:set-mouse-wheel
#:set-mouse-wheel-callback
#:set-time
#:set-window-close-callback
#:set-window-pos
#:set-window-refresh-callback
#:set-window-size
#:set-window-size-callback
#:set-window-title
#:signal-cond
#:sleep
#:swap-buffers
#:swap-interval
#:terminate
#:unlock-mutex
#:wait-cond
#:wait-events
#:wait-thread
#:with-init
#:with-init-window
#:with-lock-mutex
#:with-open-window
))
11 #| exports generated by this
, after the package is loaded
:
12 (format t
"~{#:~a~^ ~}"
13 (sort (mapcar #'(lambda (s) (string-downcase (format nil
"~a" s
)))
14 (remove-if-not #'(lambda (s)
15 (and (eql (symbol-package s
) (find-package '#:glfw
))
16 (or (constantp s
) (fboundp s
) (macro-function s
))))
17 (loop for s being each symbol in
'#:glfw collecting s
)))
23 ;; copy the boolean from OpenGL
24 (defctype boolean
:uint8
)
26 (defconstant +false
+ #x0
)
27 (defconstant +true
+ #x1
)
29 (eval-when (:compile-toplevel
:load-toplevel
:execute
)
30 (defmethod cffi:expand-to-foreign
(value (type (eql 'boolean
)))
31 `(if ,value
+true
+ +false
+))
33 (defmethod cffi:expand-from-foreign
(value (type (eql 'boolean
)))
34 `(not (= ,value
+false
+))))
37 (defmacro defcfun
+doc
((c-name lisp-name
) return-type
(&body args
) docstring
)
39 (defcfun (,c-name
,lisp-name
) ,return-type
,@args
)
40 (setf (documentation #',lisp-name
'function
) ,docstring
)))
42 (defmacro defcfun
+out
+doc
((c-name lisp-name
) return-type
(&body args
) docstring
)
43 (let ((internal-name (intern (format nil
"%~a" lisp-name
)))
44 (in-arg-names (mapcar #'second
(remove-if-not #'(lambda (arg)
47 (out-args (mapcar #'cdr
(remove-if-not #'(lambda (arg)
51 (defcfun (,c-name
,internal-name
) ,return-type
52 ,@(mapcar #'(lambda (arg)
53 (if (eql (car arg
) :out
)
54 (list (second arg
) :pointer
)
57 (defun ,lisp-name
,in-arg-names
59 (with-foreign-objects ,out-args
60 (,internal-name
,@(mapcar #'second args
))
61 (list ,@(mapcar #'(lambda (arg)
62 `(mem-ref ,(first arg
) ',(second arg
)))
66 (load-foreign-library '(:or
67 #+darwin
(:framework
"GLFW")
69 (:default
"libglfw")))
71 ;; Key and button state/action definitions
72 (defconstant +release
+ 0)
73 (defconstant +press
+ 1)
75 ;; Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
76 ;; for printable keys (such as A-Z, 0-9 etc), and values above 256
77 ;; represent special (non-printable) keys (e.g. F1, Page Up etc).
78 (defconstant +key-unknown
+ -
1)
79 (defconstant +key-space
+ 32)
80 (defconstant +key-special
+ 256)
81 (defconstant +key-esc
+ (+ +key-special
+ 1))
82 (defconstant +key-f1
+ (+ +key-special
+ 2))
83 (defconstant +key-f2
+ (+ +key-special
+ 3))
84 (defconstant +key-f3
+ (+ +key-special
+ 4))
85 (defconstant +key-f4
+ (+ +key-special
+ 5))
86 (defconstant +key-f5
+ (+ +key-special
+ 6))
87 (defconstant +key-f6
+ (+ +key-special
+ 7))
88 (defconstant +key-f7
+ (+ +key-special
+ 8))
89 (defconstant +key-f8
+ (+ +key-special
+ 9))
90 (defconstant +key-f9
+ (+ +key-special
+ 10))
91 (defconstant +key-f10
+ (+ +key-special
+ 11))
92 (defconstant +key-f11
+ (+ +key-special
+ 12))
93 (defconstant +key-f12
+ (+ +key-special
+ 13))
94 (defconstant +key-f13
+ (+ +key-special
+ 14))
95 (defconstant +key-f14
+ (+ +key-special
+ 15))
96 (defconstant +key-f15
+ (+ +key-special
+ 16))
97 (defconstant +key-f16
+ (+ +key-special
+ 17))
98 (defconstant +key-f17
+ (+ +key-special
+ 18))
99 (defconstant +key-f18
+ (+ +key-special
+ 19))
100 (defconstant +key-f19
+ (+ +key-special
+ 20))
101 (defconstant +key-f20
+ (+ +key-special
+ 21))
102 (defconstant +key-f21
+ (+ +key-special
+ 22))
103 (defconstant +key-f22
+ (+ +key-special
+ 23))
104 (defconstant +key-f23
+ (+ +key-special
+ 24))
105 (defconstant +key-f24
+ (+ +key-special
+ 25))
106 (defconstant +key-f25
+ (+ +key-special
+ 26))
107 (defconstant +key-up
+ (+ +key-special
+ 27))
108 (defconstant +key-down
+ (+ +key-special
+ 28))
109 (defconstant +key-left
+ (+ +key-special
+ 29))
110 (defconstant +key-right
+ (+ +key-special
+ 30))
111 (defconstant +key-lshift
+ (+ +key-special
+ 31))
112 (defconstant +key-rshift
+ (+ +key-special
+ 32))
113 (defconstant +key-lctrl
+ (+ +key-special
+ 33))
114 (defconstant +key-rctrl
+ (+ +key-special
+ 34))
115 (defconstant +key-lalt
+ (+ +key-special
+ 35))
116 (defconstant +key-ralt
+ (+ +key-special
+ 36))
117 (defconstant +key-tab
+ (+ +key-special
+ 37))
118 (defconstant +key-enter
+ (+ +key-special
+ 38))
119 (defconstant +key-backspace
+ (+ +key-special
+ 39))
120 (defconstant +key-insert
+ (+ +key-special
+ 40))
121 (defconstant +key-del
+ (+ +key-special
+ 41))
122 (defconstant +key-pageup
+ (+ +key-special
+ 42))
123 (defconstant +key-pagedown
+ (+ +key-special
+ 43))
124 (defconstant +key-home
+ (+ +key-special
+ 44))
125 (defconstant +key-end
+ (+ +key-special
+ 45))
126 (defconstant +key-kp-0
+ (+ +key-special
+ 46))
127 (defconstant +key-kp-1
+ (+ +key-special
+ 47))
128 (defconstant +key-kp-2
+ (+ +key-special
+ 48))
129 (defconstant +key-kp-3
+ (+ +key-special
+ 49))
130 (defconstant +key-kp-4
+ (+ +key-special
+ 50))
131 (defconstant +key-kp-5
+ (+ +key-special
+ 51))
132 (defconstant +key-kp-6
+ (+ +key-special
+ 52))
133 (defconstant +key-kp-7
+ (+ +key-special
+ 53))
134 (defconstant +key-kp-8
+ (+ +key-special
+ 54))
135 (defconstant +key-kp-9
+ (+ +key-special
+ 55))
136 (defconstant +key-kp-divide
+ (+ +key-special
+ 56))
137 (defconstant +key-kp-multiply
+ (+ +key-special
+ 57))
138 (defconstant +key-kp-subtract
+ (+ +key-special
+ 58))
139 (defconstant +key-kp-add
+ (+ +key-special
+ 59))
140 (defconstant +key-kp-decimal
+ (+ +key-special
+ 60))
141 (defconstant +key-kp-equal
+ (+ +key-special
+ 61))
142 (defconstant +key-kp-enter
+ (+ +key-special
+ 62))
143 (defconstant +key-last
+ +key-kp-enter
+)
145 ;; Mouse button definitions
146 (defconstant +mouse-button-1
+ 0)
147 (defconstant +mouse-button-2
+ 1)
148 (defconstant +mouse-button-3
+ 2)
149 (defconstant +mouse-button-4
+ 3)
150 (defconstant +mouse-button-5
+ 4)
151 (defconstant +mouse-button-6
+ 5)
152 (defconstant +mouse-button-7
+ 6)
153 (defconstant +mouse-button-8
+ 7)
154 (defconstant +mouse-button-last
+ +mouse-button-8
+)
156 ;; Mouse button aliases
157 (defconstant +mouse-button-left
+ +mouse-button-1
+)
158 (defconstant +mouse-button-right
+ +mouse-button-2
+)
159 (defconstant +mouse-button-middle
+ +mouse-button-3
+)
161 ;; Joystick identifiers
162 (defconstant +joystick-1
+ 0)
163 (defconstant +joystick-2
+ 1)
164 (defconstant +joystick-3
+ 2)
165 (defconstant +joystick-4
+ 3)
166 (defconstant +joystick-5
+ 4)
167 (defconstant +joystick-6
+ 5)
168 (defconstant +joystick-7
+ 6)
169 (defconstant +joystick-8
+ 7)
170 (defconstant +joystick-9
+ 8)
171 (defconstant +joystick-10
+ 9)
172 (defconstant +joystick-11
+ 10)
173 (defconstant +joystick-12
+ 11)
174 (defconstant +joystick-13
+ 12)
175 (defconstant +joystick-14
+ 13)
176 (defconstant +joystick-15
+ 14)
177 (defconstant +joystick-16
+ 15)
178 (defconstant +joystick-last
+ +joystick-16
+)
181 ;;========================================================================
183 ;;========================================================================
185 ;; glfwOpenWindow modes
186 (defconstant +window
+ #x00010001
)
187 (defconstant +fullscreen
+ #x00010002
)
189 ;; glfwGetWindowParam tokens
190 (defconstant +opened
+ #x00020001
)
191 (defconstant +active
+ #x00020002
)
192 (defconstant +iconified
+ #x00020003
)
193 (defconstant +accelerated
+ #x00020004
)
194 (defconstant +red-bits
+ #x00020005
)
195 (defconstant +green-bits
+ #x00020006
)
196 (defconstant +blue-bits
+ #x00020007
)
197 (defconstant +alpha-bits
+ #x00020008
)
198 (defconstant +depth-bits
+ #x00020009
)
199 (defconstant +stencil-bits
+ #x0002000a
)
201 ;; The following constants are used for both glfwGetWindowParam
202 ;; and glfwOpenWindowHint
203 (defconstant +refresh-rate
+ #x0002000b
)
204 (defconstant +accum-red-bits
+ #x0002000c
)
205 (defconstant +accum-green-bits
+ #x0002000d
)
206 (defconstant +accum-blue-bits
+ #x0002000e
)
207 (defconstant +accum-alpha-bits
+ #x0002000f
)
208 (defconstant +aux-buffers
+ #x00020010
)
209 (defconstant +stereo
+ #x00020011
)
210 (defconstant +window-no-resize
+ #x00020012
)
211 (defconstant +fsaa-samples
+ #x00020013
)
213 ;; glfwEnable/glfwDisable tokens
214 (defconstant +mouse-cursor
+ #x00030001
)
215 (defconstant +sticky-keys
+ #x00030002
)
216 (defconstant +sticky-mouse-buttons
+ #x00030003
)
217 (defconstant +system-keys
+ #x00030004
)
218 (defconstant +key-repeat
+ #x00030005
)
219 (defconstant +auto-poll-events
+ #x00030006
)
221 ;; glfwWaitThread wait modes
222 (defconstant +wait
+ #x00040001
)
223 (defconstant +nowait
+ #x00040002
)
225 ;; glfwGetJoystickParam tokens
226 (defconstant +present
+ #x00050001
)
227 (defconstant +axes
+ #x00050002
)
228 (defconstant +buttons
+ #x00050003
)
230 ;; glfwReadImage/glfwLoadTexture2D flags
231 (defconstant +no-rescale-bit
+ #x00000001
) ; Only for glfwReadImage
232 (defconstant +origin-ul-bit
+ #x00000002
)
233 (defconstant +build-mipmaps-bit
+ #x00000004
) ; Only for glfwLoadTexture2D
234 (defconstant +alpha-map-bit
+ #x00000008
)
236 ;; Time spans longer than this (seconds) are considered to be infinity
237 (defconstant +infinity
+ 100000d0
)
239 (defcfun+doc
("glfwInit" init
) boolean
()
241 If the function succeeds, t is returned.
242 If the function fails, nil is returned.
244 The glfwInit function initializes GLFW. No other GLFW functions may be used before this function
248 This function may take several seconds to complete on some systems, while on other systems it may
249 take only a fraction of a second to complete.")
251 (defcfun+doc
("glfwTerminate" terminate
) :void
()
252 "The function terminates GLFW. Among other things it closes the window, if it is opened, and kills any
253 running threads. This function must be called before a program exits.")
255 (defcfun+out
+doc
("glfwGetVersion" get-version
) :void
((:out major
:int
)
259 The function returns the major and minor version numbers and the revision for the currently linked
260 GLFW library as a list (major minor rev).")
262 (defmacro with-init
(&body forms
)
263 "Call glfw:init, execute forms and clean-up with glfw:terminate once finished.
264 This makes a nice wrapper to an application higher-level form.
265 Signals an error on failure to initialize. Wrapped in a block named glfw:with-init."
268 (block with-init
,@forms
)
270 (error "Error initializing glfw.")))
272 (defcfun ("glfwOpenWindow" %open-window
) boolean
273 (width :int
) (height :int
)
274 (redbits :int
) (greenbits :int
) (bluebits :int
) (alphabits :int
)
275 (depthbits :int
) (stencilbits :int
) (mode :int
))
277 (declaim (inline open-window
))
278 (defun open-window (&optional
(width 0) (height 0)
279 (redbits 0) (greenbits 0) (bluebits 0) (alphabits 0)
280 (depthbits 0) (stencilbits 0) (mode +window
+))
282 The width of the window. If width is zero, it will be calculated as width = 4/3 height, if height is
283 not zero. If both width and height are zero, then width will be set to 640.
285 The height of the window. If height is zero, it will be calculated as height = 3/4 width, if width is
286 not zero. If both width and height are zero, then height will be set to 480.
287 redbits, greenbits, bluebits
288 The number of bits to use for each color component of the color buffer (0 means default color
289 depth). For instance, setting redbits=5, greenbits=6, and bluebits=5 will generate a 16-bit color
292 The number of bits to use for the alpha buffer (0 means no alpha buffer).
294 The number of bits to use for the depth buffer (0 means no depth buffer).
296 The number of bits to use for the stencil buffer (0 means no stencil buffer).
298 Selects which type of OpenGL™ window to use. mode can be either GLFW_WINDOW, which
299 will generate a normal desktop window, or GLFW_FULLSCREEN, which will generate a
300 window which covers the entire screen. When GLFW_FULLSCREEN is selected, the video
301 mode will be changed to the resolution that closest matches the width and height parameters.
304 If the function succeeds, t is returned.
305 If the function fails, nil is returned.
308 The function opens a window that best matches the parameters given to the function. How well the
309 resulting window matches the desired window depends mostly on the available hardware and
310 OpenGL™ drivers. In general, selecting a fullscreen mode has better chances of generating a close
311 match than does a normal desktop window, since GLFW can freely select from all the available video
312 modes. A desktop window is normally restricted to the video mode of the desktop.
315 For additional control of window properties, see glfwOpenWindowHint.
316 In fullscreen mode the mouse cursor is hidden by default, and any system screensavers are prohibited
317 from starting. In windowed mode the mouse cursor is visible, and screensavers are allowed to start. To
318 change the visibility of the mouse cursor, use glfwEnable or glfwDisable with the argument
320 In order to determine the actual properties of an opened window, use glfwGetWindowParam and
321 glfwGetWindowSize (or glfwSetWindowSizeCallback).
323 (%open-window width height redbits greenbits bluebits alphabits depthbits stencilbits mode
))
326 (defcfun+doc
("glfwOpenWindowHint" open-window-hint
) :void
((target :int
) (hint :int
))
328 Can be any of the constants in the table 3.1.
330 An integer giving the value of the corresponding target (see table 3.1).
333 The function sets additional properties for a window that is to be opened. For a hint to be registered, the
334 function must be called before calling glfwOpenWindow. When the glfwOpenWindow function is
335 called, any hints that were registered with the glfwOpenWindowHint function are used for setting the
336 corresponding window properties, and then all hints are reset to their default values.
339 In order to determine the actual properties of an opened window, use glfwGetWindowParam (after the
340 window has been opened).
341 GLFW_STEREO is a hard constraint. If stereo rendering is requested, but no stereo rendering capable
342 pixel formats / visuals are available, glfwOpenWindow will fail.
343 The GLFW_REFRESH-RATE property should be used with caution. Most systems have default values
344 for monitor refresh rates that are optimal for the specific system. Specifying the refresh rate can
345 override these settings, which can result in suboptimal operation. The monitor may be unable to display
346 the resulting video signal, or in the worst case it may even be damaged!
349 (defcfun+doc
("glfwCloseWindow" close-window
) :void
()
350 "The function closes an opened window and destroys the associated OpenGL™ context.")
352 (defmacro with-open-window
((&optional
(title "cl-glfw window") (width 0) (height 0)
353 (redbits 0) (greenbits 0) (bluebits 0) (alphabits 0)
354 (depthbits 0) (stencilbits 0) (mode +window
+))
356 "Wraps forms such that there is an open window for them to execute in and cleans up the
357 window afterwards. An error is signalled if there was an error opening the window.
358 Takes the same parameters as open-window, with the addition of 'title' which will
359 set the window title after opening.
360 Wrapped in a block named glfw:with-open-window."
361 `(if (%open-window
,width
,height
,redbits
,greenbits
,bluebits
,alphabits
,depthbits
,stencilbits
,mode
)
363 (block with-open-window
364 (glfw:set-window-title
,title
)
366 (when (eql (glfw:get-window-param glfw
:+opened
+) +true
+)
368 (error "Error initializing glfw window.")))
370 (defmacro with-init-window
((&optional
(title "cl-glfw window") (width 0) (height 0)
371 (redbits 0) (greenbits 0) (bluebits 0) (alphabits 0)
372 (depthbits 0) (stencilbits 0) (mode +window
+))
374 "Wraps forms in with-init, with-open-window. Passes through the other arguments to open-window."
376 (with-open-window (,title
,width
,height
,redbits
,greenbits
,bluebits
,alphabits
,depthbits
,stencilbits
,mode
)
379 (defmacro do-window
((&optional
(title "cl-glfw window") (width 0) (height 0)
380 (redbits 0) (greenbits 0) (bluebits 0) (alphabits 0)
381 (depthbits 0) (stencilbits 0) (mode +window
+))
384 "High-level convenience macro for initializing glfw, opening a window (given the optional window parameters),
385 setting the title given,
386 running setup-forms and then running forms in a loop, with calls to swap-buffers after each loop iteration.
387 The loop is in a block named do-window [so can be exited by a call to (return-from glfw:do-window)].
388 If the window is closed, the loop is also exited."
389 `(with-init-window (,title
,width
,height
,redbits
,greenbits
,bluebits
,alphabits
,depthbits
,stencilbits
,mode
)
391 (loop named do-window do
394 (unless (eql (glfw:get-window-param glfw
:+opened
+) +true
+)
395 (return-from do-window
)))))
397 (defcfun+doc
("glfwSetWindowCloseCallback" set-window-close-callback
) :void
((cbfun :pointer
))
400 Pointer to a callback function that will be called when a user requests that the window should be
401 closed, typically by clicking the window close icon (e.g. the cross in the upper right corner of a
402 window under Microsoft Windows). The function should have the following C language
404 int GLFWCALL functionname( void );
405 Where functionname is the name of the callback function. The return value of the callback
406 function indicates wether or not the window close action should continue. If the function returns
407 GL_TRUE, the window will be closed. If the function returns GL_FALSE, the window will not
409 If cbfun is NULL, any previously selected callback function will be deselected.
411 If you declare your callback as returning glfw:boolean, you can use t and nil as return types.
414 The function selects which function to be called upon a window close event.
415 A window has to be opened for this function to have any effect.
418 Window close events are recorded continuously, but only reported when glfwPollEvents,
419 glfwWaitEvents or glfwSwapBuffers is called.
420 The OpenGL™ context is still valid when this function is called.
421 Note that the window close callback function is not called when glfwCloseWindow is called, but only
422 when the close request comes from the window manager.
423 Do not call glfwCloseWindow from a window close callback function. Close the window by returning
424 GL_TRUE from the function.
427 (defcfun+doc
("glfwSetWindowTitle" set-window-title
) :void
((title :string
))
430 Pointer to a null terminated ISO 8859-1 (8-bit Latin 1) string that holds the title of the window.
433 The function changes the title of the opened window.
436 The title property of a window is often used in situations other than for the window title, such as the title
437 of an application icon when it is in iconified state.")
439 (defcfun+doc
("glfwSetWindowSize" set-window-size
) :void
((width :int
) (height :int
))
444 Height of the window.
448 The function changes the size of an opened window. The width and height parameters denote the size of
449 the client area of the window (i.e. excluding any window borders and decorations).
450 If the window is in fullscreen mode, the video mode will be changed to a resolution that closest matches
451 the width and height parameters (the number of color bits will not be changed).
453 The OpenGL™ context is guaranteed to be preserved after calling glfwSetWindowSize, even if the
454 video mode is changed.
457 (defcfun+doc
("glfwSetWindowPos" set-window-pos
) :void
((x :int
) (y :int
))
460 Horizontal position of the window, relative to the upper left corner of the desktop.
462 Vertical position of the window, relative to the upper left corner of the desktop.
466 The function changes the position of an opened window. It does not have any effect on a fullscreen
470 (defcfun ("glfwGetWindowSize" %get-window-size
) :void
(width :pointer
) (height :pointer
))
471 (defun get-window-size ()
472 "The function is used for determining the size of an opened window. The returned values are dimensions
473 of the client area of the window (i.e. excluding any window borders and decorations).
475 (cffi:with-foreign-objects
((width :int
)
477 (%get-window-size width height
)
478 (list (mem-ref width
:int
)
479 (mem-ref height
:int
))))
481 (defcfun+doc
("glfwSetWindowSizeCallback" set-window-size-callback
) :void
((cbfun :pointer
))
484 Pointer to a callback function that will be called every time the window size changes. The
485 function should have the following C language prototype:
486 void GLFWCALL functionname( int width, int height );
487 Where functionname is the name of the callback function, and width and height are the
488 dimensions of the window client area.
489 If cbfun is NULL, any previously selected callback function will be deselected.
493 The function selects which function to be called upon a window size change event.
494 A window has to be opened for this function to have any effect.
496 Window size changes are recorded continuously, but only reported when glfwPollEvents,
497 glfwWaitEvents or glfwSwapBuffers is called. ")
499 (defcfun+doc
("glfwIconifyWindow" iconify-window
) :void
()
500 "Iconify a window. If the window is in fullscreen mode, then the desktop video mode will be restored.")
502 (defcfun+doc
("glfwRestoreWindow" restore-window
) :void
()
503 "Restore an iconified window. If the window that is restored is in fullscreen mode, then the fullscreen
504 video mode will be restored.")
506 (defcfun+doc
("glfwGetWindowParam" get-window-param
) :int
((param :int
))
509 A token selecting which parameter the function should return (see table 3.2).
512 The function returns different parameters depending on the value of param. Table 3.2 lists valid param
513 values, and their corresponding return values.
516 The function is used for acquiring various properties of an opened window.
519 GLFW_ACCELERATED is only supported under Windows. Other systems will always return
520 GL_TRUE. Under Windows, GLFW_ACCELERATED means that the OpenGL™ renderer is a 3rd
521 party renderer, rather than the fallback Microsoft software OpenGL™ renderer. In other words, it is
522 not a real guarantee that the OpenGL™ renderer is actually hardware accelerated.
525 (defcfun+doc
("glfwSwapBuffers" swap-buffers
) :void
()
526 "The function swaps the back and front color buffers of the window. If GLFW_AUTO-POLL-EVENTS
527 is enabled (which is the default), glfwPollEvents is called before swapping the front and back buffers.")
530 (defcfun+doc
("glfwSwapInterval" swap-interval
) :void
((interval :int
))
533 Minimum number of monitor vertical retraces between each buffer swap performed by
534 glfwSwapBuffers. If interval is zero, buffer swaps will not be synchronized to the vertical
535 refresh of the monitor (also known as ’VSync off’).
538 The function selects the minimum number of monitor vertical retraces that should occur between two
539 buffer swaps. If the selected swap interval is one, the rate of buffer swaps will never be higher than the
540 vertical refresh rate of the monitor. If the selected swap interval is zero, the rate of buffer swaps is only
541 limited by the speed of the software and the hardware.
544 This function will only have an effect on hardware and drivers that support user selection of the swap
548 (defcfun+doc
("glfwSetWindowRefreshCallback" set-window-refresh-callback
) :void
((cbfun :pointer
))
551 Pointer to a callback function that will be called when the window client area needs to be
552 refreshed. The function should have the following C language prototype:
553 void GLFWCALL functionname( void );
554 Where functionname is the name of the callback function.
555 If cbfun is NULL, any previously selected callback function will be deselected.
558 The function selects which function to be called upon a window refresh event, which occurs when any
559 part of the window client area has been damaged, and needs to be repainted (for instance, if a part of the
560 window that was previously occluded by another window has become visible).
561 A window has to be opened for this function to have any effect.
564 Window refresh events are recorded continuously, but only reported when glfwPollEvents,
565 glfwWaitEvents or glfwSwapBuffers is called.
575 (defcfun ("glfwGetVideoModes" %get-video-modes
) :int
(list :pointer
) (maxcount :int
))
577 (defun get-video-modes (maxcount)
580 Maximum number of video modes that list vector can hold.
583 The function returns the number of detected video modes (this number will never exceed maxcount).
584 The list vector is filled out with the video modes that are supported by the system.
587 The function returns a list of supported video modes. Each video mode is represented by a
589 (width height redbits greenbits bluebits)
592 The returned list is sorted, first by color depth (RedBits + GreenBits + BlueBits), and then by
593 resolution (Width × Height), with the lowest resolution, fewest bits per pixel mode first. "
594 (declare (optimize (debug 3)))
595 (with-foreign-object (list 'vidmode maxcount
)
596 (let ((count (%get-video-modes list maxcount
)))
597 (loop for i below count
599 (let ((mode (cffi:mem-aref list
'vidmode i
)))
600 (list (foreign-slot-value mode
'vidmode
'width
)
601 (foreign-slot-value mode
'vidmode
'height
)
602 (foreign-slot-value mode
'vidmode
'redbits
)
603 (foreign-slot-value mode
'vidmode
'greenbits
)
604 (foreign-slot-value mode
'vidmode
'bluebits
)))))))
606 (defcfun ("glfwGetDesktopMode" %get-desktop-mode
) :void
(mode :pointer
))
607 (defun get-desktop-mode ()
610 Pointer to a GLFWvidmode structure, which will be filled out by the function.
612 The GLFWvidmode structure pointed to by mode is filled out with the desktop video mode.
614 The function returns the desktop video mode in a GLFWvidmode structure. See glfwGetVideoModes
615 for a definition of the GLFWvidmode structure.
617 The color depth of the desktop display is always reported as the number of bits for each individual color
618 component (red, green and blue), even if the desktop is not using an RGB or RGBA color format. For
619 instance, an indexed 256 color display may report RedBits = 3, GreenBits = 3 and BlueBits = 2, which
620 adds up to 8 bits in total.
621 The desktop video mode is the video mode used by the desktop, not the current video mode (which may
622 differ from the desktop video mode if the GLFW window is a fullscreen window).
624 (with-foreign-object (mode 'vidmode
)
625 (%get-desktop-mode mode
)
626 (list (foreign-slot-value mode
'vidmode
'width
)
627 (foreign-slot-value mode
'vidmode
'height
)
628 (foreign-slot-value mode
'vidmode
'redbits
)
629 (foreign-slot-value mode
'vidmode
'greenbits
)
630 (foreign-slot-value mode
'vidmode
'bluebits
))))
632 (defcfun+doc
("glfwPollEvents" poll-events
) :void
()
634 The function is used for polling for events, such as user input and window resize events. Upon calling
635 this function, all window states, keyboard states and mouse states are updated. If any related callback
636 functions are registered, these are called during the call to glfwPollEvents.
639 glfwPollEvents is called implicitly from glfwSwapBuffers if GLFW_AUTO_POLL_EVENTS is
640 enabled (default). Thus, if glfwSwapBuffers is called frequently, which is normally the case, there is
641 no need to call glfwPollEvents.
644 (defcfun+doc
("glfwWaitEvents" wait-events
) :void
()
646 The function is used for waiting for events, such as user input and window resize events. Upon calling
647 this function, the calling thread will be put to sleep until any event appears in the event queue. When
648 events are ready, the events will be processed just as they are processed by glfwPollEvents.
649 If there are any events in the queue when the function is called, the function will behave exactly like
650 glfwPollEvents (i.e. process all messages and then return, without blocking the calling thread).
653 It is guaranteed that glfwWaitEvents will wake up on any event that can be processed by
654 glfwPollEvents. However, glfwWaitEvents may wake up on events that are not processed or reported
655 by glfwPollEvents too, and the function may behave differently on different systems. Do no make any
656 assumptions about when or why glfwWaitEvents will return.
659 (defcfun+doc
("glfwGetKey" get-key
) :int
((key :int
))
662 A keyboard key identifier, which can be either an uppercase printable ISO 8859-1 (Latin 1)
663 character (e.g. 'A', '3' or '.'), or a special key identifier. Table 3.3 lists valid special key
666 The function returns GLFW_PRESS if the key is held down, or GLFW_RELEASE if the key is not
670 The function queries the current state of a specific keyboard key. The physical location of each key
671 depends on the system keyboard layout setting.
674 The constant GLFW_KEY_SPACE is equal to 32, which is the ISO 8859-1 code for space.
675 Not all key codes are supported on all systems. Also, while some keys are available on some keyboard
676 layouts, they may not be available on other keyboard layouts.
677 For systems that do not distinguish between left and right versions of modifier keys (shift, alt and
678 control), the left version is used (e.g. GLFW_KEY_LSHIFT).
679 A window must be opened for the function to have any effect, and glfwPollEvents, glfwWaitEvents or
680 glfwSwapBuffers must be called before any keyboard events are recorded and reported by
684 (defcfun+doc
("glfwGetMouseButton" get-mouse-button
) :int
((button :int
))
687 A mouse button identifier, which can be one of the mouse button identifiers listed in table 3.4.
689 The function returns GLFW_PRESS if the mouse button is held down, or GLFW_RELEASE if the
690 mouse button is not held down.
692 The function queries the current state of a specific mouse button.
694 A window must be opened for the function to have any effect, and glfwPollEvents, glfwWaitEvents or
695 glfwSwapBuffers must be called before any mouse button events are recorded and reported by
697 GLFW_MOUSE_BUTTON_LEFT is equal to GLFW_MOUSE_BUTTON_1.
698 GLFW_MOUSE_BUTTON_RIGHT is equal to GLFW_MOUSE_BUTTON_2.
699 GLFW_MOUSE_BUTTON_MIDDLE is equal to GLFW_MOUSE_BUTTON_3.
703 (defcfun+out
+doc
("glfwGetMousePos" get-mouse-pos
) :void
((:out xpos
:int
) (:out ypos
:int
))
705 The function returns the current mouse position in xpos and ypos.
708 The function returns the current mouse position. If the cursor is not hidden, the mouse position is the
709 cursor position, relative to the upper left corner of the window and limited to the client area of the
710 window. If the cursor is hidden, the mouse position is a virtual absolute position, not limited to any
711 boundaries except to those implied by the maximum number that can be represented by a signed integer
712 (normally -2147483648 to +2147483647).
715 A window must be opened for the function to have any effect, and glfwPollEvents, glfwWaitEvents or
716 glfwSwapBuffers must be called before any mouse movements are recorded and reported by
721 (defcfun+doc
("glfwSetMousePos" set-mouse-pos
) :void
((xpos :int
) (ypos :int
))
724 Horizontal position of the mouse.
726 Vertical position of the mouse.
729 The function changes the position of the mouse. If the cursor is visible (not disabled), the cursor will be
730 moved to the specified position, relative to the upper left corner of the window client area. If the cursor
731 is hidden (disabled), only the mouse position that is reported by GLFW is changed.
734 (defcfun+doc
("glfwGetMouseWheel" get-mouse-wheel
) :int
()
736 The function returns the current mouse wheel position.
738 The function returns the current mouse wheel position. The mouse wheel can be thought of as a third
739 mouse axis, which is available as a separate wheel or up/down stick on some mice.
741 A window must be opened for the function to have any effect, and glfwPollEvents, glfwWaitEvents or
742 glfwSwapBuffers must be called before any mouse wheel movements are recorded and reported by
746 (defcfun+doc
("glfwSetMouseWheel" set-mouse-wheel
) :void
((pos :int
))
749 Position of the mouse wheel.
751 The function changes the position of the mouse wheel.
755 (defcfun+doc
("glfwSetKeyCallback" set-key-callback
) :void
((cbfun :pointer
))
758 Pointer to a callback function that will be called every time a key is pressed or released. The
759 function should have the following C language prototype:
760 void GLFWCALL functionname( int key, int action );
761 Where functionname is the name of the callback function, key is a key identifier, which is an
762 uppercase printable ISO 8859-1 character or a special key identifier (see table 3.3), and action is
763 either GLFW_PRESS or GLFW_RELEASE.
764 If cbfun is NULL, any previously selected callback function will be deselected.
768 The function selects which function to be called upon a keyboard key event. The callback function is
769 called every time the state of a single key is changed (from released to pressed or vice versa). The
770 reported keys are unaffected by any modifiers (such as shift or alt).
771 A window has to be opened for this function to have any effect.
773 Keyboard events are recorded continuously, but only reported when glfwPollEvents, glfwWaitEvents
774 or glfwSwapBuffers is called.
776 (defcfun+doc
("glfwSetCharCallback" set-char-callback
) :void
((cbfun :pointer
))
779 Pointer to a callback function that will be called every time a printable character is generated by
780 the keyboard. The function should have the following C language prototype:
781 void GLFWCALL functionname( int character, int action );
782 Where functionname is the name of the callback function, character is a Unicode (ISO 10646)
783 character, and action is either GLFW_PRESS or GLFW_RELEASE.
784 If cbfun is NULL, any previously selected callback function will be deselected.
788 The function selects which function to be called upon a keyboard character event. The callback function
789 is called every time a key that results in a printable Unicode character is pressed or released. Characters
790 are affected by modifiers (such as shift or alt).
791 A window has to be opened for this function to have any effect.
793 Character events are recorded continuously, but only reported when glfwPollEvents, glfwWaitEvents
794 or glfwSwapBuffers is called.
795 Control characters, such as tab and carriage return, are not reported to the character callback function,
796 since they are not part of the Unicode character set. Use the key callback function for such events (see
798 The Unicode character set supports character codes above 255, so never cast a Unicode character to an
799 eight bit data type (e.g. the C language ’char’ type) without first checking that the character code is less
800 than 256. Also note that Unicode character codes 0 to 255 are equal to ISO 8859-1 (Latin 1).
802 (defcfun+doc
("glfwSetMouseButtonCallback" set-mouse-button-callback
) :void
((cbfun :pointer
))
805 Pointer to a callback function that will be called every time a mouse button is pressed or released.
806 The function should have the following C language prototype:
807 void GLFWCALL functionname( int button, int action );
808 Where functionname is the name of the callback function, button is a mouse button identifier (see
809 table 3.4 on page 56), and action is either GLFW_PRESS or GLFW_RELEASE.
810 If cbfun is NULL, any previously selected callback function will be deselected.
814 The function selects which function to be called upon a mouse button event.
815 A window has to be opened for this function to have any effect.
817 Mouse button events are recorded continuously, but only reported when glfwPollEvents,
818 glfwWaitEvents or glfwSwapBuffers is called.
819 GLFW_MOUSE_BUTTON_LEFT is equal to GLFW_MOUSE_BUTTON_1.
820 GLFW_MOUSE_BUTTON_RIGHT is equal to GLFW_MOUSE_BUTTON_2.
821 GLFW_MOUSE_BUTTON_MIDDLE is equal to GLFW_MOUSE_BUTTON_3.
823 (defcfun+doc
("glfwSetMousePosCallback" set-mouse-pos-callback
) :void
((cbfun :pointer
))
826 Pointer to a callback function that will be called every time the mouse is moved. The function
827 should have the following C language prototype:
828 void GLFWCALL functionname( int x, int y );
829 Where functionname is the name of the callback function, and x and y are the mouse coordinates
830 (see glfwGetMousePos for more information on mouse coordinates).
831 If cbfun is NULL, any previously selected callback function will be deselected.
835 The function selects which function to be called upon a mouse motion event.
836 A window has to be opened for this function to have any effect.
838 Mouse motion events are recorded continuously, but only reported when glfwPollEvents,
839 glfwWaitEvents or glfwSwapBuffers is called.
841 (defcfun+doc
("glfwSetMouseWheelCallback" set-mouse-wheel-callback
) :void
((cbfun :pointer
))
844 Pointer to a callback function that will be called every time the mouse wheel is moved. The
845 function should have the following C language prototype:
846 void GLFWCALL functionname( int pos );
847 Where functionname is the name of the callback function, and pos is the mouse wheel position.
848 If cbfun is NULL, any previously selected callback function will be deselected.
852 The function selects which function to be called upon a mouse wheel event.
853 A window has to be opened for this function to have any effect.
855 Mouse wheel events are recorded continuously, but only reported when glfwPollEvents,
856 glfwWaitEvents or glfwSwapBuffers is called.
859 (defcfun+doc
("glfwGetJoystickParam" get-joystick-param
) :int
((joy :int
) (param :int
))
862 A joystick identifier, which should be GLFW_JOYSTICK_n, where n is in the range 1 to 16.
864 A token selecting which parameter the function should return (see table 3.5).
866 The function returns different parameters depending on the value of param. Table 3.5 lists valid param
867 values, and their corresponding return values.
869 The function is used for acquiring various properties of a joystick.
871 The joystick information is updated every time the function is called.
872 No window has to be opened for joystick information to be valid.
875 (defcfun ("glfwGetJoystickPos" %get-joystick-pos
) :int
(joy :int
) (pos :pointer
) (numaxes :int
))
877 (defun get-joystick-pos (joy numaxes
)
880 A joystick identifier, which should be GLFW_JOYSTICK_n, where n is in the range 1 to 16.
882 Specifies how many axes should be returned.
884 An list that will hold the positional values for all requested axes.
885 If the joystick is not supported or connected, the function will
889 The function queries the current position of one or more axes of a joystick. The positional values are
890 returned in an array, where the first element represents the first axis of the joystick (normally the X
891 axis). Each position is in the range -1.0 to 1.0. Where applicable, the positive direction of an axis is
892 right, forward or up, and the negative direction is left, back or down.
893 If numaxes exceeds the number of axes supported by the joystick, or if the joystick is not available, the
894 unused elements in the pos array will be set to 0.0 (zero).
897 The joystick state is updated every time the function is called, so there is no need to call glfwPollEvents
898 or glfwWaitEvents for joystick state to be updated.
899 Use glfwGetJoystickParam to retrieve joystick capabilities, such as joystick availability and number of
901 No window has to be opened for joystick input to be valid.
903 (with-foreign-object (pos :float numaxes
)
904 (let ((numaxes (%get-joystick-pos joy pos numaxes
)))
905 (loop for i below numaxes collecting
(mem-aref pos
:float i
)))))
908 (defcfun ("glfwGetJoystickButtons" %get-joystick-buttons
) :int
(joy :int
) (buttons :pointer
) (numbuttons :int
))
909 (defun get-joystick-buttons (joy numbuttons
)
912 A joystick identifier, which should be GLFW_JOYSTICK_n, where n is in the range 1 to 16.
914 Specifies how many buttons should be returned.
916 A list that will hold the button states for all requested buttons.
917 The function returns the number of actually returned buttons. This is the minimum of numbuttons and
918 the number of buttons supported by the joystick. If the joystick is not supported or connected, the
919 function will return 0 (zero).
922 The function queries the current state of one or more buttons of a joystick. The button states are
923 returned in an array, where the first element represents the first button of the joystick. Each state can be
924 either GLFW_PRESS or GLFW_RELEASE.
925 If numbuttons exceeds the number of buttons supported by the joystick, or if the joystick is not
926 available, the unused elements in the buttons array will be set to GLFW_RELEASE.
929 The joystick state is updated every time the function is called, so there is no need to call glfwPollEvents
930 or glfwWaitEvents for joystick state to be updated.
931 Use glfwGetJoystickParam to retrieve joystick capabilities, such as joystick availability and number of
933 No window has to be opened for joystick input to be valid.
935 (with-foreign-object (buttons :unsigned-char numbuttons
)
936 (let ((numbuttons (%get-joystick-buttons joy buttons numbuttons
)))
937 (loop for i below numbuttons collecting
(mem-aref buttons
:unsigned-char i
)))))
940 (defcfun+doc
("glfwGetTime" get-time
) :double
()
942 The function returns the value of the high precision timer. The time is measured in seconds, and is
943 returned as a double precision floating point value.
946 The function returns the state of a high precision timer. Unless the timer has been set by the
947 glfwSetTime function, the time is measured as the number of seconds that have passed since glfwInit
951 The resolution of the timer depends on which system the program is running on. The worst case
952 resolution is somewhere in the order of 10 ms, while for most systems the resolution should be better
956 (defcfun+doc
("glfwSetTime" set-time
) :void
((time :double
))
959 Time (in seconds) that the timer should be set to.
962 The function sets the current time of the high precision timer to the specified time. Subsequent calls to
963 glfwGetTime will be relative to this time. The time is given in seconds.
966 (defcfun+doc
("glfwSleep" sleep
) :void
((time :double
))
969 Time, in seconds, to sleep.
972 The function puts the calling thread to sleep for the requested period of time. Only the calling thread is
973 put to sleep. Other threads within the same process can still execute.
976 There is usually a system dependent minimum time for which it is possible to sleep. This time is
977 generally in the range 1 ms to 20 ms, depending on thread sheduling time slot intervals etc. Using a
978 shorter time as a parameter to glfwSleep can give one of two results: either the thread will sleep for the
979 minimum possible sleep time, or the thread will not sleep at all (glfwSleep returns immediately). The
980 latter should only happen when very short sleep times are specified, if at all. ")
986 (bytes-per-pixel :int
)
989 (defcfun+doc
("glfwReadImage" read-image
) boolean
990 ((name :string
) (img image
) (flags :int
))
993 A null terminated ISO 8859-1 string holding the name of the file that should be read.
995 Pointer to a GLFWimage struct, which will hold the information about the loaded image (if the
996 read was successful).
998 Flags for controlling the image reading process. Valid flags are listed in table 3.6
1000 The function returns t if the image was loaded successfully. Otherwise nil is
1003 The function reads an image from the file specified by the parameter name and returns the image
1004 information and data in a GLFWimage structure, which has the following definition:
1007 int Width, Height; // Image dimensions
1008 int Format; // OpenGL pixel format
1009 int BytesPerPixel; // Number of bytes per pixel
1010 unsigned char *Data; // Pointer to pixel data
1013 Width and Height give the dimensions of the image. Format specifies an OpenGL™ pixel format,
1014 which can be GL_LUMINANCE or GL_ALPHA (for gray scale images), GL_RGB or GL_RGBA.
1015 BytesPerPixel specifies the number of bytes per pixel. Data is a pointer to the actual pixel data.
1016 By default the read image is rescaled to the nearest larger 2m × 2n resolution using bilinear
1017 interpolation, if necessary, which is useful if the image is to be used as an OpenGL™ texture. This
1018 behavior can be disabled by setting the GLFW_NO_RESCALE_BIT flag.
1019 Unless the flag GLFW_ORIGIN_UL_BIT is set, the first pixel in img->Data is the lower left corner of
1020 the image. If the flag GLFW_ORIGIN_UL_BIT is set, however, the first pixel is the upper left corner.
1021 For single component images (i.e. gray scale), Format is set to GL_ALPHA if the flag
1022 GLFW_ALPHA_MAP_BIT flag is set, otherwise Format is set to GL_LUMINANCE.
1024 glfwReadImage supports the Truevision Targa version 1 file format (.TGA). Supported pixel formats
1025 are: 8-bit gray scale, 8-bit paletted (24/32-bit color), 24-bit true color and 32-bit true color + alpha.
1026 Paletted images are translated into true color or true color + alpha pixel formats.
1027 Please note that OpenGL™ 1.0 does not support single component alpha maps, so do not use images
1028 with Format = GL_ALPHA directly as textures under OpenGL™ 1.0.
1031 (defcfun+doc
("glfwReadMemoryImage" read-memory-image
) boolean
1032 ((data :pointer
) (size :long
) (img image
) (flags :int
))
1035 The memory buffer holding the contents of the file that should be read.
1037 The size, in bytes, of the memory buffer.
1039 Pointer to a GLFWimage struct, which will hold the information about the loaded image (if the
1040 read was successful).
1042 Flags for controlling the image reading process. Valid flags are listed in table 3.6
1044 The function returns t if the image was loaded successfully. Otherwise nil is
1047 The function reads an image from the memory buffer specified by the parameter data and returns the
1048 image information and data in a GLFWimage structure, which has the following definition:
1051 int Width, Height; // Image dimensions
1052 int Format; // OpenGL pixel format
1053 int BytesPerPixel; // Number of bytes per pixel
1054 unsigned char *Data; // Pointer to pixel data
1057 Width and Height give the dimensions of the image. Format specifies an OpenGL™ pixel format,
1058 which can be GL_LUMINANCE or GL_ALPHA (for gray scale images), GL_RGB or GL_RGBA.
1059 BytesPerPixel specifies the number of bytes per pixel. Data is a pointer to the actual pixel data.
1060 By default the read image is rescaled to the nearest larger 2m × 2n resolution using bilinear
1061 interpolation, if necessary, which is useful if the image is to be used as an OpenGL™ texture. This
1062 behavior can be disabled by setting the GLFW_NO_RESCALE_BIT flag.
1063 Unless the flag GLFW_ORIGIN_UL_BIT is set, the first pixel in img->Data is the lower left corner of
1064 the image. If the flag GLFW_ORIGIN_UL_BIT is set, however, the first pixel is the upper left corner.
1065 For single component images (i.e. gray scale), Format is set to GL_ALPHA if the flag
1066 GLFW_ALPHA_MAP_BIT flag is set, otherwise Format is set to GL_LUMINANCE.
1068 glfwReadMemoryImage supports the Truevision Targa version 1 file format (.TGA). Supported pixel
1069 formats are: 8-bit gray scale, 8-bit paletted (24/32-bit color), 24-bit true color and 32-bit true color +
1071 Paletted images are translated into true color or true color + alpha pixel formats.
1072 Please note that OpenGL™ 1.0 does not support single component alpha maps, so do not use images
1073 with Format = GL_ALPHA directly as textures under OpenGL™ 1.0.
1076 (defcfun+doc
("glfwFreeImage" free-image
) :void
((img image
))
1079 Pointer to a GLFWimage struct.
1081 The function frees any memory occupied by a loaded image, and clears all the fields of the GLFWimage
1082 struct. Any image that has been loaded by the glfwReadImage function should be deallocated using
1083 this function, once the image is not needed anymore. ")
1085 (defcfun+doc
("glfwLoadTexture2D" load-texture-2d
) boolean
((name :string
) (flags :int
))
1088 An ISO 8859-1 string holding the name of the file that should be loaded.
1090 Flags for controlling the texture loading process. Valid flags are listed in table 3.7.
1092 The function returns t if the texture was loaded successfully. Otherwise nil is
1096 The function reads an image from the file specified by the parameter name and uploads the image to
1097 OpenGL™ texture memory (using the glTexImage2D function).
1098 If the GLFW_BUILD_MIPMAPS_BIT flag is set, all mipmap levels for the loaded texture are
1099 generated and uploaded to texture memory.
1100 Unless the flag GLFW_ORIGIN_UL_BIT is set, the origin of the texture is the lower left corner of the
1101 loaded image. If the flag GLFW_ORIGIN_UL_BIT is set, however, the first pixel is the upper left
1103 For single component images (i.e. gray scale), the texture is uploaded as an alpha mask if the flag
1104 GLFW_ALPHA_MAP_BIT flag is set, otherwise it is uploaded as a luminance texture.
1107 glfwLoadTexture2D supports the Truevision Targa version 1 file format (.TGA). Supported pixel
1108 formats are: 8-bit gray scale, 8-bit paletted (24/32-bit color), 24-bit true color and 32-bit true color +
1110 Paletted images are translated into true color or true color + alpha pixel formats.
1111 The read texture is always rescaled to the nearest larger 2m × 2n resolution using bilinear interpolation,
1112 if necessary, since OpenGL™ requires textures to have a 2m × 2n resolution.
1113 If the GL_SGIS_generate_mipmap extension, which is usually hardware accelerated, is supported by
1114 the OpenGL™ implementation it will be used for mipmap generation. Otherwise the mipmaps will be
1115 generated by GLFW in software.
1116 Since OpenGL™ 1.0 does not support single component alpha maps, alpha map textures are converted
1117 to RGBA format under OpenGL™ 1.0 when the GLFW_ALPHA_MAP_BIT flag is set and the loaded
1118 texture is a single component texture. The red, green and blue components are set to 1.0.
1121 (defcfun+doc
("glfwLoadMemoryTexture2D" load-memory-texture-2d
) boolean
1122 ((data :pointer
) (size :long
) (flags :int
))
1125 The memory buffer holding the contents of the file that should be loaded.
1127 The size, in bytes, of the memory buffer.
1129 Flags for controlling the texture loading process. Valid flags are listed in table 3.7.
1131 The function returns t if the texture was loaded successfully. Otherwise nil is
1135 The function reads an image from the memory buffer specified by the parameter data and uploads the
1136 image to OpenGL™ texture memory (using the glTexImage2D function).
1137 If the GLFW_BUILD_MIPMAPS_BIT flag is set, all mipmap levels for the loaded texture are
1138 generated and uploaded to texture memory.
1139 Unless the flag GLFW_ORIGIN_UL_BIT is set, the origin of the texture is the lower left corner of the
1140 loaded image. If the flag GLFW_ORIGIN_UL_BIT is set, however, the first pixel is the upper left
1142 For single component images (i.e. gray scale), the texture is uploaded as an alpha mask if the flag
1143 GLFW_ALPHA_MAP_BIT flag is set, otherwise it is uploaded as a luminance texture.
1146 glfwLoadMemoryTexture2D supports the Truevision Targa version 1 file format (.TGA). Supported
1147 pixel formats are: 8-bit gray scale, 8-bit paletted (24/32-bit color), 24-bit true color and 32-bit true color
1149 Paletted images are translated into true color or true color + alpha pixel formats.
1150 The read texture is always rescaled to the nearest larger 2m × 2n resolution using bilinear interpolation,
1151 if necessary, since OpenGL™ requires textures to have a 2m × 2n resolution.
1152 If the GL_SGIS_generate_mipmap extension, which is usually hardware accelerated, is supported by
1153 the OpenGL™ implementation it will be used for mipmap generation. Otherwise the mipmaps will be
1154 generated by GLFW in software.
1155 Since OpenGL™ 1.0 does not support single component alpha maps, alpha map textures are converted
1156 to RGBA format under OpenGL™ 1.0 when the GLFW_ALPHA_MAP_BIT flag is set and the loaded
1157 texture is a single component texture. The red, green and blue components are set to 1.0.
1161 (defcfun+doc
("glfwLoadTextureImage2D" load-texture-image-2d
) boolean
((img image
)
1165 Pointer to a GLFWimage struct holding the information about the image to be loaded.
1167 Flags for controlling the texture loading process. Valid flags are listed in table 3.7.
1169 The function returns t if the texture was loaded successfully. Otherwise nil is
1173 The function uploads the image specified by the parameter img to OpenGL™ texture memory (using
1174 the glTexImage2D function).
1175 If the GLFW_BUILD_MIPMAPS_BIT flag is set, all mipmap levels for the loaded texture are
1176 generated and uploaded to texture memory.
1177 Unless the flag GLFW_ORIGIN_UL_BIT is set, the origin of the texture is the lower left corner of the
1178 loaded image. If the flag GLFW_ORIGIN_UL_BIT is set, however, the first pixel is the upper left
1180 For single component images (i.e. gray scale), the texture is uploaded as an alpha mask if the flag
1181 GLFW_ALPHA_MAP_BIT flag is set, otherwise it is uploaded as a luminance texture.
1184 glfwLoadTextureImage2D supports the Truevision Targa version 1 file format (.TGA). Supported
1185 pixel formats are: 8-bit gray scale, 8-bit paletted (24/32-bit color), 24-bit true color and 32-bit true color
1187 Paletted images are translated into true color or true color + alpha pixel formats.
1188 The read texture is always rescaled to the nearest larger 2m × 2n resolution using bilinear interpolation,
1189 if necessary, since OpenGL™ requires textures to have a 2m × 2n resolution.
1190 If the GL_SGIS_generate_mipmap extension, which is usually hardware accelerated, is supported by
1191 the OpenGL™ implementation it will be used for mipmap generation. Otherwise the mipmaps will be
1192 generated by GLFW in software.
1193 Since OpenGL™ 1.0 does not support single component alpha maps, alpha map textures are converted
1194 to RGBA format under OpenGL™ 1.0 when the GLFW_ALPHA_MAP_BIT flag is set and the loaded
1195 texture is a single component texture. The red, green and blue components are set to 1.0. ")
1198 (defcfun+doc
("glfwExtensionSupported" extension-supported
) boolean
((extension :string
))
1201 A null terminated ISO 8859-1 string containing the name of an OpenGL™ extension.
1203 The function returns t if the extension is supported. Otherwise it returns nil.
1205 The function does a string search in the list of supported OpenGL™ extensions to find if the specified
1206 extension is listed.
1208 An OpenGL™ context must be created before this function can be called (i.e. an OpenGL™ window
1209 must have been opened with glfwOpenWindow).
1210 In addition to checking for OpenGL™ extensions, GLFW also checks for extensions in the operating
1211 system “glue API”, such as WGL extensions under Windows and glX extensions under the X Window
1215 (defcfun+doc
("glfwGetProcAddress" get-proc-address
) :pointer
((procname :string
))
1218 A null terminated ISO 8859-1 string containing the name of an OpenGL™ extension function.
1220 The function returns the pointer to the specified OpenGL™ function if it is supported, otherwise
1223 The function acquires the pointer to an OpenGL™ extension function. Some (but not all) OpenGL™
1224 extensions define new API functions, which are usually not available through normal linking. It is
1225 therefore necessary to get access to those API functions at runtime.
1227 An OpenGL™ context must be created before this function can be called (i.e. an OpenGL™ window
1228 must have been opened with glfwOpenWindow).
1229 Some systems do not support dynamic function pointer retrieval, in which case glfwGetProcAddress
1230 will always return NULL.
1233 (defcfun+out
+doc
("glfwGetGLVersion" get-gl-version
) :void
((:out major
:int
)
1237 The function returns the major and minor version numbers and the revision for the currently used
1238 OpenGL™ implementation as a list (major minor rev).
1241 The function returns the OpenGL™ implementation version. This is a convenient function that parses
1242 the version number information from the string returned by calling
1243 glGetString( GL_VERSION ). The OpenGL™ version information can be used to determine
1244 what functionality is supported by the used OpenGL™ implementation.
1247 An OpenGL™ context must be created before this function can be called (i.e. an OpenGL™ window
1248 must have been opened with glfwOpenWindow). ")
1250 (defctype thread
:int
)
1251 (defctype threadfun
:pointer
)
1252 (defctype mutex
:pointer
)
1253 (defctype cond
:pointer
)
1255 (defcfun+doc
("glfwCreateThread" create-thread
) thread
((fun threadfun
) (arg :pointer
) )
1258 A pointer to a function that acts as the entry point for the new thread. The function should have
1259 the following C language prototype:
1260 void GLFWCALL functionname( void *arg );
1261 Where functionname is the name of the thread function, and arg is the user supplied argument
1264 An arbitrary argument for the thread. arg will be passed as the argument to the thread function
1265 pointed to by fun. For instance, arg can point to data that is to be processed by the thread.
1267 The function returns a thread identification number if the thread was created successfully. This number
1268 is always positive. If the function fails, a negative number is returned.
1270 The function creates a new thread, which executes within the same address space as the calling process.
1271 The thread entry point is specified with the fun argument.
1272 Once the thread function fun returns, the thread dies.
1274 Even if the function returns a positive thread ID, indicating that the thread was created successfully, the
1275 thread may be unable to execute, for instance if the thread start address is not a valid thread entry point.
1277 (defcfun+doc
("glfwDestroyThread" destroy-thread
) :void
((id thread
))
1280 A thread identification handle, which is returned by glfwCreateThread or glfwGetThreadID.
1282 The function kills a running thread and removes it from the thread list.
1284 This function is a very dangerous operation, which may interrupt a thread in the middle of an important
1285 operation, and its use is discouraged. You should always try to end a thread in a graceful way using
1286 thread communication, and use glfwWaitThread in order to wait for the thread to die.
1288 (defcfun+doc
("glfwWaitThread" wait-thread
) boolean
((id thread
) (waitmode :int
) )
1291 A thread identification handle, which is returned by glfwCreateThread or glfwGetThreadID.
1293 Can be either GLFW_WAIT or GLFW_NOWAIT.
1295 The function returns t if the specified thread died after the function was called, or the thread
1296 did not exist, in which case glfwWaitThread will return immediately regardless of waitmode. The
1297 function returns nil if waitmode is GLFW_NOWAIT, and the specified thread exists and is still
1300 (defcfun+doc
("glfwGetThreadID" get-thread-id
) thread
()
1302 The function returns a thread identification handle for the calling thread.
1304 The function determines the thread ID for the calling thread. The ID is the same value as was returned
1305 by glfwCreateThread when the thread was created.
1308 (defcfun+doc
("glfwCreateMutex" create-mutex
) mutex
()
1310 The function returns a mutex handle, or NULL if the mutex could not be created.
1312 The function creates a mutex object, which can be used to control access to data that is shared between
1315 (defcfun+doc
("glfwDestroyMutex" destroy-mutex
) :void
((mutex mutex
))
1318 A mutex object handle.
1320 The function destroys a mutex object. After a mutex object has been destroyed, it may no longer be
1323 (defcfun+doc
("glfwLockMutex" lock-mutex
) :void
((mutex mutex
))
1326 A mutex object handle.
1328 The function will acquire a lock on the selected mutex object. If the mutex is already locked by another
1329 thread, the function will block the calling thread until it is released by the locking thread. Once the
1330 function returns, the calling thread has an exclusive lock on the mutex. To release the mutex, call
1333 (defcfun+doc
("glfwUnlockMutex" unlock-mutex
) :void
((mutex mutex
))
1336 A mutex object handle.
1338 The function releases the lock of a locked mutex object.
1341 (defmacro with-lock-mutex
(mutex &body forms
)
1344 A mutex object handle.
1346 Body of code to execute
1348 This macro will acquire a lock on the selected mutex object using glfwLockMutex and release it afterwards
1349 using glfwUnlockMutex.
1350 So, forms will not execute until an exclusive lock is held.
1351 The lock is then released when the stack is unwound."
1352 (let ((smutex (gensym "MUTEX-")))
1353 `(let ((,smutex
,mutex
))
1354 (glfw:lock-mutex
,smutex
)
1355 (unwind-protect (progn ,@forms
)
1356 (glfw:unlock-mutex
,smutex
)))))
1358 (defcfun+doc
("glfwCreateCond" create-cond
) cond
()
1360 The function returns a condition variable handle, or NULL if the condition variable could not be
1363 The function creates a condition variable object, which can be used to synchronize threads.
1365 (defcfun+doc
("glfwDestroyCond" destroy-cond
) :void
((cond cond
))
1368 A condition variable object handle.
1370 The function destroys a condition variable object. After a condition variable object has been destroyed,
1371 it may no longer be used by any thread.
1373 (defcfun+doc
("glfwWaitCond" wait-cond
) :void
((cond cond
) (mutex mutex
) (timeout :double
))
1376 A condition variable object handle.
1378 A mutex object handle.
1380 Maximum time to wait for the condition variable. The parameter can either be a positive time (in
1381 seconds), or GLFW_INFINITY.
1383 The function atomically unlocks the mutex specified by mutex, and waits for the condition variable cond
1384 to be signaled. The thread execution is suspended and does not consume any CPU time until the
1385 condition variable is signaled or the amount of time specified by timeout has passed. If timeout is
1386 GLFW_INFINITY, glfwWaitCond will wait forever for cond to be signaled. Before returning to the
1387 calling thread, glfwWaitCond automatically re-acquires the mutex.
1389 The mutex specified by mutex must be locked by the calling thread before entrance to glfwWaitCond.
1390 A condition variable must always be associated with a mutex, to avoid the race condition where a thread
1391 prepares to wait on a condition variable and another thread signals the condition just before the first
1392 thread actually waits on it.
1394 (defcfun+doc
("glfwSignalCond" signal-cond
) :void
((cond cond
))
1397 A condition variable object handle.
1399 The function restarts one of the threads that are waiting on the condition variable cond. If no threads are
1400 waiting on cond, nothing happens. If several threads are waiting on cond, exactly one is restarted, but it
1401 is not specified which.
1403 When several threads are waiting for the condition variable, which thread is started depends on
1404 operating system scheduling rules, and may vary from system to system and from time to time.
1406 (defcfun+doc
("glfwBroadcastCond" broadcast-cond
) :void
((cond cond
))
1409 A condition variable object handle.
1411 The function restarts all the threads that are waiting on the condition variable cond. If no threads are
1412 waiting on cond, nothing happens.
1414 When several threads are waiting for the condition variable, the order in which threads are started
1415 depends on operating system scheduling rules, and may vary from system to system and from time to
1419 (defcfun+doc
("glfwGetNumberOfProcessors" get-number-of-processors
) :int
()
1421 The function returns the number of active processors in the system.
1423 The function determines the number of active processors in the system.
1425 Systems with several logical processors per physical processor, also known as SMT (Symmetric Multi
1426 Threading) processors, will report the number of logical processors.
1428 (defcfun+doc
("glfwEnable" enable
) :void
((token :int
))
1431 A value specifying a feature to enable or disable. Valid tokens are listed in table 3.8.
1435 glfwEnable is used to enable a certain feature, while glfwDisable is used to disable it. Below follows a
1436 description of each feature.
1437 GLFW_AUTO_POLL_EVENTS
1438 When GLFW_AUTO_POLL_EVENTS is enabled, glfwPollEvents is automatically called each time
1439 that glfwSwapBuffers is called.
1440 When GLFW_AUTO_POLL_EVENTS is disabled, calling glfwSwapBuffers will not result in a call to
1441 glfwPollEvents. This can be useful if glfwSwapBuffers needs to be called from within a callback
1442 function, since calling glfwPollEvents from a callback function is not allowed.
1444 When GLFW_KEY_REPEAT is enabled, the key and character callback functions are called repeatedly
1445 when a key is held down long enough (according to the system key repeat configuration).
1446 When GLFW_KEY_REPEAT is disabled, the key and character callback functions are only called once
1447 when a key is pressed (and once when it is released).
1449 When GLFW_MOUSE_CURSOR is enabled, the mouse cursor is visible, and mouse coordinates are
1450 relative to the upper left corner of the client area of the GLFW window. The coordinates are limited to
1451 the client area of the window.
1452 When GLFW_MOUSE_CURSOR is disabled, the mouse cursor is invisible, and mouse coordinates are
1453 not limited to the drawing area of the window. It is as if the mouse coordinates are recieved directly
1454 from the mouse, without being restricted or manipulated by the windowing system.
1456 When GLFW_STICKY_KEYS is enabled, keys which are pressed will not be released until they are
1457 physically released and checked with glfwGetKey. This behavior makes it possible to catch keys that
1458 were pressed and then released again between two calls to glfwPollEvents, glfwWaitEvents or
1459 glfwSwapBuffers, which would otherwise have been reported as released. Care should be taken when
1460 using this mode, since keys that are not checked with glfwGetKey will never be released. Note also that
1461 enabling GLFW_STICKY_KEYS does not affect the behavior of the keyboard callback functionality.
1462 When GLFW_STICKY_KEYS is disabled, the status of a key that is reported by glfwGetKey is always
1463 the physical state of the key. Disabling GLFW_STICKY_KEYS also clears the sticky information for
1465 GLFW_STICKY_MOUSE_BUTTONS
1466 When GLFW_STICKY_MOUSE_BUTTONS is enabled, mouse buttons that are pressed will not be
1467 released until they are physically released and checked with glfwGetMouseButton. This behavior
1468 makes it possible to catch mouse buttons which were pressed and then released again between two calls
1469 to glfwPollEvents, glfwWaitEvents or glfwSwapBuffers, which would otherwise have been reported
1470 as released. Care should be taken when using this mode, since mouse buttons that are not checked with
1471 glfwGetMouseButton will never be released. Note also that enabling
1472 GLFW_STICKY_MOUSE_BUTTONS does not affect the behavior of the mouse button callback
1474 When GLFW_STICKY_MOUSE_BUTTONS is disabled, the status of a mouse button that is reported
1475 by glfwGetMouseButton is always the physical state of the mouse button. Disabling
1476 GLFW_STICKY_MOUSE_BUTTONS also clears the sticky information for all mouse buttons.
1478 When GLFW_SYSTEM_KEYS is enabled, pressing standard system key combinations, such as
1479 ALT+TAB under Windows, will give the normal behavior. Note that when ALT+TAB is issued under
1480 Windows in this mode so that the GLFW application is deselected when GLFW is operating in
1481 fullscreen mode, the GLFW application window will be minimized and the video mode will be set to
1482 the original desktop mode. When the GLFW application is re-selected, the video mode will be set to
1483 the GLFW video mode again.
1484 When GLFW_SYSTEM_KEYS is disabled, pressing standard system key combinations will have no
1485 effect, since those key combinations are blocked by GLFW. This mode can be useful in situations when
1486 the GLFW program must not be interrupted (normally for games in fullscreen mode).
1488 (defcfun+doc
("glfwDisable" disable
) :void
((token :int
))
1491 A value specifying a feature to enable or disable. Valid tokens are listed in table 3.8.
1495 glfwEnable is used to enable a certain feature, while glfwDisable is used to disable it. Below follows a
1496 description of each feature.
1497 GLFW_AUTO_POLL_EVENTS
1498 When GLFW_AUTO_POLL_EVENTS is enabled, glfwPollEvents is automatically called each time
1499 that glfwSwapBuffers is called.
1500 When GLFW_AUTO_POLL_EVENTS is disabled, calling glfwSwapBuffers will not result in a call to
1501 glfwPollEvents. This can be useful if glfwSwapBuffers needs to be called from within a callback
1502 function, since calling glfwPollEvents from a callback function is not allowed.
1504 When GLFW_KEY_REPEAT is enabled, the key and character callback functions are called repeatedly
1505 when a key is held down long enough (according to the system key repeat configuration).
1506 When GLFW_KEY_REPEAT is disabled, the key and character callback functions are only called once
1507 when a key is pressed (and once when it is released).
1509 When GLFW_MOUSE_CURSOR is enabled, the mouse cursor is visible, and mouse coordinates are
1510 relative to the upper left corner of the client area of the GLFW window. The coordinates are limited to
1511 the client area of the window.
1512 When GLFW_MOUSE_CURSOR is disabled, the mouse cursor is invisible, and mouse coordinates are
1513 not limited to the drawing area of the window. It is as if the mouse coordinates are recieved directly
1514 from the mouse, without being restricted or manipulated by the windowing system.
1516 When GLFW_STICKY_KEYS is enabled, keys which are pressed will not be released until they are
1517 physically released and checked with glfwGetKey. This behavior makes it possible to catch keys that
1518 were pressed and then released again between two calls to glfwPollEvents, glfwWaitEvents or
1519 glfwSwapBuffers, which would otherwise have been reported as released. Care should be taken when
1520 using this mode, since keys that are not checked with glfwGetKey will never be released. Note also that
1521 enabling GLFW_STICKY_KEYS does not affect the behavior of the keyboard callback functionality.
1522 When GLFW_STICKY_KEYS is disabled, the status of a key that is reported by glfwGetKey is always
1523 the physical state of the key. Disabling GLFW_STICKY_KEYS also clears the sticky information for
1525 GLFW_STICKY_MOUSE_BUTTONS
1526 When GLFW_STICKY_MOUSE_BUTTONS is enabled, mouse buttons that are pressed will not be
1527 released until they are physically released and checked with glfwGetMouseButton. This behavior
1528 makes it possible to catch mouse buttons which were pressed and then released again between two calls
1529 to glfwPollEvents, glfwWaitEvents or glfwSwapBuffers, which would otherwise have been reported
1530 as released. Care should be taken when using this mode, since mouse buttons that are not checked with
1531 glfwGetMouseButton will never be released. Note also that enabling
1532 GLFW_STICKY_MOUSE_BUTTONS does not affect the behavior of the mouse button callback
1534 When GLFW_STICKY_MOUSE_BUTTONS is disabled, the status of a mouse button that is reported
1535 by glfwGetMouseButton is always the physical state of the mouse button. Disabling
1536 GLFW_STICKY_MOUSE_BUTTONS also clears the sticky information for all mouse buttons.
1538 When GLFW_SYSTEM_KEYS is enabled, pressing standard system key combinations, such as
1539 ALT+TAB under Windows, will give the normal behavior. Note that when ALT+TAB is issued under
1540 Windows in this mode so that the GLFW application is deselected when GLFW is operating in
1541 fullscreen mode, the GLFW application window will be minimized and the video mode will be set to
1542 the original desktop mode. When the GLFW application is re-selected, the video mode will be set to
1543 the GLFW video mode again.
1544 When GLFW_SYSTEM_KEYS is disabled, pressing standard system key combinations will have no
1545 effect, since those key combinations are blocked by GLFW. This mode can be useful in situations when
1546 the GLFW program must not be interrupted (normally for games in fullscreen mode).