opengl-bindings2 2.0.2 → 2.0.4

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.
data/sample/simple.rb CHANGED
@@ -1,57 +1,57 @@
1
- #
2
- # For more samples, visit https://github.com/vaiorabbit/ruby-opengl/tree/master/sample .
3
- #
4
- # Ref.: /glfw-3.0.1/examples/simple.c
5
- #
6
- require 'opengl'
7
- require 'glfw'
8
-
9
- # Press ESC to exit.
10
- key_callback = GLFW::create_callback(:GLFWkeyfun) do |window, key, scancode, action, mods|
11
- GLFW.SetWindowShouldClose(window, 1) if key == GLFW::KEY_ESCAPE && action == GLFW::PRESS
12
- end
13
-
14
- if __FILE__ == $PROGRAM_NAME
15
- GLFW.load_lib() # Give path to "glfw3.dll (Windows)" or "libglfw.dylib (macOS)" if needed
16
- GLFW.Init()
17
-
18
- window = GLFW.CreateWindow(640, 480, "Simple example", nil, nil)
19
- GLFW.MakeContextCurrent(window)
20
- GLFW.SetKeyCallback(window, key_callback)
21
-
22
- GL.load_lib() # Call GL.load_lib after OpenGL context is available
23
-
24
- width_buf = ' ' * 8
25
- height_buf = ' ' * 8
26
- until GLFW.WindowShouldClose(window) == GLFW::TRUE
27
- GLFW.GetFramebufferSize(window, width_buf, height_buf)
28
- width = width_buf.unpack1('L')
29
- height = height_buf.unpack1('L')
30
- ratio = width.to_f / height.to_f
31
-
32
- GL.Viewport(0, 0, width, height)
33
- GL.Clear(GL::COLOR_BUFFER_BIT)
34
- GL.MatrixMode(GL::PROJECTION)
35
- GL.LoadIdentity()
36
- GL.Ortho(-ratio, ratio, -1.0, 1.0, 1.0, -1.0)
37
- GL.MatrixMode(GL::MODELVIEW)
38
-
39
- GL.LoadIdentity()
40
- GL.Rotatef(GLFW.GetTime() * 50.0, 0.0, 0.0, 1.0)
41
-
42
- GL.Begin(GL::TRIANGLES)
43
- GL.Color3f(1.0, 0.0, 0.0)
44
- GL.Vertex3f(-0.6, -0.4, 0.0)
45
- GL.Color3f(0.0, 1.0, 0.0)
46
- GL.Vertex3f(0.6, -0.4, 0.0)
47
- GL.Color3f(0.0, 0.0, 1.0)
48
- GL.Vertex3f(0.0, 0.6, 0.0)
49
- GL.End()
50
-
51
- GLFW.SwapBuffers(window)
52
- GLFW.PollEvents()
53
- end
54
-
55
- GLFW.DestroyWindow(window)
56
- GLFW.Terminate()
57
- end
1
+ #
2
+ # For more samples, visit https://github.com/vaiorabbit/ruby-opengl/tree/master/sample .
3
+ #
4
+ # Ref.: /glfw-3.0.1/examples/simple.c
5
+ #
6
+ require 'opengl'
7
+ require 'glfw'
8
+
9
+ # Press ESC to exit.
10
+ key_callback = GLFW::create_callback(:GLFWkeyfun) do |window, key, scancode, action, mods|
11
+ GLFW.SetWindowShouldClose(window, 1) if key == GLFW::KEY_ESCAPE && action == GLFW::PRESS
12
+ end
13
+
14
+ if __FILE__ == $PROGRAM_NAME
15
+ GLFW.load_lib() # Give path to "glfw3.dll (Windows)" or "libglfw.dylib (macOS)" if needed
16
+ GLFW.Init()
17
+
18
+ window = GLFW.CreateWindow(640, 480, "Simple example", nil, nil)
19
+ GLFW.MakeContextCurrent(window)
20
+ GLFW.SetKeyCallback(window, key_callback)
21
+
22
+ GL.load_lib() # Call GL.load_lib after OpenGL context is available
23
+
24
+ width_buf = ' ' * 8
25
+ height_buf = ' ' * 8
26
+ until GLFW.WindowShouldClose(window) == GLFW::TRUE
27
+ GLFW.GetFramebufferSize(window, width_buf, height_buf)
28
+ width = width_buf.unpack1('L')
29
+ height = height_buf.unpack1('L')
30
+ ratio = width.to_f / height.to_f
31
+
32
+ GL.Viewport(0, 0, width, height)
33
+ GL.Clear(GL::COLOR_BUFFER_BIT)
34
+ GL.MatrixMode(GL::PROJECTION)
35
+ GL.LoadIdentity()
36
+ GL.Ortho(-ratio, ratio, -1.0, 1.0, 1.0, -1.0)
37
+ GL.MatrixMode(GL::MODELVIEW)
38
+
39
+ GL.LoadIdentity()
40
+ GL.Rotatef(GLFW.GetTime() * 50.0, 0.0, 0.0, 1.0)
41
+
42
+ GL.Begin(GL::TRIANGLES)
43
+ GL.Color3f(1.0, 0.0, 0.0)
44
+ GL.Vertex3f(-0.6, -0.4, 0.0)
45
+ GL.Color3f(0.0, 1.0, 0.0)
46
+ GL.Vertex3f(0.6, -0.4, 0.0)
47
+ GL.Color3f(0.0, 0.0, 1.0)
48
+ GL.Vertex3f(0.0, 0.6, 0.0)
49
+ GL.End()
50
+
51
+ GLFW.SwapBuffers(window)
52
+ GLFW.PollEvents()
53
+ end
54
+
55
+ GLFW.DestroyWindow(window)
56
+ GLFW.Terminate()
57
+ end
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opengl-bindings2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaiorabbit
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-05 00:00:00.000000000 Z
12
- dependencies: []
10
+ date: 2025-01-25 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: fiddle
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.0'
13
26
  description: 'Ruby bindings for OpenGL - 4.6, OpenGL ES - 3.2 and all extensions using
14
27
  Fiddle (For MRI >= 2.4.0). GLFW/GLUT/GLU bindings are also available.
15
28
 
@@ -24,6 +37,7 @@ files:
24
37
  - LICENSE.txt
25
38
  - README.md
26
39
  - lib/glfw.rb
40
+ - lib/glfw33.rb
27
41
  - lib/glu.rb
28
42
  - lib/glut.rb
29
43
  - lib/opengl.rb
@@ -53,7 +67,6 @@ homepage: https://github.com/vaiorabbit/ruby-opengl
53
67
  licenses:
54
68
  - Zlib
55
69
  metadata: {}
56
- post_install_message:
57
70
  rdoc_options: []
58
71
  require_paths:
59
72
  - lib
@@ -68,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
81
  - !ruby/object:Gem::Version
69
82
  version: '0'
70
83
  requirements: []
71
- rubygems_version: 3.5.3
72
- signing_key:
84
+ rubygems_version: 3.6.2
73
85
  specification_version: 4
74
86
  summary: Bindings for OpenGL/GLFW/GLUT/GLU
75
87
  test_files: []