opengl-bindings 1.3.11 → 1.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13781a8f89d5b8367c81ff8c03221744955cb5fb
4
- data.tar.gz: adf8d152fcee5041a88a9682ac84a9acc396d2c1
3
+ metadata.gz: ef07d2f918e6b8ece43c2ad895956ba24452e81f
4
+ data.tar.gz: ef617e65da99e1b43a93d53bf679c4e8e9811ff9
5
5
  SHA512:
6
- metadata.gz: 820b4c37be260e30830ec7ebae9496414c4a36d691ffab061ea39728aa905e76b650d6dab4894a107de7c650d8ac5bc46291944dd31816101953f797ca0b762f
7
- data.tar.gz: b060716ba921e0fff62107a3cee94c35e63c3adf3d962ca29e4ff7f65a9a598a6d3bee21cb3eb656f6aaf59ad0fde99ea6db64cff9f2999399aefb0206851487
6
+ metadata.gz: 2864c73393860f3bde7f4615da3ec071029f559232da523a3ef11e6ef4ac7bad0792cf7e17d0d1181c9ab3d1b0ee0293526b3e49bfab8d44506ddc0d1b1ebb0d
7
+ data.tar.gz: dea66231f174acec6822853bd14384b6114f2b74293a423d0bdf80ce7cbc5029ccd440509dc7c24a833ad2fc1f6aa0c3ff916e844fa2ac394257f86b6ffcad6c
data/ChangeLog CHANGED
@@ -1,3 +1,32 @@
1
+ 2015-03-27 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * Updated using latest gl.xml.
4
+
5
+ 2015-03-15 vaiorabbit <http://twitter.com/vaiorabbit>
6
+
7
+ * Updated using latest gl.xml.
8
+
9
+ 2015-02-03 vaiorabbit <http://twitter.com/vaiorabbit>
10
+
11
+ * Updated using latest gl.xml.
12
+
13
+ 2015-01-27 vaiorabbit <http://twitter.com/vaiorabbit>
14
+
15
+ * Updated using latest gl.xml.
16
+
17
+ 2015-01-25 vaiorabbit <http://twitter.com/vaiorabbit>
18
+
19
+ * glfw.rb: Added GLFW 3.1 features ( http://www.glfw.org/docs/latest/news.html#news_31 ).
20
+ * glfw30.rb: Previous version of 'glfw.rb' is available as 'glfw30.rb'.
21
+
22
+ 2015-01-22 vaiorabbit <http://twitter.com/vaiorabbit>
23
+
24
+ * Updated using latest gl.xml.
25
+
26
+ 2015-01-14 vaiorabbit <https://twitter.com/vaiorabbit>
27
+
28
+ * Updated using latest gl.xml.
29
+
1
30
  2015-01-06 vaiorabbit <https://twitter.com/vaiorabbit>
2
31
 
3
32
  * Updated using latest gl.xml.
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ...and wrapper code generator.
6
6
 
7
7
  * Created : 2013-08-28
8
- * Last modified : 2015-01-06
8
+ * Last modified : 2015-03-27
9
9
 
10
10
 
11
11
  ## Features ##
@@ -42,27 +42,27 @@ https://github.com/vaiorabbit/ruby-opengl
42
42
  * 'opengl.rb' includes these scripts:
43
43
  * 'opengl_command.rb' : OpenGL command wrapper (glDrawRangeElements, etc.). Generated via generator/generate_command.rb.
44
44
  * 'opengl_enum.rb' : OpenGL enum wrapper (GL_TRIANGLE_STRIP, etc.). Generated via generator/generate_enum.rb.
45
- * 'opengl_common.rb' : Provides utilitiy funcitions.
46
- * 'opengl_platform.rb' : Provides platform check funcitions (OpneGL.get_platform).
47
- * 'opengl_windows.rb' : Provides funcitions for Windows platform (wglGetProcAddress).
45
+ * 'opengl_common.rb' : Provides utility functions.
46
+ * 'opengl_platform.rb' : Provides platform check functions (OpneGL.get_platform).
47
+ * 'opengl_windows.rb' : Provides functions for Windows platform (wglGetProcAddress).
48
48
 
49
49
  * 'opengl_es.rb' is almost the same with 'opengl.rb', except for including 'opengl_es_command.rb' and 'opengl_es_enum.rb'.
50
50
 
51
51
  * 'opengl_ext.rb' includes these scripts:
52
52
  * 'opengl_ext_command.rb' : OpenGL extension command wrapper. Generated via generator/generate_ext_command.rb.
53
53
  * 'opengl_ext_enum.rb' : OpenGL extension enum wrapper Generated via generator/generate_ext_enum.rb.
54
- * 'opengl_ext_common.rb' : Provides utilitiy funcitions.
54
+ * 'opengl_ext_common.rb' : Provides utility functions.
55
55
 
56
56
  * 'opengl_es_ext.rb' is almost the same with 'opengl_ext.rb', except for including 'opengl_es_ext_command.rb' and 'opengl_es_ext_enum.rb'.
57
57
 
58
58
  * 'glfw.rb'
59
- * My handwirtten GLFW wrapper.
59
+ * My handwritten GLFW wrapper.
60
60
 
61
61
  * 'glut.rb'
62
62
  * GLUT wrapper. Supports API Level 4 (GLUT_API_VERSION = 4).
63
63
 
64
64
  * 'glu.rb'
65
- * My handwirtten GLU wrapper.
65
+ * My handwritten GLU wrapper.
66
66
 
67
67
  * 'generator/gl.xml'
68
68
  * Khronos' official XML API registry for OpenGL.
@@ -108,6 +108,8 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
108
108
  ## Tested Environment ##
109
109
 
110
110
  * Ruby
111
+ * ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
112
+ * ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
111
113
  * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
112
114
  * ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
113
115
  * ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
@@ -165,7 +167,7 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
165
167
 
166
168
  The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
167
169
 
168
- Copyright (c) 2013-2014 vaiorabbit <http://twitter.com/vaiorabbit>
170
+ Copyright (c) 2013-2015 vaiorabbit <http://twitter.com/vaiorabbit>
169
171
 
170
172
  This software is provided 'as-is', without any express or implied
171
173
  warranty. In no event will the authors be held liable for any damages
@@ -291,6 +293,8 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
291
293
  ## テストした環境 ##
292
294
 
293
295
  * Ruby
296
+ * ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
297
+ * ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
294
298
  * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
295
299
  * ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
296
300
  * ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
data/lib/glfw.rb CHANGED
@@ -35,8 +35,8 @@ module GLFW
35
35
 
36
36
  # defines
37
37
  GLFW_VERSION_MAJOR = 3
38
- GLFW_VERSION_MINOR = 0
39
- GLFW_VERSION_REVISION = 1
38
+ GLFW_VERSION_MINOR = 1
39
+ GLFW_VERSION_REVISION = 0
40
40
 
41
41
  GLFW_RELEASE = 0
42
42
  GLFW_PRESS = 1
@@ -213,11 +213,13 @@ module GLFW
213
213
  GLFW_PLATFORM_ERROR = 0x00010008
214
214
  GLFW_FORMAT_UNAVAILABLE = 0x00010009
215
215
 
216
- GLFW_FOCUSED = 0x00020001
217
- GLFW_ICONIFIED = 0x00020002
218
- GLFW_RESIZABLE = 0x00020003
219
- GLFW_VISIBLE = 0x00020004
220
- GLFW_DECORATED = 0x00020005
216
+ GLFW_FOCUSED = 0x00020001
217
+ GLFW_ICONIFIED = 0x00020002
218
+ GLFW_RESIZABLE = 0x00020003
219
+ GLFW_VISIBLE = 0x00020004
220
+ GLFW_DECORATED = 0x00020005
221
+ GLFW_AUTO_ICONIFY = 0x00020006
222
+ GLFW_FLOATING = 0x00020007
221
223
 
222
224
  GLFW_RED_BITS = 0x00021001
223
225
  GLFW_GREEN_BITS = 0x00021002
@@ -234,15 +236,17 @@ module GLFW
234
236
  GLFW_SAMPLES = 0x0002100D
235
237
  GLFW_SRGB_CAPABLE = 0x0002100E
236
238
  GLFW_REFRESH_RATE = 0x0002100F
239
+ GLFW_DOUBLEBUFFER = 0x00021010
237
240
 
238
- GLFW_CLIENT_API = 0x00022001
239
- GLFW_CONTEXT_VERSION_MAJOR = 0x00022002
240
- GLFW_CONTEXT_VERSION_MINOR = 0x00022003
241
- GLFW_CONTEXT_REVISION = 0x00022004
242
- GLFW_CONTEXT_ROBUSTNESS = 0x00022005
243
- GLFW_OPENGL_FORWARD_COMPAT = 0x00022006
244
- GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
245
- GLFW_OPENGL_PROFILE = 0x00022008
241
+ GLFW_CLIENT_API = 0x00022001
242
+ GLFW_CONTEXT_VERSION_MAJOR = 0x00022002
243
+ GLFW_CONTEXT_VERSION_MINOR = 0x00022003
244
+ GLFW_CONTEXT_REVISION = 0x00022004
245
+ GLFW_CONTEXT_ROBUSTNESS = 0x00022005
246
+ GLFW_OPENGL_FORWARD_COMPAT = 0x00022006
247
+ GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
248
+ GLFW_OPENGL_PROFILE = 0x00022008
249
+ GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x00022009
246
250
 
247
251
  GLFW_OPENGL_API = 0x00030001
248
252
  GLFW_OPENGL_ES_API = 0x00030002
@@ -263,9 +267,22 @@ module GLFW
263
267
  GLFW_CURSOR_HIDDEN = 0x00034002
264
268
  GLFW_CURSOR_DISABLED = 0x00034003
265
269
 
270
+ GLFW_ANY_RELEASE_BEHAVIOR = 0
271
+ GLFW_RELEASE_BEHAVIOR_FLUSH = 0x00035001
272
+ GLFW_RELEASE_BEHAVIOR_NONE = 0x00035002
273
+
274
+ GLFW_ARROW_CURSOR = 0x00036001
275
+ GLFW_IBEAM_CURSOR = 0x00036002
276
+ GLFW_CROSSHAIR_CURSOR = 0x00036003
277
+ GLFW_HAND_CURSOR = 0x00036004
278
+ GLFW_HRESIZE_CURSOR = 0x00036005
279
+ GLFW_VRESIZE_CURSOR = 0x00036006
280
+
266
281
  GLFW_CONNECTED = 0x00040001
267
282
  GLFW_DISCONNECTED = 0x00040002
268
283
 
284
+ GLFW_DONT_CARE = -1
285
+
269
286
  # typedefs
270
287
  @@glfw_cb_signature = {
271
288
  :GLFWglproc => "void GLFWglproc()",
@@ -283,6 +300,8 @@ module GLFW
283
300
  :GLFWscrollfun => "void GLFWscrollfun(void*,double,double)",
284
301
  :GLFWkeyfun => "void GLFWkeyfun(void*,int,int,int,int)",
285
302
  :GLFWcharfun => "void GLFWcharfun(void*,unsigned int)",
303
+ :GLFWcharmodsfun => "void GLFWcharmodsfun(void*,unsigned int,int)",
304
+ :GLFWdropfun => "void GLFWdropfun(void*,int,const char**)",
286
305
  :GLFWmonitorfun => "void GLFWmonitorfun(void*,int)",
287
306
  }
288
307
 
@@ -307,6 +326,10 @@ module GLFW
307
326
  "unsigned short* blue",
308
327
  "unsigned int size"])
309
328
 
329
+ GLFWimage = struct(["int width",
330
+ "int height",
331
+ "unsigned char* pixels"])
332
+
310
333
  @@glfw_import_done = false
311
334
 
312
335
  # Load native library.
@@ -356,6 +379,7 @@ module GLFW
356
379
  extern 'void glfwGetWindowSize(void*, int*, int*)'
357
380
  extern 'void glfwSetWindowSize(void*, int, int)'
358
381
  extern 'void glfwGetFramebufferSize(void*, int*, int*)'
382
+ extern 'void glfwGetWindowFrameSize(void*, int*, int*, int*, int*)'
359
383
  extern 'void glfwIconifyWindow(void*)'
360
384
  extern 'void glfwRestoreWindow(void*)'
361
385
  extern 'void glfwShowWindow(void*)'
@@ -373,18 +397,25 @@ module GLFW
373
397
  extern 'void* glfwSetFramebufferSizeCallback(void*, void*)'
374
398
  extern 'void glfwPollEvents()'
375
399
  extern 'void glfwWaitEvents()'
400
+ extern 'void glfwPostEmptyEvent()'
376
401
  extern 'int glfwGetInputMode(void*, int)'
377
402
  extern 'void glfwSetInputMode(void*, int, int)'
378
403
  extern 'int glfwGetKey(void*, int)'
379
404
  extern 'int glfwGetMouseButton(void*, int)'
380
405
  extern 'void glfwGetCursorPos(void*, void*, void*)'
381
406
  extern 'void glfwSetCursorPos(void*, double, double)'
407
+ extern 'void* glfwCreateCursor(void*, int, int)'
408
+ extern 'void* glfwCreateStandardCursor(int)'
409
+ extern 'void glfwDestroyCursor(void*)'
410
+ extern 'void glfwSetCursor(void*, void*)'
382
411
  extern 'void* glfwSetKeyCallback(void*, void*)'
383
412
  extern 'void* glfwSetCharCallback(void*, void*)'
413
+ extern 'void* glfwSetCharModsCallback(void*, void*)'
384
414
  extern 'void* glfwSetMouseButtonCallback(void*, void*)'
385
415
  extern 'void* glfwSetCursorPosCallback(void*, void*)'
386
416
  extern 'void* glfwSetCursorEnterCallback(void*, void*)'
387
417
  extern 'void* glfwSetScrollCallback(void*, void*)'
418
+ extern 'void* glfwSetDropCallback(void*, void*)'
388
419
  extern 'int glfwJoystickPresent(int)'
389
420
  extern 'const float* glfwGetJoystickAxes(int, int*)'
390
421
  extern 'const unsigned char* glfwGetJoystickButtons(int, int*)'
data/lib/glfw30.rb ADDED
@@ -0,0 +1,406 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'fiddle/import'
3
+
4
+ module GLFW
5
+
6
+ extend Fiddle::Importer
7
+
8
+ #
9
+ # Fiddle's default 'extern' stores all methods into local variable '@func_map', that makes difficult to 'include GLFW'.
10
+ # So I override it and replace '@func_map' into 'GLFW_FUNCTIONS_MAP'.
11
+ # Ref.: /lib/ruby/2.0.0/fiddle/import.rb
12
+ #
13
+ GLFW_FUNCTIONS_MAP = {}
14
+ def self.extern(signature, *opts)
15
+ symname, ctype, argtype = parse_signature(signature, @type_alias)
16
+ opt = parse_bind_options(opts)
17
+ f = import_function(symname, ctype, argtype, opt[:call_type])
18
+ name = symname.gsub(/@.+/,'')
19
+ GLFW_FUNCTIONS_MAP[name] = f
20
+ begin
21
+ /^(.+?):(\d+)/ =~ caller.first
22
+ file, line = $1, $2.to_i
23
+ rescue
24
+ file, line = __FILE__, __LINE__+3
25
+ end
26
+ args_str="*args"
27
+ module_eval(<<-EOS, file, line)
28
+ def #{name}(*args, &block)
29
+ GLFW_FUNCTIONS_MAP['#{name}'].call(*args,&block)
30
+ end
31
+ EOS
32
+ module_function(name)
33
+ f
34
+ end
35
+
36
+ # defines
37
+ GLFW_VERSION_MAJOR = 3
38
+ GLFW_VERSION_MINOR = 0
39
+ GLFW_VERSION_REVISION = 1
40
+
41
+ GLFW_RELEASE = 0
42
+ GLFW_PRESS = 1
43
+ GLFW_REPEAT = 2
44
+
45
+ GLFW_KEY_UNKNOWN = -1
46
+
47
+ GLFW_KEY_SPACE = 32
48
+ GLFW_KEY_APOSTROPHE = 39 # '
49
+ GLFW_KEY_COMMA = 44 # ,
50
+ GLFW_KEY_MINUS = 45 # -
51
+ GLFW_KEY_PERIOD = 46 # .
52
+ GLFW_KEY_SLASH = 47 # /
53
+ GLFW_KEY_0 = 48
54
+ GLFW_KEY_1 = 49
55
+ GLFW_KEY_2 = 50
56
+ GLFW_KEY_3 = 51
57
+ GLFW_KEY_4 = 52
58
+ GLFW_KEY_5 = 53
59
+ GLFW_KEY_6 = 54
60
+ GLFW_KEY_7 = 55
61
+ GLFW_KEY_8 = 56
62
+ GLFW_KEY_9 = 57
63
+ GLFW_KEY_SEMICOLON = 59 # ;
64
+ GLFW_KEY_EQUAL = 61 # =
65
+ GLFW_KEY_A = 65
66
+ GLFW_KEY_B = 66
67
+ GLFW_KEY_C = 67
68
+ GLFW_KEY_D = 68
69
+ GLFW_KEY_E = 69
70
+ GLFW_KEY_F = 70
71
+ GLFW_KEY_G = 71
72
+ GLFW_KEY_H = 72
73
+ GLFW_KEY_I = 73
74
+ GLFW_KEY_J = 74
75
+ GLFW_KEY_K = 75
76
+ GLFW_KEY_L = 76
77
+ GLFW_KEY_M = 77
78
+ GLFW_KEY_N = 78
79
+ GLFW_KEY_O = 79
80
+ GLFW_KEY_P = 80
81
+ GLFW_KEY_Q = 81
82
+ GLFW_KEY_R = 82
83
+ GLFW_KEY_S = 83
84
+ GLFW_KEY_T = 84
85
+ GLFW_KEY_U = 85
86
+ GLFW_KEY_V = 86
87
+ GLFW_KEY_W = 87
88
+ GLFW_KEY_X = 88
89
+ GLFW_KEY_Y = 89
90
+ GLFW_KEY_Z = 90
91
+ GLFW_KEY_LEFT_BRACKET = 91 # [
92
+ GLFW_KEY_BACKSLASH = 92 # \
93
+ GLFW_KEY_RIGHT_BRACKET = 93 # ]
94
+ GLFW_KEY_GRAVE_ACCENT = 96 # `
95
+ GLFW_KEY_WORLD_1 = 161 # non-US #1
96
+ GLFW_KEY_WORLD_2 = 162 # non-US #2
97
+
98
+ GLFW_KEY_ESCAPE = 256
99
+ GLFW_KEY_ENTER = 257
100
+ GLFW_KEY_TAB = 258
101
+ GLFW_KEY_BACKSPACE = 259
102
+ GLFW_KEY_INSERT = 260
103
+ GLFW_KEY_DELETE = 261
104
+ GLFW_KEY_RIGHT = 262
105
+ GLFW_KEY_LEFT = 263
106
+ GLFW_KEY_DOWN = 264
107
+ GLFW_KEY_UP = 265
108
+ GLFW_KEY_PAGE_UP = 266
109
+ GLFW_KEY_PAGE_DOWN = 267
110
+ GLFW_KEY_HOME = 268
111
+ GLFW_KEY_END = 269
112
+ GLFW_KEY_CAPS_LOCK = 280
113
+ GLFW_KEY_SCROLL_LOCK = 281
114
+ GLFW_KEY_NUM_LOCK = 282
115
+ GLFW_KEY_PRINT_SCREEN = 283
116
+ GLFW_KEY_PAUSE = 284
117
+ GLFW_KEY_F1 = 290
118
+ GLFW_KEY_F2 = 291
119
+ GLFW_KEY_F3 = 292
120
+ GLFW_KEY_F4 = 293
121
+ GLFW_KEY_F5 = 294
122
+ GLFW_KEY_F6 = 295
123
+ GLFW_KEY_F7 = 296
124
+ GLFW_KEY_F8 = 297
125
+ GLFW_KEY_F9 = 298
126
+ GLFW_KEY_F10 = 299
127
+ GLFW_KEY_F11 = 300
128
+ GLFW_KEY_F12 = 301
129
+ GLFW_KEY_F13 = 302
130
+ GLFW_KEY_F14 = 303
131
+ GLFW_KEY_F15 = 304
132
+ GLFW_KEY_F16 = 305
133
+ GLFW_KEY_F17 = 306
134
+ GLFW_KEY_F18 = 307
135
+ GLFW_KEY_F19 = 308
136
+ GLFW_KEY_F20 = 309
137
+ GLFW_KEY_F21 = 310
138
+ GLFW_KEY_F22 = 311
139
+ GLFW_KEY_F23 = 312
140
+ GLFW_KEY_F24 = 313
141
+ GLFW_KEY_F25 = 314
142
+ GLFW_KEY_KP_0 = 320
143
+ GLFW_KEY_KP_1 = 321
144
+ GLFW_KEY_KP_2 = 322
145
+ GLFW_KEY_KP_3 = 323
146
+ GLFW_KEY_KP_4 = 324
147
+ GLFW_KEY_KP_5 = 325
148
+ GLFW_KEY_KP_6 = 326
149
+ GLFW_KEY_KP_7 = 327
150
+ GLFW_KEY_KP_8 = 328
151
+ GLFW_KEY_KP_9 = 329
152
+ GLFW_KEY_KP_DECIMAL = 330
153
+ GLFW_KEY_KP_DIVIDE = 331
154
+ GLFW_KEY_KP_MULTIPLY = 332
155
+ GLFW_KEY_KP_SUBTRACT = 333
156
+ GLFW_KEY_KP_ADD = 334
157
+ GLFW_KEY_KP_ENTER = 335
158
+ GLFW_KEY_KP_EQUAL = 336
159
+ GLFW_KEY_LEFT_SHIFT = 340
160
+ GLFW_KEY_LEFT_CONTROL = 341
161
+ GLFW_KEY_LEFT_ALT = 342
162
+ GLFW_KEY_LEFT_SUPER = 343
163
+ GLFW_KEY_RIGHT_SHIFT = 344
164
+ GLFW_KEY_RIGHT_CONTROL = 345
165
+ GLFW_KEY_RIGHT_ALT = 346
166
+ GLFW_KEY_RIGHT_SUPER = 347
167
+ GLFW_KEY_MENU = 348
168
+ GLFW_KEY_LAST = GLFW_KEY_MENU
169
+
170
+ GLFW_MOD_SHIFT = 0x0001
171
+ GLFW_MOD_CONTROL = 0x0002
172
+ GLFW_MOD_ALT = 0x0004
173
+ GLFW_MOD_SUPER = 0x0008
174
+
175
+ GLFW_MOUSE_BUTTON_1 = 0
176
+ GLFW_MOUSE_BUTTON_2 = 1
177
+ GLFW_MOUSE_BUTTON_3 = 2
178
+ GLFW_MOUSE_BUTTON_4 = 3
179
+ GLFW_MOUSE_BUTTON_5 = 4
180
+ GLFW_MOUSE_BUTTON_6 = 5
181
+ GLFW_MOUSE_BUTTON_7 = 6
182
+ GLFW_MOUSE_BUTTON_8 = 7
183
+ GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8
184
+ GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1
185
+ GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2
186
+ GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3
187
+
188
+ GLFW_JOYSTICK_1 = 0
189
+ GLFW_JOYSTICK_2 = 1
190
+ GLFW_JOYSTICK_3 = 2
191
+ GLFW_JOYSTICK_4 = 3
192
+ GLFW_JOYSTICK_5 = 4
193
+ GLFW_JOYSTICK_6 = 5
194
+ GLFW_JOYSTICK_7 = 6
195
+ GLFW_JOYSTICK_8 = 7
196
+ GLFW_JOYSTICK_9 = 8
197
+ GLFW_JOYSTICK_10 = 9
198
+ GLFW_JOYSTICK_11 = 10
199
+ GLFW_JOYSTICK_12 = 11
200
+ GLFW_JOYSTICK_13 = 12
201
+ GLFW_JOYSTICK_14 = 13
202
+ GLFW_JOYSTICK_15 = 14
203
+ GLFW_JOYSTICK_16 = 15
204
+ GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16
205
+
206
+ GLFW_NOT_INITIALIZED = 0x00010001
207
+ GLFW_NO_CURRENT_CONTEXT = 0x00010002
208
+ GLFW_INVALID_ENUM = 0x00010003
209
+ GLFW_INVALID_VALUE = 0x00010004
210
+ GLFW_OUT_OF_MEMORY = 0x00010005
211
+ GLFW_API_UNAVAILABLE = 0x00010006
212
+ GLFW_VERSION_UNAVAILABLE = 0x00010007
213
+ GLFW_PLATFORM_ERROR = 0x00010008
214
+ GLFW_FORMAT_UNAVAILABLE = 0x00010009
215
+
216
+ GLFW_FOCUSED = 0x00020001
217
+ GLFW_ICONIFIED = 0x00020002
218
+ GLFW_RESIZABLE = 0x00020003
219
+ GLFW_VISIBLE = 0x00020004
220
+ GLFW_DECORATED = 0x00020005
221
+
222
+ GLFW_RED_BITS = 0x00021001
223
+ GLFW_GREEN_BITS = 0x00021002
224
+ GLFW_BLUE_BITS = 0x00021003
225
+ GLFW_ALPHA_BITS = 0x00021004
226
+ GLFW_DEPTH_BITS = 0x00021005
227
+ GLFW_STENCIL_BITS = 0x00021006
228
+ GLFW_ACCUM_RED_BITS = 0x00021007
229
+ GLFW_ACCUM_GREEN_BITS = 0x00021008
230
+ GLFW_ACCUM_BLUE_BITS = 0x00021009
231
+ GLFW_ACCUM_ALPHA_BITS = 0x0002100A
232
+ GLFW_AUX_BUFFERS = 0x0002100B
233
+ GLFW_STEREO = 0x0002100C
234
+ GLFW_SAMPLES = 0x0002100D
235
+ GLFW_SRGB_CAPABLE = 0x0002100E
236
+ GLFW_REFRESH_RATE = 0x0002100F
237
+
238
+ GLFW_CLIENT_API = 0x00022001
239
+ GLFW_CONTEXT_VERSION_MAJOR = 0x00022002
240
+ GLFW_CONTEXT_VERSION_MINOR = 0x00022003
241
+ GLFW_CONTEXT_REVISION = 0x00022004
242
+ GLFW_CONTEXT_ROBUSTNESS = 0x00022005
243
+ GLFW_OPENGL_FORWARD_COMPAT = 0x00022006
244
+ GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
245
+ GLFW_OPENGL_PROFILE = 0x00022008
246
+
247
+ GLFW_OPENGL_API = 0x00030001
248
+ GLFW_OPENGL_ES_API = 0x00030002
249
+
250
+ GLFW_NO_ROBUSTNESS = 0
251
+ GLFW_NO_RESET_NOTIFICATION = 0x00031001
252
+ GLFW_LOSE_CONTEXT_ON_RESET = 0x00031002
253
+
254
+ GLFW_OPENGL_ANY_PROFILE = 0
255
+ GLFW_OPENGL_CORE_PROFILE = 0x00032001
256
+ GLFW_OPENGL_COMPAT_PROFILE = 0x00032002
257
+
258
+ GLFW_CURSOR = 0x00033001
259
+ GLFW_STICKY_KEYS = 0x00033002
260
+ GLFW_STICKY_MOUSE_BUTTONS = 0x00033003
261
+
262
+ GLFW_CURSOR_NORMAL = 0x00034001
263
+ GLFW_CURSOR_HIDDEN = 0x00034002
264
+ GLFW_CURSOR_DISABLED = 0x00034003
265
+
266
+ GLFW_CONNECTED = 0x00040001
267
+ GLFW_DISCONNECTED = 0x00040002
268
+
269
+ # typedefs
270
+ @@glfw_cb_signature = {
271
+ :GLFWglproc => "void GLFWglproc()",
272
+ :GLFWerrorfun => "void GLFWerrorfun(int,const char*)",
273
+ :GLFWwindowposfun => "void GLFWwindowposfun(void*,int,int)",
274
+ :GLFWwindowsizefun => "void GLFWwindowsizefun(void*,int,int)",
275
+ :GLFWwindowclosefun => "void GLFWwindowclosefun(void*)",
276
+ :GLFWwindowrefreshfun => "void GLFWwindowrefreshfun(void*)",
277
+ :GLFWwindowfocusfun => "void GLFWwindowfocusfun(void*,int)",
278
+ :GLFWwindowiconifyfun => "void GLFWwindowiconifyfun(void*,int)",
279
+ :GLFWframebuffersizefun => "void GLFWframebuffersizefun(void*,int,int)",
280
+ :GLFWmousebuttonfun => "void GLFWmousebuttonfun(void*,int,int,int)",
281
+ :GLFWcursorposfun => "void GLFWcursorposfun(void*,double,double)",
282
+ :GLFWcursorenterfun => "void GLFWcursorenterfun(void*,int)",
283
+ :GLFWscrollfun => "void GLFWscrollfun(void*,double,double)",
284
+ :GLFWkeyfun => "void GLFWkeyfun(void*,int,int,int,int)",
285
+ :GLFWcharfun => "void GLFWcharfun(void*,unsigned int)",
286
+ :GLFWmonitorfun => "void GLFWmonitorfun(void*,int)",
287
+ }
288
+
289
+ def self.create_callback( sym, proc=nil, &blk )
290
+ if block_given?
291
+ return bind( @@glfw_cb_signature[sym], nil, &blk )
292
+ else
293
+ return bind( @@glfw_cb_signature[sym], nil, &proc )
294
+ end
295
+ end
296
+
297
+ # struct
298
+ GLFWvidmode = struct(["int width",
299
+ "int height",
300
+ "int redBits",
301
+ "int greenBits",
302
+ "int blueBits",
303
+ "int refreshRate"])
304
+
305
+ GLFWgammaramp = struct(["unsigned short* red",
306
+ "unsigned short* green",
307
+ "unsigned short* blue",
308
+ "unsigned int size"])
309
+
310
+ @@glfw_import_done = false
311
+
312
+ # Load native library.
313
+ def self.load_dll(lib = nil, path = nil)
314
+ if lib == nil && path == nil
315
+ case OpenGL.get_platform
316
+ when :OPENGL_PLATFORM_WINDOWS
317
+ lib, path = 'GLFW3.dll', Dir.pwd
318
+ when :OPENGL_PLATFORM_MACOSX
319
+ lib, path = 'libglfw.dylib', Dir.pwd
320
+ else
321
+ lib, path = 'libglfw.so', Dir.pwd
322
+ end
323
+ end
324
+
325
+ dlload (path + '/' + lib)
326
+ import_symbols() unless @@glfw_import_done
327
+ end
328
+
329
+ def self.import_symbols
330
+ # function
331
+ extern 'int glfwInit()'
332
+ extern 'void glfwTerminate()'
333
+ extern 'void glfwGetVersion(int*, int*, int*)'
334
+ extern 'const char* glfwGetVersionString()'
335
+ extern 'void* glfwSetErrorCallback(void*)'
336
+ extern 'void** glfwGetMonitors(int*)'
337
+ extern 'void* glfwGetPrimaryMonitor()'
338
+ extern 'void glfwGetMonitorPos(void*, int*, int*)'
339
+ extern 'void glfwGetMonitorPhysicalSize(void*, int*, int*)'
340
+ extern 'const char* glfwGetMonitorName(void*)'
341
+ extern 'void* glfwSetMonitorCallback(void*)'
342
+ extern 'const void* glfwGetVideoModes(void*, int*)'
343
+ extern 'const void* glfwGetVideoMode(void*)'
344
+ extern 'void glfwSetGamma(void*, float)'
345
+ extern 'const void* glfwGetGammaRamp(void*)'
346
+ extern 'void glfwSetGammaRamp(void*, const void*)'
347
+ extern 'void glfwDefaultWindowHints()'
348
+ extern 'void glfwWindowHint(int, int)'
349
+ extern 'void* glfwCreateWindow(int, int, const char*, void*, void*)'
350
+ extern 'void glfwDestroyWindow(void*)'
351
+ extern 'int glfwWindowShouldClose(void*)'
352
+ extern 'void glfwSetWindowShouldClose(void* window, int)'
353
+ extern 'void glfwSetWindowTitle(void*, const char*)'
354
+ extern 'void glfwGetWindowPos(void*, int*, int*)'
355
+ extern 'void glfwSetWindowPos(void*, int, int)'
356
+ extern 'void glfwGetWindowSize(void*, int*, int*)'
357
+ extern 'void glfwSetWindowSize(void*, int, int)'
358
+ extern 'void glfwGetFramebufferSize(void*, int*, int*)'
359
+ extern 'void glfwIconifyWindow(void*)'
360
+ extern 'void glfwRestoreWindow(void*)'
361
+ extern 'void glfwShowWindow(void*)'
362
+ extern 'void glfwHideWindow(void*)'
363
+ extern 'void* glfwGetWindowMonitor(void*)'
364
+ extern 'int glfwGetWindowAttrib(void*, int)'
365
+ extern 'void glfwSetWindowUserPointer(void*, void*)'
366
+ extern 'void* glfwGetWindowUserPointer(void*)'
367
+ extern 'void* glfwSetWindowPosCallback(void*, void*)'
368
+ extern 'void* glfwSetWindowSizeCallback(void*, void*)'
369
+ extern 'void* glfwSetWindowCloseCallback(void*, void*)'
370
+ extern 'void* glfwSetWindowRefreshCallback(void*, void*)'
371
+ extern 'void* glfwSetWindowFocusCallback(void*, void*)'
372
+ extern 'void* glfwSetWindowIconifyCallback(void*, void*)'
373
+ extern 'void* glfwSetFramebufferSizeCallback(void*, void*)'
374
+ extern 'void glfwPollEvents()'
375
+ extern 'void glfwWaitEvents()'
376
+ extern 'int glfwGetInputMode(void*, int)'
377
+ extern 'void glfwSetInputMode(void*, int, int)'
378
+ extern 'int glfwGetKey(void*, int)'
379
+ extern 'int glfwGetMouseButton(void*, int)'
380
+ extern 'void glfwGetCursorPos(void*, void*, void*)'
381
+ extern 'void glfwSetCursorPos(void*, double, double)'
382
+ extern 'void* glfwSetKeyCallback(void*, void*)'
383
+ extern 'void* glfwSetCharCallback(void*, void*)'
384
+ extern 'void* glfwSetMouseButtonCallback(void*, void*)'
385
+ extern 'void* glfwSetCursorPosCallback(void*, void*)'
386
+ extern 'void* glfwSetCursorEnterCallback(void*, void*)'
387
+ extern 'void* glfwSetScrollCallback(void*, void*)'
388
+ extern 'int glfwJoystickPresent(int)'
389
+ extern 'const float* glfwGetJoystickAxes(int, int*)'
390
+ extern 'const unsigned char* glfwGetJoystickButtons(int, int*)'
391
+ extern 'const char* glfwGetJoystickName(int)'
392
+ extern 'void glfwSetClipboardString(void*, const char*)'
393
+ extern 'const char* glfwGetClipboardString(void*)'
394
+ extern 'double glfwGetTime()'
395
+ extern 'void glfwSetTime(double)'
396
+ extern 'void glfwMakeContextCurrent(void*)'
397
+ extern 'void* glfwGetCurrentContext()'
398
+ extern 'void glfwSwapBuffers(void*)'
399
+ extern 'void glfwSwapInterval(int)'
400
+ extern 'int glfwExtensionSupported(const char*)'
401
+ extern 'void* glfwGetProcAddress(const char*)'
402
+
403
+ @@glfw_import_done = true
404
+ end
405
+
406
+ end