ruby-opengl 0.60.1 → 0.61.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. metadata +36 -186
  2. data/Rakefile +0 -168
  3. data/doc/build_install.txt +0 -122
  4. data/doc/extensions.txt +0 -556
  5. data/doc/extensions.txt.in +0 -348
  6. data/doc/history.txt +0 -66
  7. data/doc/requirements_and_design.txt +0 -117
  8. data/doc/roadmap.txt +0 -28
  9. data/doc/scientific_use.txt +0 -35
  10. data/doc/supplies/page_template.html +0 -71
  11. data/doc/thanks.txt +0 -29
  12. data/doc/tutorial.txt +0 -469
  13. data/examples/NeHe/nehe_lesson02.rb +0 -117
  14. data/examples/NeHe/nehe_lesson03.rb +0 -122
  15. data/examples/NeHe/nehe_lesson04.rb +0 -133
  16. data/examples/NeHe/nehe_lesson05.rb +0 -186
  17. data/examples/NeHe/nehe_lesson36.rb +0 -303
  18. data/examples/OrangeBook/3Dlabs-License.txt +0 -33
  19. data/examples/OrangeBook/brick.frag +0 -36
  20. data/examples/OrangeBook/brick.rb +0 -376
  21. data/examples/OrangeBook/brick.vert +0 -41
  22. data/examples/OrangeBook/particle.frag +0 -17
  23. data/examples/OrangeBook/particle.rb +0 -406
  24. data/examples/OrangeBook/particle.vert +0 -38
  25. data/examples/README +0 -16
  26. data/examples/RedBook/aapoly.rb +0 -142
  27. data/examples/RedBook/aargb.rb +0 -119
  28. data/examples/RedBook/accanti.rb +0 -162
  29. data/examples/RedBook/accpersp.rb +0 -215
  30. data/examples/RedBook/alpha.rb +0 -123
  31. data/examples/RedBook/alpha3D.rb +0 -158
  32. data/examples/RedBook/bezcurve.rb +0 -105
  33. data/examples/RedBook/bezmesh.rb +0 -137
  34. data/examples/RedBook/checker.rb +0 -124
  35. data/examples/RedBook/clip.rb +0 -95
  36. data/examples/RedBook/colormat.rb +0 -135
  37. data/examples/RedBook/cube.rb +0 -69
  38. data/examples/RedBook/depthcue.rb +0 -99
  39. data/examples/RedBook/dof.rb +0 -205
  40. data/examples/RedBook/double.rb +0 -105
  41. data/examples/RedBook/drawf.rb +0 -91
  42. data/examples/RedBook/feedback.rb +0 -145
  43. data/examples/RedBook/fog.rb +0 -167
  44. data/examples/RedBook/font.rb +0 -151
  45. data/examples/RedBook/hello.rb +0 -79
  46. data/examples/RedBook/image.rb +0 -137
  47. data/examples/RedBook/jitter.rb +0 -207
  48. data/examples/RedBook/lines.rb +0 -128
  49. data/examples/RedBook/list.rb +0 -111
  50. data/examples/RedBook/material.rb +0 -275
  51. data/examples/RedBook/mipmap.rb +0 -156
  52. data/examples/RedBook/model.rb +0 -113
  53. data/examples/RedBook/movelight.rb +0 -132
  54. data/examples/RedBook/pickdepth.rb +0 -179
  55. data/examples/RedBook/planet.rb +0 -108
  56. data/examples/RedBook/quadric.rb +0 -158
  57. data/examples/RedBook/robot.rb +0 -115
  58. data/examples/RedBook/select.rb +0 -196
  59. data/examples/RedBook/smooth.rb +0 -95
  60. data/examples/RedBook/stencil.rb +0 -163
  61. data/examples/RedBook/stroke.rb +0 -167
  62. data/examples/RedBook/surface.rb +0 -166
  63. data/examples/RedBook/teaambient.rb +0 -132
  64. data/examples/RedBook/teapots.rb +0 -182
  65. data/examples/RedBook/tess.rb +0 -183
  66. data/examples/RedBook/texbind.rb +0 -147
  67. data/examples/RedBook/texgen.rb +0 -169
  68. data/examples/RedBook/texturesurf.rb +0 -128
  69. data/examples/RedBook/varray.rb +0 -159
  70. data/examples/RedBook/wrap.rb +0 -148
  71. data/examples/misc/OGLBench.rb +0 -337
  72. data/examples/misc/anisotropic.rb +0 -194
  73. data/examples/misc/fbo_test.rb +0 -356
  74. data/examples/misc/font-glut.rb +0 -46
  75. data/examples/misc/glfwtest.rb +0 -30
  76. data/examples/misc/plane.rb +0 -161
  77. data/examples/misc/readpixel.rb +0 -65
  78. data/examples/misc/sdltest.rb +0 -34
  79. data/examples/misc/trislam.rb +0 -828
  80. data/ext/common/common.h +0 -423
  81. data/ext/common/conv.h +0 -244
  82. data/ext/common/funcdef.h +0 -280
  83. data/ext/common/gl-enums.h +0 -10031
  84. data/ext/common/gl-error.h +0 -23
  85. data/ext/common/gl-types.h +0 -61
  86. data/ext/common/glu-enums.h +0 -463
  87. data/ext/gl/gl-1.0-1.1.c +0 -2817
  88. data/ext/gl/gl-1.2.c +0 -814
  89. data/ext/gl/gl-1.3.c +0 -444
  90. data/ext/gl/gl-1.4.c +0 -349
  91. data/ext/gl/gl-1.5.c +0 -225
  92. data/ext/gl/gl-2.0.c +0 -657
  93. data/ext/gl/gl-2.1.c +0 -57
  94. data/ext/gl/gl-enums.c +0 -3354
  95. data/ext/gl/gl-error.c +0 -104
  96. data/ext/gl/gl-ext-3dfx.c +0 -27
  97. data/ext/gl/gl-ext-arb.c +0 -866
  98. data/ext/gl/gl-ext-ati.c +0 -41
  99. data/ext/gl/gl-ext-ext.c +0 -890
  100. data/ext/gl/gl-ext-gremedy.c +0 -41
  101. data/ext/gl/gl-ext-nv.c +0 -679
  102. data/ext/gl/gl.c +0 -214
  103. data/ext/gl/mkrf_conf.rb +0 -34
  104. data/ext/glu/glu-enums.c +0 -164
  105. data/ext/glu/glu.c +0 -1530
  106. data/ext/glu/mkrf_conf.rb +0 -35
  107. data/ext/glut/glut.c +0 -1623
  108. data/ext/glut/mkrf_conf.rb +0 -37
  109. data/lib/opengl.rb +0 -84
  110. data/test/README +0 -10
  111. data/test/tc_common.rb +0 -98
  112. data/test/tc_ext_arb.rb +0 -467
  113. data/test/tc_ext_ati.rb +0 -33
  114. data/test/tc_ext_ext.rb +0 -551
  115. data/test/tc_ext_gremedy.rb +0 -36
  116. data/test/tc_ext_nv.rb +0 -357
  117. data/test/tc_func_10_11.rb +0 -1281
  118. data/test/tc_func_12.rb +0 -186
  119. data/test/tc_func_13.rb +0 -229
  120. data/test/tc_func_14.rb +0 -197
  121. data/test/tc_func_15.rb +0 -270
  122. data/test/tc_func_20.rb +0 -346
  123. data/test/tc_func_21.rb +0 -541
  124. data/test/tc_glu.rb +0 -310
  125. data/test/tc_include_gl.rb +0 -35
  126. data/test/tc_misc.rb +0 -54
  127. data/test/tc_require_gl.rb +0 -34
@@ -1,117 +0,0 @@
1
- #!/usr/bin/env ruby -rubygems
2
- # Name: nehe_lesson02.rb
3
- # Purpose: An implementation of NeHe's OpenGL Lesson #02
4
- # using ruby-opengl (http://nehe.gamedev.net/)
5
- #
6
-
7
- require "gl"
8
- require "glu"
9
- require "glut"
10
- require "mathn"
11
-
12
- # Add GL and GLUT namespaces in to make porting easier
13
- include Gl
14
- include Glu
15
- include Glut
16
-
17
- # Placeholder for the window object
18
- window = ""
19
-
20
- def init_gl_window(width = 640, height = 480)
21
- # Background color to black
22
- glClearColor(0.0, 0.0, 0.0, 0)
23
- # Enables clearing of depth buffer
24
- glClearDepth(1.0)
25
- # Set type of depth test
26
- glDepthFunc(GL_LEQUAL)
27
- # Enable depth testing
28
- glEnable(GL_DEPTH_TEST)
29
- # Enable smooth color shading
30
- glShadeModel(GL_SMOOTH)
31
-
32
- glMatrixMode(GL_PROJECTION)
33
- glLoadIdentity
34
- # Calculate aspect ratio of the window
35
- gluPerspective(45.0, width / height, 0.1, 100.0)
36
-
37
- glMatrixMode(GL_MODELVIEW)
38
-
39
- draw_gl_scene
40
- end
41
-
42
- #reshape = Proc.new do |width, height|
43
- def reshape(width, height)
44
- height = 1 if height == 0
45
-
46
- # Reset current viewpoint and perspective transformation
47
- glViewport(0, 0, width, height)
48
-
49
- glMatrixMode(GL_PROJECTION)
50
- glLoadIdentity
51
-
52
- gluPerspective(45.0, width / height, 0.1, 100.0)
53
- end
54
-
55
- #draw_gl_scene = Proc.new do
56
- def draw_gl_scene
57
- # Clear the screen and depth buffer
58
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
59
-
60
- # Reset the view
61
- glMatrixMode(GL_MODELVIEW)
62
- glLoadIdentity
63
-
64
- # Move left 1.5 units and into the screen 6.0 units
65
- glTranslatef(-1.5, 0.0, -6.0)
66
-
67
- # Draw a triangle
68
- glBegin(GL_POLYGON)
69
- glVertex3f( 0.0, 1.0, 0.0)
70
- glVertex3f( 1.0, -1.0, 0.0)
71
- glVertex3f(-1.0, -1.0, 0.0)
72
- glEnd
73
-
74
- # Move right 3 units
75
- glTranslatef(3.0, 0.0, 0.0)
76
-
77
- # Draw a rectangle
78
- glBegin(GL_QUADS)
79
- glVertex3f(-1.0, 1.0, 0.0)
80
- glVertex3f( 1.0, 1.0, 0.0)
81
- glVertex3f( 1.0, -1.0, 0.0)
82
- glVertex3f(-1.0, -1.0, 0.0)
83
- glEnd
84
-
85
- # Swap buffers for display
86
- glutSwapBuffers
87
- end
88
-
89
- # The idle function to handle
90
- def idle
91
- glutPostRedisplay
92
- end
93
-
94
- # Keyboard handler to exit when ESC is typed
95
- keyboard = lambda do |key, x, y|
96
- case(key)
97
- when ?\e
98
- glutDestroyWindow(window)
99
- exit(0)
100
- end
101
- glutPostRedisplay
102
- end
103
-
104
-
105
- # Initliaze our GLUT code
106
- glutInit;
107
- # Setup a double buffer, RGBA color, alpha components and depth buffer
108
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
109
- glutInitWindowSize(640, 480);
110
- glutInitWindowPosition(0, 0);
111
- window = glutCreateWindow("NeHe Lesson 02 - ruby-opengl version");
112
- glutDisplayFunc(method(:draw_gl_scene).to_proc);
113
- glutReshapeFunc(method(:reshape).to_proc);
114
- glutIdleFunc(method(:idle).to_proc);
115
- glutKeyboardFunc(keyboard);
116
- init_gl_window(640, 480)
117
- glutMainLoop();
@@ -1,122 +0,0 @@
1
- #!/usr/bin/env ruby -rubygems
2
- # Name: nehe_lesson03.rb
3
- # Purpose: An implementation of NeHe's OpenGL Lesson #03
4
- # using ruby-opengl (http://nehe.gamedev.net/)
5
- #
6
-
7
- require "gl"
8
- require "glu"
9
- require "glut"
10
- require "mathn"
11
-
12
- # Add GL and GLUT namespaces in to make porting easier
13
- include Gl
14
- include Glu
15
- include Glut
16
-
17
- # Placeholder for the window object
18
- window = ""
19
-
20
- def init_gl_window(width = 640, height = 480)
21
- # Background color to black
22
- glClearColor(0.0, 0.0, 0.0, 0)
23
- # Enables clearing of depth buffer
24
- glClearDepth(1.0)
25
- # Set type of depth test
26
- glDepthFunc(GL_LEQUAL)
27
- # Enable depth testing
28
- glEnable(GL_DEPTH_TEST)
29
- # Enable smooth color shading
30
- glShadeModel(GL_SMOOTH)
31
-
32
- glMatrixMode(GL_PROJECTION)
33
- glLoadIdentity
34
- # Calculate aspect ratio of the window
35
- gluPerspective(45.0, width / height, 0.1, 100.0)
36
-
37
- glMatrixMode(GL_MODELVIEW)
38
-
39
- draw_gl_scene
40
- end
41
-
42
- #reshape = Proc.new do |width, height|
43
- def reshape(width, height)
44
- height = 1 if height == 0
45
-
46
- # Reset current viewpoint and perspective transformation
47
- glViewport(0, 0, width, height)
48
-
49
- glMatrixMode(GL_PROJECTION)
50
- glLoadIdentity
51
-
52
- gluPerspective(45.0, width / height, 0.1, 100.0)
53
- end
54
-
55
- #draw_gl_scene = Proc.new do
56
- def draw_gl_scene
57
- # Clear the screen and depth buffer
58
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
59
-
60
- # Reset the view
61
- glMatrixMode(GL_MODELVIEW)
62
- glLoadIdentity
63
-
64
- # Move left 1.5 units and into the screen 6.0 units
65
- glTranslatef(-1.5, 0.0, -6.0)
66
-
67
- # Draw a triangle
68
- glBegin(GL_POLYGON)
69
- glColor3f(1.0, 0.0, 0.0)
70
- glVertex3f( 0.0, 1.0, 0.0)
71
- glColor3f(0.0, 1.0, 0.0)
72
- glVertex3f( 1.0, -1.0, 0.0)
73
- glColor3f(0.0, 0.0, 1.0)
74
- glVertex3f(-1.0, -1.0, 0.0)
75
- glEnd
76
-
77
- # Move right 3 units
78
- glTranslatef(3.0, 0.0, 0.0)
79
-
80
- # Draw a rectangle
81
- # Set it to a blue color one time only
82
- glColor3f(0.5, 0.5, 1.0)
83
- glBegin(GL_QUADS)
84
- glVertex3f(-1.0, 1.0, 0.0)
85
- glVertex3f( 1.0, 1.0, 0.0)
86
- glVertex3f( 1.0, -1.0, 0.0)
87
- glVertex3f(-1.0, -1.0, 0.0)
88
- glEnd
89
-
90
- # Swap buffers for display
91
- glutSwapBuffers
92
- end
93
-
94
- # The idle function to handle
95
- def idle
96
- glutPostRedisplay
97
- end
98
-
99
- # Keyboard handler to exit when ESC is typed
100
- keyboard = lambda do |key, x, y|
101
- case(key)
102
- when ?\e
103
- glutDestroyWindow(window)
104
- exit(0)
105
- end
106
- glutPostRedisplay
107
- end
108
-
109
-
110
- # Initliaze our GLUT code
111
- glutInit;
112
- # Setup a double buffer, RGBA color, alpha components and depth buffer
113
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
114
- glutInitWindowSize(640, 480);
115
- glutInitWindowPosition(0, 0);
116
- window = glutCreateWindow("NeHe Lesson 03 - ruby-opengl version");
117
- glutDisplayFunc(method(:draw_gl_scene).to_proc);
118
- glutReshapeFunc(method(:reshape).to_proc);
119
- glutIdleFunc(method(:idle).to_proc);
120
- glutKeyboardFunc(keyboard);
121
- init_gl_window(640, 480)
122
- glutMainLoop();
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env ruby -rubygems
2
- # Name: nehe_lesson04.rb
3
- # Purpose: An implementation of NeHe's OpenGL Lesson #04
4
- # using ruby-opengl (http://nehe.gamedev.net/)
5
- #
6
-
7
- require "gl"
8
- require "glu"
9
- require "glut"
10
- require "mathn"
11
-
12
- # Add GL and GLUT namespaces in to make porting easier
13
- include Gl
14
- include Glu
15
- include Glut
16
-
17
- # Placeholder for the window object
18
- $window = ""
19
- # Angle for the triangle (Global)
20
- $triangle_angle = 0
21
- # Angle for the quadrilateral (Global)
22
- $quad_angle = 0
23
-
24
- def init_gl_window(width = 640, height = 480)
25
- # Background color to black
26
- glClearColor(0.0, 0.0, 0.0, 0)
27
- # Enables clearing of depth buffer
28
- glClearDepth(1.0)
29
- # Set type of depth test
30
- glDepthFunc(GL_LEQUAL)
31
- # Enable depth testing
32
- glEnable(GL_DEPTH_TEST)
33
- # Enable smooth color shading
34
- glShadeModel(GL_SMOOTH)
35
-
36
- glMatrixMode(GL_PROJECTION)
37
- glLoadIdentity
38
- # Calculate aspect ratio of the window
39
- gluPerspective(45.0, width / height, 0.1, 100.0)
40
-
41
- glMatrixMode(GL_MODELVIEW)
42
-
43
- draw_gl_scene
44
- end
45
-
46
- #reshape = Proc.new do |width, height|
47
- def reshape(width, height)
48
- height = 1 if height == 0
49
-
50
- # Reset current viewpoint and perspective transformation
51
- glViewport(0, 0, width, height)
52
-
53
- glMatrixMode(GL_PROJECTION)
54
- glLoadIdentity
55
-
56
- gluPerspective(45.0, width / height, 0.1, 100.0)
57
- end
58
-
59
- #draw_gl_scene = Proc.new do
60
- def draw_gl_scene
61
- # Clear the screen and depth buffer
62
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
63
-
64
- # Reset the view
65
- glMatrixMode(GL_MODELVIEW)
66
- glLoadIdentity
67
-
68
- # Move left 1.5 units and into the screen 6.0 units
69
- glTranslatef(-1.5, 0.0, -6.0)
70
-
71
- # Rotate the triangle on the Y-axis
72
- glRotatef($triangle_angle, 0.0, 1.0, 0.0)
73
- # Draw a triangle
74
- glBegin(GL_POLYGON)
75
- glColor3f(1.0, 0.0, 0.0)
76
- glVertex3f( 0.0, 1.0, 0.0)
77
- glColor3f(0.0, 1.0, 0.0)
78
- glVertex3f( 1.0, -1.0, 0.0)
79
- glColor3f(0.0, 0.0, 1.0)
80
- glVertex3f(-1.0, -1.0, 0.0)
81
- glEnd
82
-
83
- # Move right 3 units
84
- glLoadIdentity
85
- glTranslatef(1.5, 0.0, -6.0)
86
-
87
- # Draw a quadrilateral
88
- # Rotate the quad on the X-axis
89
- glRotatef($quad_angle, 1.0, 0.0, 0.0)
90
- # Set it to a blue color one time only
91
- glColor3f(0.5, 0.5, 1.0)
92
- glBegin(GL_QUADS)
93
- glVertex3f(-1.0, 1.0, 0.0)
94
- glVertex3f( 1.0, 1.0, 0.0)
95
- glVertex3f( 1.0, -1.0, 0.0)
96
- glVertex3f(-1.0, -1.0, 0.0)
97
- glEnd
98
-
99
- $triangle_angle += 0.2
100
- $quad_angle -= 0.15
101
- # Swap buffers for display
102
- glutSwapBuffers
103
- end
104
-
105
- # The idle function to handle
106
- def idle
107
- glutPostRedisplay
108
- end
109
-
110
- # Keyboard handler to exit when ESC is typed
111
- keyboard = lambda do |key, x, y|
112
- case(key)
113
- when ?\e
114
- glutDestroyWindow($window)
115
- exit(0)
116
- end
117
- glutPostRedisplay
118
- end
119
-
120
-
121
- # Initliaze our GLUT code
122
- glutInit;
123
- # Setup a double buffer, RGBA color, alpha components and depth buffer
124
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
125
- glutInitWindowSize(640, 480);
126
- glutInitWindowPosition(0, 0);
127
- $window = glutCreateWindow("NeHe Lesson 04 - ruby-opengl version");
128
- glutDisplayFunc(method(:draw_gl_scene).to_proc);
129
- glutReshapeFunc(method(:reshape).to_proc);
130
- glutIdleFunc(method(:idle).to_proc);
131
- glutKeyboardFunc(keyboard);
132
- init_gl_window(640, 480)
133
- glutMainLoop();
@@ -1,186 +0,0 @@
1
- #!/usr/bin/env ruby -rubygems
2
- # Name: nehe_lesson05.rb
3
- # Purpose: An implementation of NeHe's OpenGL Lesson #05
4
- # using ruby-opengl (http://nehe.gamedev.net/)
5
- #
6
-
7
- require "gl"
8
- require "glu"
9
- require "glut"
10
- require "mathn"
11
-
12
- # Add GL and GLUT namespaces in to make porting easier
13
- include Gl
14
- include Glu
15
- include Glut
16
-
17
- # Placeholder for the window object
18
- $window = ""
19
- # Angle for the triangle (Global)
20
- $pyramid_angle = 0
21
- # Angle for the quadrilateral (Global)
22
- $cube_angle = 0
23
-
24
- def init_gl_window(width = 640, height = 480)
25
- # Background color to black
26
- glClearColor(0.0, 0.0, 0.0, 0)
27
- # Enables clearing of depth buffer
28
- glClearDepth(1.0)
29
- # Set type of depth test
30
- glDepthFunc(GL_LEQUAL)
31
- # Enable depth testing
32
- glEnable(GL_DEPTH_TEST)
33
- # Enable smooth color shading
34
- glShadeModel(GL_SMOOTH)
35
-
36
- glMatrixMode(GL_PROJECTION)
37
- glLoadIdentity
38
- # Calculate aspect ratio of the window
39
- gluPerspective(45.0, width / height, 0.1, 100.0)
40
-
41
- glMatrixMode(GL_MODELVIEW)
42
-
43
- draw_gl_scene
44
- end
45
-
46
- #reshape = Proc.new do |width, height|
47
- def reshape(width, height)
48
- height = 1 if height == 0
49
-
50
- # Reset current viewpoint and perspective transformation
51
- glViewport(0, 0, width, height)
52
-
53
- glMatrixMode(GL_PROJECTION)
54
- glLoadIdentity
55
-
56
- gluPerspective(45.0, width / height, 0.1, 100.0)
57
- end
58
-
59
- #draw_gl_scene = Proc.new do
60
- def draw_gl_scene
61
- # Clear the screen and depth buffer
62
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
63
-
64
- # Reset the view
65
- glMatrixMode(GL_MODELVIEW)
66
- glLoadIdentity
67
-
68
- # Move left 1.5 units and into the screen 6.0 units
69
- glTranslatef(-1.5, 0.0, -6.0)
70
-
71
- # Rotate the pyramid on the Y-axis
72
- glRotatef($pyramid_angle, 0.0, 1.0, 0.0)
73
- # Draw a pyramid
74
- glBegin(GL_POLYGON)
75
- # Draw front side of pyramid
76
- glColor3f(1.0, 0.0, 0.0)
77
- glVertex3f( 0.0, 1.0, 0.0)
78
- glColor3f(0.0, 1.0, 0.0)
79
- glVertex3f(-1.0, -1.0, 1.0)
80
- glColor3f(0.0, 0.0, 1.0)
81
- glVertex3f(1.0, -1.0, 1.0)
82
- # Draw right side of pyramid
83
- glColor3f(1.0, 0.0, 0.0)
84
- glVertex3f( 0.0, 1.0, 0.0)
85
- glColor3f(0.0, 0.0, 1.0)
86
- glVertex3f( 1.0, -1.0, 1.0)
87
- glColor3f(0.0, 1.0, 0.0)
88
- glVertex3f(1.0, -1.0, -1.0)
89
- # Draw back side of pyramid
90
- glColor3f(1.0, 0.0, 0.0)
91
- glVertex3f( 0.0, 1.0, 0.0)
92
- glColor3f(0.0, 0.0, 1.0)
93
- glVertex3f(1.0, -1.0, -1.0)
94
- glColor3f(0.0, 1.0, 0.0)
95
- glVertex3f(-1.0, -1.0, -1.0)
96
- # Draw left side of pyramid
97
- glColor3f(1.0, 0.0, 0.0)
98
- glVertex3f( 0.0, 1.0, 0.0)
99
- glColor3f(0.0, 0.0, 1.0)
100
- glVertex3f(-1.0, -1.0, -1.0)
101
- glColor3f(0.0, 1.0, 0.0)
102
- glVertex3f(-1.0, -1.0, 1.0)
103
- glEnd
104
-
105
- glLoadIdentity
106
- # Move right 3 units
107
- glTranslatef(1.5, 0.0, -7.0)
108
-
109
- # Draw a cube
110
- # Rotate the cube on the X, Y and Z axis
111
- glRotatef($cube_angle, 1.0, 1.0, 1.0)
112
- # Set it to a blue color one time only
113
- glBegin(GL_QUADS)
114
- # Draw the top side in green
115
- glColor3f(0.0, 1.0, 0.0)
116
- glVertex3f( 1.0, 1.0, -1.0)
117
- glVertex3f(-1.0, 1.0, -1.0)
118
- glVertex3f(-1.0, 1.0, 1.0)
119
- glVertex3f( 1.0, 1.0, 1.0)
120
- # Draw the bottom side in orange
121
- glColor3f(1.0, 0.5, 0.0)
122
- glVertex3f( 1.0, -1.0, 1.0)
123
- glVertex3f(-1.0, -1.0, 1.0)
124
- glVertex3f(-1.0, -1.0, -1.0)
125
- glVertex3f( 1.0, -1.0, -1.0)
126
- # Draw the front side in red
127
- glColor3f(1.0, 0.0, 0.0)
128
- glVertex3f( 1.0, 1.0, 1.0)
129
- glVertex3f(-1.0, 1.0, 1.0)
130
- glVertex3f(-1.0, -1.0, 1.0)
131
- glVertex3f( 1.0, -1.0, 1.0)
132
- # Draw the back side in yellow
133
- glColor3f(1.0, 1.0, 0.0)
134
- glVertex3f( 1.0, -1.0, -1.0)
135
- glVertex3f(-1.0, -1.0, -1.0)
136
- glVertex3f(-1.0, 1.0, -1.0)
137
- glVertex3f( 1.0, 1.0, -1.0)
138
- # Draw the left side in blue
139
- glColor3f(0.0, 0.0, 1.0)
140
- glVertex3f(-1.0, 1.0, 1.0)
141
- glVertex3f(-1.0, 1.0, -1.0)
142
- glVertex3f(-1.0, -1.0, -1.0)
143
- glVertex3f(-1.0, -1.0, 1.0)
144
- # Draw the right side in violet
145
- glColor3f(1.0, 0.0, 1.0)
146
- glVertex3f( 1.0, 1.0, -1.0)
147
- glVertex3f( 1.0, 1.0, 1.0)
148
- glVertex3f( 1.0, -1.0, 1.0)
149
- glVertex3f( 1.0, -1.0, -1.0)
150
- glEnd
151
-
152
- $pyramid_angle += 0.2
153
- $cube_angle -= 0.15
154
- # Swap buffers for display
155
- glutSwapBuffers
156
- end
157
-
158
- # The idle function to handle
159
- def idle
160
- glutPostRedisplay
161
- end
162
-
163
- # Keyboard handler to exit when ESC is typed
164
- keyboard = lambda do |key, x, y|
165
- case(key)
166
- when ?\e
167
- glutDestroyWindow($window)
168
- exit(0)
169
- end
170
- glutPostRedisplay
171
- end
172
-
173
-
174
- # Initliaze our GLUT code
175
- glutInit;
176
- # Setup a double buffer, RGBA color, alpha components and depth buffer
177
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
178
- glutInitWindowSize(640, 480);
179
- glutInitWindowPosition(0, 0);
180
- $window = glutCreateWindow("NeHe Lesson 05 - ruby-opengl version");
181
- glutDisplayFunc(method(:draw_gl_scene).to_proc);
182
- glutReshapeFunc(method(:reshape).to_proc);
183
- glutIdleFunc(method(:idle).to_proc);
184
- glutKeyboardFunc(keyboard);
185
- init_gl_window(640, 480)
186
- glutMainLoop();