opengl-bindings2 2.0.3 → 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.
- checksums.yaml +4 -4
- data/ChangeLog +755 -751
- data/README.md +757 -757
- data/lib/glfw.rb +759 -759
- data/lib/glfw33.rb +704 -704
- data/lib/glu.rb +366 -366
- data/lib/glut.rb +575 -575
- data/lib/opengl.rb +36 -36
- data/lib/opengl_command.rb +7356 -7356
- data/lib/opengl_common.rb +83 -81
- data/lib/opengl_enum.rb +1818 -1818
- data/lib/opengl_es.rb +31 -31
- data/lib/opengl_es_command.rb +2526 -2526
- data/lib/opengl_es_enum.rb +1011 -1011
- data/lib/opengl_es_ext.rb +28 -28
- data/lib/opengl_es_ext_command.rb +9292 -9292
- data/lib/opengl_es_ext_enum.rb +6304 -6304
- data/lib/opengl_ext.rb +28 -28
- data/lib/opengl_ext_command.rb +33390 -33390
- data/lib/opengl_ext_common.rb +52 -52
- data/lib/opengl_ext_enum.rb +14164 -14164
- data/lib/opengl_linux.rb +63 -63
- data/lib/opengl_macosx.rb +68 -68
- data/lib/opengl_platform.rb +43 -43
- data/lib/opengl_windows.rb +71 -71
- data/sample/README.md +55 -55
- data/sample/glfw_get.bat +6 -6
- data/sample/glfw_get.sh +3 -3
- data/sample/simple.rb +57 -57
- metadata +2 -2
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,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opengl-bindings2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vaiorabbit
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-01-
|
|
10
|
+
date: 2025-01-25 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: fiddle
|