opengl-bindings 1.6.15 → 1.6.16

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,62 +1,62 @@
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
- OpenGL.load_lib()
10
- GLFW.load_lib()
11
-
12
- include OpenGL
13
- include GLFW
14
-
15
- # Press ESC to exit.
16
- key_callback = GLFW::create_callback(:GLFWkeyfun) do |window_handle, key, scancode, action, mods|
17
- if key == GLFW_KEY_ESCAPE && action == GLFW_PRESS
18
- glfwSetWindowShouldClose(window_handle, 1)
19
- end
20
- end
21
-
22
- if __FILE__ == $0
23
- glfwInit()
24
-
25
- window = glfwCreateWindow( 640, 480, "Simple example", nil, nil )
26
- glfwMakeContextCurrent( window )
27
- glfwSetKeyCallback( window, key_callback )
28
-
29
- while glfwWindowShouldClose( window ) == 0
30
- width_ptr = ' ' * 8
31
- height_ptr = ' ' * 8
32
- glfwGetFramebufferSize(window, width_ptr, height_ptr)
33
- width = width_ptr.unpack('L')[0]
34
- height = height_ptr.unpack('L')[0]
35
- ratio = width.to_f / height.to_f
36
-
37
- glViewport(0, 0, width, height)
38
- glClear(GL_COLOR_BUFFER_BIT)
39
- glMatrixMode(GL_PROJECTION)
40
- glLoadIdentity()
41
- glOrtho(-ratio, ratio, -1.0, 1.0, 1.0, -1.0)
42
- glMatrixMode(GL_MODELVIEW)
43
-
44
- glLoadIdentity()
45
- glRotatef(glfwGetTime() * 50.0, 0.0, 0.0, 1.0)
46
-
47
- glBegin(GL_TRIANGLES)
48
- glColor3f(1.0, 0.0, 0.0)
49
- glVertex3f(-0.6, -0.4, 0.0)
50
- glColor3f(0.0, 1.0, 0.0)
51
- glVertex3f(0.6, -0.4, 0.0)
52
- glColor3f(0.0, 0.0, 1.0)
53
- glVertex3f(0.0, 0.6, 0.0)
54
- glEnd()
55
-
56
- glfwSwapBuffers( window )
57
- glfwPollEvents()
58
- end
59
-
60
- glfwDestroyWindow( window )
61
- glfwTerminate()
62
- 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
+ OpenGL.load_lib()
10
+ GLFW.load_lib()
11
+
12
+ include OpenGL
13
+ include GLFW
14
+
15
+ # Press ESC to exit.
16
+ key_callback = GLFW::create_callback(:GLFWkeyfun) do |window_handle, key, scancode, action, mods|
17
+ if key == GLFW_KEY_ESCAPE && action == GLFW_PRESS
18
+ glfwSetWindowShouldClose(window_handle, 1)
19
+ end
20
+ end
21
+
22
+ if __FILE__ == $0
23
+ glfwInit()
24
+
25
+ window = glfwCreateWindow( 640, 480, "Simple example", nil, nil )
26
+ glfwMakeContextCurrent( window )
27
+ glfwSetKeyCallback( window, key_callback )
28
+
29
+ while glfwWindowShouldClose( window ) == 0
30
+ width_ptr = ' ' * 8
31
+ height_ptr = ' ' * 8
32
+ glfwGetFramebufferSize(window, width_ptr, height_ptr)
33
+ width = width_ptr.unpack('L')[0]
34
+ height = height_ptr.unpack('L')[0]
35
+ ratio = width.to_f / height.to_f
36
+
37
+ glViewport(0, 0, width, height)
38
+ glClear(GL_COLOR_BUFFER_BIT)
39
+ glMatrixMode(GL_PROJECTION)
40
+ glLoadIdentity()
41
+ glOrtho(-ratio, ratio, -1.0, 1.0, 1.0, -1.0)
42
+ glMatrixMode(GL_MODELVIEW)
43
+
44
+ glLoadIdentity()
45
+ glRotatef(glfwGetTime() * 50.0, 0.0, 0.0, 1.0)
46
+
47
+ glBegin(GL_TRIANGLES)
48
+ glColor3f(1.0, 0.0, 0.0)
49
+ glVertex3f(-0.6, -0.4, 0.0)
50
+ glColor3f(0.0, 1.0, 0.0)
51
+ glVertex3f(0.6, -0.4, 0.0)
52
+ glColor3f(0.0, 0.0, 1.0)
53
+ glVertex3f(0.0, 0.6, 0.0)
54
+ glEnd()
55
+
56
+ glfwSwapBuffers( window )
57
+ glfwPollEvents()
58
+ end
59
+
60
+ glfwDestroyWindow( window )
61
+ glfwTerminate()
62
+ end
@@ -1,70 +1,70 @@
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 'glut'
8
-
9
- OpenGL.load_lib()
10
- GLUT.load_lib()
11
-
12
- include OpenGL
13
- include GLUT
14
-
15
- $radian = 0
16
-
17
- def display
18
- glClear(GL_COLOR_BUFFER_BIT)
19
- glLoadIdentity()
20
- glRotatef($radian * 50.0, 0.0, 0.0, 1.0)
21
-
22
- glBegin(GL_TRIANGLES)
23
- glColor3f(1.0, 0.0, 0.0)
24
- glVertex3f(-0.6, -0.4, 0.0)
25
- glColor3f(0.0, 1.0, 0.0)
26
- glVertex3f(0.6, -0.4, 0.0)
27
- glColor3f(0.0, 0.0, 1.0)
28
- glVertex3f(0.0, 0.6, 0.0)
29
- glEnd()
30
-
31
- glutSwapBuffers()
32
- end
33
-
34
- def reshape( width, height )
35
- ratio = width.to_f / height.to_f
36
- glViewport(0, 0, width, height)
37
- glMatrixMode(GL_PROJECTION)
38
- glLoadIdentity()
39
- glOrtho(-ratio, ratio, -1.0, 1.0, 1.0, -1.0)
40
- glMatrixMode(GL_MODELVIEW)
41
- end
42
-
43
- def keyboard( key, x, y )
44
- case key
45
- when 27 # Press ESC to exit.
46
- exit
47
- end
48
- end
49
-
50
- def timer( value )
51
- $radian += (1.0 * Math::PI / 180.0)
52
- glutTimerFunc(0, GLUT.create_callback(:GLUTTimerFunc, method(:timer).to_proc), value)
53
- glutPostRedisplay()
54
- end
55
-
56
- if __FILE__ == $0
57
- glutInit([1].pack('I'), [""].pack('p'))
58
- glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH )
59
- glutInitWindowSize(640, 480);
60
- glutInitWindowPosition(100, 100)
61
- glutCreateWindow("Simple example")
62
- glutDisplayFunc(GLUT.create_callback(:GLUTDisplayFunc, method(:display).to_proc))
63
- glutReshapeFunc(GLUT.create_callback(:GLUTReshapeFunc, method(:reshape).to_proc))
64
- glutKeyboardFunc(GLUT.create_callback(:GLUTKeyboardFunc, method(:keyboard).to_proc))
65
- glutTimerFunc(0, GLUT.create_callback(:GLUTTimerFunc, method(:timer).to_proc), 0)
66
-
67
- glClearColor( 0.0, 0.0, 0.0, 1 )
68
-
69
- glutMainLoop()
70
- 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 'glut'
8
+
9
+ OpenGL.load_lib()
10
+ GLUT.load_lib()
11
+
12
+ include OpenGL
13
+ include GLUT
14
+
15
+ $radian = 0
16
+
17
+ def display
18
+ glClear(GL_COLOR_BUFFER_BIT)
19
+ glLoadIdentity()
20
+ glRotatef($radian * 50.0, 0.0, 0.0, 1.0)
21
+
22
+ glBegin(GL_TRIANGLES)
23
+ glColor3f(1.0, 0.0, 0.0)
24
+ glVertex3f(-0.6, -0.4, 0.0)
25
+ glColor3f(0.0, 1.0, 0.0)
26
+ glVertex3f(0.6, -0.4, 0.0)
27
+ glColor3f(0.0, 0.0, 1.0)
28
+ glVertex3f(0.0, 0.6, 0.0)
29
+ glEnd()
30
+
31
+ glutSwapBuffers()
32
+ end
33
+
34
+ def reshape( width, height )
35
+ ratio = width.to_f / height.to_f
36
+ glViewport(0, 0, width, height)
37
+ glMatrixMode(GL_PROJECTION)
38
+ glLoadIdentity()
39
+ glOrtho(-ratio, ratio, -1.0, 1.0, 1.0, -1.0)
40
+ glMatrixMode(GL_MODELVIEW)
41
+ end
42
+
43
+ def keyboard( key, x, y )
44
+ case key
45
+ when 27 # Press ESC to exit.
46
+ exit
47
+ end
48
+ end
49
+
50
+ def timer( value )
51
+ $radian += (1.0 * Math::PI / 180.0)
52
+ glutTimerFunc(0, GLUT.create_callback(:GLUTTimerFunc, method(:timer).to_proc), value)
53
+ glutPostRedisplay()
54
+ end
55
+
56
+ if __FILE__ == $0
57
+ glutInit([1].pack('I'), [""].pack('p'))
58
+ glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH )
59
+ glutInitWindowSize(640, 480);
60
+ glutInitWindowPosition(100, 100)
61
+ glutCreateWindow("Simple example")
62
+ glutDisplayFunc(GLUT.create_callback(:GLUTDisplayFunc, method(:display).to_proc))
63
+ glutReshapeFunc(GLUT.create_callback(:GLUTReshapeFunc, method(:reshape).to_proc))
64
+ glutKeyboardFunc(GLUT.create_callback(:GLUTKeyboardFunc, method(:keyboard).to_proc))
65
+ glutTimerFunc(0, GLUT.create_callback(:GLUTTimerFunc, method(:timer).to_proc), 0)
66
+
67
+ glClearColor( 0.0, 0.0, 0.0, 1 )
68
+
69
+ glutMainLoop()
70
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opengl-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.15
4
+ version: 1.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaiorabbit
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: fiddle
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 3.6.2
84
+ rubygems_version: 4.0.3
85
85
  specification_version: 4
86
86
  summary: "[Attention : Version 2 is now available] Bindings for OpenGL/GLFW/GLUT/GLU"
87
87
  test_files: []