Skip to content

Commit 0bc9733

Browse files
committed
GLFW 3.4
1 parent 9e20b1f commit 0bc9733

File tree

5 files changed

+786
-24
lines changed

5 files changed

+786
-24
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2024-02-25 vaiorabbit <http://twitter.com/vaiorabbit>
2+
3+
* GLFW 3.4
4+
15
2024-01-05 vaiorabbit <http://twitter.com/vaiorabbit>
26

37
* Updated using latest gl.xml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
...and wrapper code generator.
66

77
* Created : 2013-08-28
8-
* Last modified : 2024-01-05
8+
* Last modified : 2024-02-25
99

1010
<img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/simple_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/nehe_lesson36_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/brick_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/glxs_rb.jpg" width="200">
1111

lib/glfw.rb

Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# A GLFW wrapper (for version 3.0 - 3.3)
2+
# A GLFW wrapper (for version 3.4)
33
require 'fiddle/import'
44

55
module GLFW
@@ -217,17 +217,21 @@ module GLFW
217217
GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER = 5 # Available since GLFW 3.3
218218
GLFW_GAMEPAD_AXIS_LAST = GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER # Available since GLFW 3.3
219219

220-
GLFW_NO_ERROR = 0 # Available since GLFW 3.3
221-
GLFW_NOT_INITIALIZED = 0x00010001
222-
GLFW_NO_CURRENT_CONTEXT = 0x00010002
223-
GLFW_INVALID_ENUM = 0x00010003
224-
GLFW_INVALID_VALUE = 0x00010004
225-
GLFW_OUT_OF_MEMORY = 0x00010005
226-
GLFW_API_UNAVAILABLE = 0x00010006
227-
GLFW_VERSION_UNAVAILABLE = 0x00010007
228-
GLFW_PLATFORM_ERROR = 0x00010008
229-
GLFW_FORMAT_UNAVAILABLE = 0x00010009
230-
GLFW_NO_WINDOW_CONTEXT = 0x0001000A # Available since GLFW 3.2
220+
GLFW_NO_ERROR = 0 # Available since GLFW 3.3
221+
GLFW_NOT_INITIALIZED = 0x00010001
222+
GLFW_NO_CURRENT_CONTEXT = 0x00010002
223+
GLFW_INVALID_ENUM = 0x00010003
224+
GLFW_INVALID_VALUE = 0x00010004
225+
GLFW_OUT_OF_MEMORY = 0x00010005
226+
GLFW_API_UNAVAILABLE = 0x00010006
227+
GLFW_VERSION_UNAVAILABLE = 0x00010007
228+
GLFW_PLATFORM_ERROR = 0x00010008
229+
GLFW_FORMAT_UNAVAILABLE = 0x00010009
230+
GLFW_NO_WINDOW_CONTEXT = 0x0001000A # Available since GLFW 3.2
231+
GLFW_CURSOR_UNAVAILABLE = 0x0001000B # Available since GLFW 3.4
232+
GLFW_FEATURE_UNAVAILABLE = 0x0001000C # Available since GLFW 3.4
233+
GLFW_FEATURE_UNIMPLEMENTED = 0x0001000D # Available since GLFW 3.4
234+
GLFW_PLATFORM_UNAVAILABLE = 0x0001000E # Available since GLFW 3.4
231235

232236
GLFW_FOCUSED = 0x00020001
233237
GLFW_ICONIFIED = 0x00020002
@@ -241,6 +245,9 @@ module GLFW
241245
GLFW_TRANSPARENT_FRAMEBUFFER = 0x0002000A # Available since GLFW 3.3
242246
GLFW_HOVERED = 0x0002000B # Available since GLFW 3.3
243247
GLFW_FOCUS_ON_SHOW = 0x0002000C # Available since GLFW 3.3
248+
GLFW_MOUSE_PASSTHROUGH = 0x0002000D # Available since GLFW 3.4
249+
GLFW_POSITION_X = 0x0002000E # Available since GLFW 3.4
250+
GLFW_POSITION_Y = 0x0002000F # Available since GLFW 3.4
244251

245252
GLFW_RED_BITS = 0x00021001
246253
GLFW_GREEN_BITS = 0x00021002
@@ -265,19 +272,24 @@ module GLFW
265272
GLFW_CONTEXT_REVISION = 0x00022004
266273
GLFW_CONTEXT_ROBUSTNESS = 0x00022005
267274
GLFW_OPENGL_FORWARD_COMPAT = 0x00022006
268-
GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
275+
GLFW_CONTEXT_DEBUG = 0x00022007 # Renamed from GLFW_OPENGL_DEBUG_CONTEXT since GLFW 3.4
276+
GLFW_OPENGL_DEBUG_CONTEXT = GLFW_CONTEXT_DEBUG # Legacy name for compatibility added since GLFW 3.4
269277
GLFW_OPENGL_PROFILE = 0x00022008
270278
GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x00022009
271279
GLFW_CONTEXT_NO_ERROR = 0x0002200A
272280
GLFW_CONTEXT_CREATION_API = 0x0002200B # Available since GLFW 3.2
273281
GLFW_SCALE_TO_MONITOR = 0x0002200C # Available since GLFW 3.3
282+
GLFW_SCALE_FRAMEBUFFER = 0x0002200D # Available since GLFW 3.4
274283

275284
GLFW_COCOA_RETINA_FRAMEBUFFER = 0x00023001 # Available since GLFW 3.3
276285
GLFW_COCOA_FRAME_NAME = 0x00023002 # Available since GLFW 3.3
277286
GLFW_COCOA_GRAPHICS_SWITCHING = 0x00023003 # Available since GLFW 3.3
278287

279288
GLFW_X11_CLASS_NAME = 0x00024001 # Available since GLFW 3.3
280289
GLFW_X11_INSTANCE_NAME = 0x00024002 # Available since GLFW 3.3
290+
GLFW_WIN32_KEYBOARD_MENU = 0x00025001 # Available since GLFW 3.4
291+
GLFW_WIN32_SHOWDEFAULT = 0x00025002 # Available since GLFW 3.4
292+
GLFW_WAYLAND_APP_ID = 0x00026001 # Available since GLFW 3.4
281293

282294
GLFW_NO_API = 0 # Available since GLFW 3.2
283295
GLFW_OPENGL_API = 0x00030001
@@ -300,6 +312,7 @@ module GLFW
300312
GLFW_CURSOR_NORMAL = 0x00034001
301313
GLFW_CURSOR_HIDDEN = 0x00034002
302314
GLFW_CURSOR_DISABLED = 0x00034003
315+
GLFW_CURSOR_CAPTURED = 0x00034004 # Available since GLFW 3.4
303316

304317
GLFW_ANY_RELEASE_BEHAVIOR = 0
305318
GLFW_RELEASE_BEHAVIOR_FLUSH = 0x00035001
@@ -309,26 +322,56 @@ module GLFW
309322
GLFW_EGL_CONTEXT_API = 0x00036002 # Available since GLFW 3.2
310323
GLFW_OSMESA_CONTEXT_API = 0x00036003 # Available since GLFW 3.3
311324

325+
GLFW_ANGLE_PLATFORM_TYPE_NONE = 0x00037001 # Available since GLFW 3.4
326+
GLFW_ANGLE_PLATFORM_TYPE_OPENGL = 0x00037002 # Available since GLFW 3.4
327+
GLFW_ANGLE_PLATFORM_TYPE_OPENGLES = 0x00037003 # Available since GLFW 3.4
328+
GLFW_ANGLE_PLATFORM_TYPE_D3D9 = 0x00037004 # Available since GLFW 3.4
329+
GLFW_ANGLE_PLATFORM_TYPE_D3D11 = 0x00037005 # Available since GLFW 3.4
330+
GLFW_ANGLE_PLATFORM_TYPE_VULKAN = 0x00037007 # Available since GLFW 3.4
331+
GLFW_ANGLE_PLATFORM_TYPE_METAL = 0x00037008 # Available since GLFW 3.4
332+
312333
GLFW_WAYLAND_PREFER_LIBDECOR = 0x00038001 # Available since GLFW 3.3.9
313334
GLFW_WAYLAND_DISABLE_LIBDECOR = 0x00038002 # Available since GLFW 3.3.9
314335

315-
GLFW_ARROW_CURSOR = 0x00036001
316-
GLFW_IBEAM_CURSOR = 0x00036002
317-
GLFW_CROSSHAIR_CURSOR = 0x00036003
318-
GLFW_HAND_CURSOR = 0x00036004
319-
GLFW_HRESIZE_CURSOR = 0x00036005
320-
GLFW_VRESIZE_CURSOR = 0x00036006
336+
GLFW_ANY_POSITION = 0x80000000 # Available since GLFW 3.4
337+
338+
GLFW_ARROW_CURSOR = 0x00036001
339+
GLFW_IBEAM_CURSOR = 0x00036002
340+
GLFW_CROSSHAIR_CURSOR = 0x00036003
341+
GLFW_POINTING_HAND_CURSOR = 0x00036004 # Renamed from GLFW_HAND_CURSOR since GLFW 3.4
342+
GLFW_RESIZE_EW_CURSOR = 0x00036005 # Renamed from GLFW_HRESIZE_CURSOR since GLFW 3.4
343+
GLFW_RESIZE_NS_CURSOR = 0x00036006 # Renamed from GLFW_VRESIZE_CURSOR since GLFW 3.4
344+
GLFW_RESIZE_NWSE_CURSOR = 0x00036007 # Available since GLFW 3.4
345+
GLFW_RESIZE_NESW_CURSOR = 0x00036008 # Available since GLFW 3.4
346+
GLFW_RESIZE_ALL_CURSOR = 0x00036009 # Available since GLFW 3.4
347+
GLFW_NOT_ALLOWED_CURSOR = 0x0003600A # Available since GLFW 3.4
348+
349+
GLFW_HRESIZE_CURSOR = GLFW_RESIZE_EW_CURSOR # Legacy name for compatibility added since GLFW 3.4
350+
GLFW_VRESIZE_CURSOR = GLFW_RESIZE_NS_CURSOR # Legacy name for compatibility added since GLFW 3.4
351+
GLFW_HAND_CURSOR = GLFW_POINTING_HAND_CURSOR # Legacy name for compatibility added since GLFW 3.4
321352

322353
GLFW_CONNECTED = 0x00040001
323354
GLFW_DISCONNECTED = 0x00040002
324355

325356
GLFW_JOYSTICK_HAT_BUTTONS = 0x00050001 # Available since GLFW 3.3
357+
GLFW_ANGLE_PLATFORM_TYPE = 0x00050002 # Available since GLFW 3.4
358+
GLFW_PLATFORM = 0x00050003 # Available since GLFW 3.4
359+
326360

327361
GLFW_COCOA_CHDIR_RESOURCES = 0x00051001 # Available since GLFW 3.3
328362
GLFW_COCOA_MENUBAR = 0x00051002 # Available since GLFW 3.3
329363

364+
GLFW_X11_XCB_VULKAN_SURFACE = 0x00052001 # Available since GLFW 3.4
365+
330366
GLFW_WAYLAND_LIBDECOR = 0x00053001 # Available since GLFW 3.3.9
331367

368+
GLFW_ANY_PLATFORM = 0x00060000 # Available since GLFW 3.4
369+
GLFW_PLATFORM_WIN32 = 0x00060001 # Available since GLFW 3.4
370+
GLFW_PLATFORM_COCOA = 0x00060002 # Available since GLFW 3.4
371+
GLFW_PLATFORM_WAYLAND = 0x00060003 # Available since GLFW 3.4
372+
GLFW_PLATFORM_X11 = 0x00060004 # Available since GLFW 3.4
373+
GLFW_PLATFORM_NULL = 0x00060005 # Available since GLFW 3.4
374+
332375
GLFW_DONT_CARE = -1
333376

334377
# typedefs
@@ -441,6 +484,10 @@ def self.create_callback(sym, proc=nil, &blk)
441484
return self.create_callback_closure( sym, proc, &blk )
442485
end
443486

487+
# NOTE : Memory allocation callbacks addin in GLFW 3.4
488+
# (GLFWallocatefun, GLFWreallocatefun, GLFWdeallocatefun and struct GLFWallocator)
489+
# will not be supported in this bindings.
490+
444491
# struct
445492
GLFWvidmode = struct(["int width",
446493
"int height",
@@ -491,6 +538,8 @@ def self.load_lib(lib_path = nil, output_error = false)
491538
'const char* glfwGetVersionString()',
492539
'int glfwGetError(const char**)', # Available since GLFW 3.3
493540
'void* glfwSetErrorCallback(void*)',
541+
'int glfwGetPlatform()', # Available since GLFW 3.4
542+
'int glfwPlatformSupported(int)', # Available since GLFW 3.4
494543
'void** glfwGetMonitors(int*)',
495544
'void* glfwGetPrimaryMonitor()',
496545
'void glfwGetMonitorPos(void*, int*, int*)',
@@ -512,7 +561,8 @@ def self.load_lib(lib_path = nil, output_error = false)
512561
'void* glfwCreateWindow(int, int, const char*, void*, void*)', # Available since GLFW 3.0
513562
'void glfwDestroyWindow(void*)', # Available since GLFW 3.0
514563
'int glfwWindowShouldClose(void*)', # Available since GLFW 3.0
515-
'void glfwSetWindowShouldClose(void* window, int)', # Available since GLFW 3.0
564+
'void glfwSetWindowShouldClose(void*, int)', # Available since GLFW 3.0
565+
'const char* glfwGetWindowTitle(void*)', # Available since GLFW 3.4
516566
'void glfwSetWindowTitle(void*, const char*)',
517567
'void glfwSetWindowIcon(void*, int, void*)', # Available since GLFW 3.2
518568
'void glfwGetWindowPos(void*, int*, int*)', # Available since GLFW 3.0
@@ -605,7 +655,11 @@ def self.load_lib(lib_path = nil, output_error = false)
605655
# 'GLFWvkproc glfwGetInstanceProcAddress(void*, const char*)',
606656
# 'int glfwGetPhysicalDevicePresentationSupport(void*, void*, unsigned int)',
607657
# 'VkResult glfwCreateWindowSurface(void*, void*, const void*, void*)',
658+
# 'void glfwInitVulkanLoader(void*)',
608659
# <<< Vulkan <<<
660+
# >>> Allocator >>>
661+
# 'void glfwInitAllocator(void*)',
662+
# <<< Allocator <<<
609663
]
610664

611665
case GL.get_platform

0 commit comments

Comments
 (0)