opengl-bindings2 2.0.0.rc1 → 2.0.0rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +691 -686
- data/README.md +564 -564
- data/lib/glfw.rb +699 -699
- 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 +81 -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 +8969 -8969
- data/lib/opengl_es_ext_enum.rb +6078 -6078
- data/lib/opengl_ext.rb +28 -28
- data/lib/opengl_ext_command.rb +33331 -33331
- data/lib/opengl_ext_common.rb +52 -52
- data/lib/opengl_ext_enum.rb +14137 -14137
- 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/report_env.rb +7 -7
- data/sample/simple.rb +57 -57
- metadata +3 -3
data/sample/report_env.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
require 'opengl'
|
8
8
|
require 'glfw'
|
9
9
|
|
10
|
-
if __FILE__ == $
|
10
|
+
if __FILE__ == $PROGRAM_NAME
|
11
11
|
|
12
12
|
GLFW.load_lib()
|
13
13
|
GLFW.Init()
|
@@ -35,14 +35,14 @@ if __FILE__ == $0
|
|
35
35
|
GLFW.WindowHint(GLFW::CONTEXT_VERSION_MAJOR, ver_major)
|
36
36
|
GLFW.WindowHint(GLFW::CONTEXT_VERSION_MINOR, ver_minor)
|
37
37
|
GLFW.WindowHint(GLFW::DECORATED, 0)
|
38
|
-
window = GLFW.CreateWindow(
|
38
|
+
window = GLFW.CreateWindow(1, 1, "Report OpenGL Environment", nil, nil)
|
39
39
|
break unless window.null?
|
40
40
|
end
|
41
41
|
|
42
42
|
if window.null?
|
43
43
|
GLFW.DefaultWindowHints()
|
44
44
|
GLFW.WindowHint(GLFW::DECORATED, 0)
|
45
|
-
window = GLFW.CreateWindow(
|
45
|
+
window = GLFW.CreateWindow(1, 1, "Report OpenGL Environment", nil, nil)
|
46
46
|
if window.null?
|
47
47
|
puts "Failed to create the OpenGL context."
|
48
48
|
GLFW.Terminate()
|
@@ -50,7 +50,7 @@ if __FILE__ == $0
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
GLFW.MakeContextCurrent(
|
53
|
+
GLFW.MakeContextCurrent(window)
|
54
54
|
|
55
55
|
GL.load_lib()
|
56
56
|
|
@@ -70,15 +70,15 @@ if __FILE__ == $0
|
|
70
70
|
# glGetString(GL_EXTENSIONS) was deprecated in OpenGL 3.0
|
71
71
|
# Ref.: http://sourceforge.net/p/glew/bugs/120/
|
72
72
|
extensions_count_buf = ' '
|
73
|
-
GL::GetIntegerv(
|
73
|
+
GL::GetIntegerv(GL::NUM_EXTENSIONS, extensions_count_buf)
|
74
74
|
extensions_count = extensions_count_buf.unpack('L')[0]
|
75
75
|
extensions_count.times do |i|
|
76
|
-
puts GL::GetStringi(
|
76
|
+
puts GL::GetStringi(GL::EXTENSIONS, i).to_s
|
77
77
|
end
|
78
78
|
else
|
79
79
|
puts GL::GetString(GL::EXTENSIONS).to_s.split(/ /)
|
80
80
|
end
|
81
81
|
|
82
|
-
GLFW.DestroyWindow(
|
82
|
+
GLFW.DestroyWindow(window)
|
83
83
|
GLFW.Terminate()
|
84
84
|
end
|
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()
|
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()
|
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,14 +1,14 @@
|
|
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.0rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaiorabbit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Ruby bindings for OpenGL - 4.6, OpenGL ES - 3.2 and all extensions using
|
14
14
|
Fiddle (For MRI >= 2.4.0). GLFW/GLUT/GLU bindings are also available.
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.3.1
|
70
70
|
requirements: []
|
71
|
-
rubygems_version: 3.
|
71
|
+
rubygems_version: 3.3.3
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Bindings for OpenGL -4.6, ES - 3.2 and extensions (For MRI >= 2.4.0)
|