ruby-opengl 0.50.0 → 0.60.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/Rakefile +15 -11
  2. data/doc/build_install.txt +10 -6
  3. data/doc/extensions.txt.in +348 -0
  4. data/doc/history.txt +4 -0
  5. data/doc/roadmap.txt +4 -6
  6. data/doc/scientific_use.txt +7 -0
  7. data/doc/supplies/page_template.html +2 -1
  8. data/doc/thanks.txt +5 -0
  9. data/doc/tutorial.txt +431 -121
  10. data/examples/NeHe/nehe_lesson02.rb +1 -1
  11. data/examples/NeHe/nehe_lesson03.rb +1 -1
  12. data/examples/NeHe/nehe_lesson04.rb +1 -1
  13. data/examples/NeHe/nehe_lesson05.rb +1 -1
  14. data/examples/NeHe/nehe_lesson36.rb +1 -1
  15. data/examples/OrangeBook/brick.rb +3 -15
  16. data/examples/OrangeBook/particle.rb +2 -20
  17. data/examples/RedBook/aapoly.rb +1 -1
  18. data/examples/RedBook/aargb.rb +2 -2
  19. data/examples/RedBook/accanti.rb +1 -1
  20. data/examples/RedBook/accpersp.rb +1 -1
  21. data/examples/RedBook/alpha.rb +2 -2
  22. data/examples/RedBook/alpha3D.rb +1 -1
  23. data/examples/RedBook/bezcurve.rb +1 -1
  24. data/examples/RedBook/bezmesh.rb +1 -1
  25. data/examples/RedBook/checker.rb +1 -1
  26. data/examples/RedBook/clip.rb +1 -1
  27. data/examples/RedBook/colormat.rb +1 -1
  28. data/examples/RedBook/cube.rb +1 -1
  29. data/examples/RedBook/depthcue.rb +1 -1
  30. data/examples/RedBook/dof.rb +1 -1
  31. data/examples/RedBook/double.rb +1 -1
  32. data/examples/RedBook/drawf.rb +1 -1
  33. data/examples/RedBook/feedback.rb +1 -1
  34. data/examples/RedBook/fog.rb +1 -1
  35. data/examples/RedBook/font.rb +2 -2
  36. data/examples/RedBook/hello.rb +1 -1
  37. data/examples/RedBook/image.rb +4 -4
  38. data/examples/RedBook/lines.rb +1 -1
  39. data/examples/RedBook/list.rb +1 -1
  40. data/examples/RedBook/material.rb +1 -1
  41. data/examples/RedBook/mipmap.rb +1 -1
  42. data/examples/RedBook/model.rb +1 -1
  43. data/examples/RedBook/movelight.rb +1 -1
  44. data/examples/RedBook/pickdepth.rb +1 -1
  45. data/examples/RedBook/planet.rb +5 -5
  46. data/examples/RedBook/quadric.rb +1 -1
  47. data/examples/RedBook/robot.rb +5 -5
  48. data/examples/RedBook/select.rb +1 -1
  49. data/examples/RedBook/smooth.rb +1 -1
  50. data/examples/RedBook/stencil.rb +1 -1
  51. data/examples/RedBook/stroke.rb +2 -2
  52. data/examples/RedBook/surface.rb +1 -1
  53. data/examples/RedBook/teaambient.rb +1 -1
  54. data/examples/RedBook/teapots.rb +1 -1
  55. data/examples/RedBook/tess.rb +1 -1
  56. data/examples/RedBook/texbind.rb +1 -1
  57. data/examples/RedBook/texgen.rb +5 -5
  58. data/examples/RedBook/texturesurf.rb +1 -1
  59. data/examples/RedBook/varray.rb +1 -1
  60. data/examples/RedBook/wrap.rb +5 -5
  61. data/examples/misc/OGLBench.rb +337 -0
  62. data/examples/misc/anisotropic.rb +1 -1
  63. data/examples/misc/fbo_test.rb +356 -0
  64. data/examples/misc/font-glut.rb +1 -1
  65. data/examples/misc/glfwtest.rb +30 -0
  66. data/examples/misc/md2model.rb +15 -0
  67. data/examples/misc/plane.rb +1 -1
  68. data/examples/misc/readpixel.rb +1 -1
  69. data/examples/misc/sdltest.rb +34 -0
  70. data/examples/misc/trislam.rb +828 -0
  71. data/ext/common/common.h +126 -218
  72. data/ext/common/conv.h +244 -0
  73. data/ext/common/funcdef.h +280 -0
  74. data/ext/common/gl-error.h +23 -0
  75. data/ext/common/gl-types.h +14 -0
  76. data/ext/gl/gl-1.0-1.1.c +497 -1255
  77. data/ext/gl/gl-1.2.c +121 -304
  78. data/ext/gl/gl-1.3.c +78 -339
  79. data/ext/gl/gl-1.4.c +102 -164
  80. data/ext/gl/gl-1.5.c +42 -173
  81. data/ext/gl/gl-2.0.c +273 -1039
  82. data/ext/gl/gl-2.1.c +15 -19
  83. data/ext/gl/gl-enums.c +3 -2
  84. data/ext/gl/gl-error.c +104 -0
  85. data/ext/gl/gl-ext-3dfx.c +27 -0
  86. data/ext/gl/gl-ext-arb.c +812 -12
  87. data/ext/gl/gl-ext-ati.c +41 -0
  88. data/ext/gl/gl-ext-ext.c +791 -119
  89. data/ext/gl/gl-ext-gremedy.c +41 -0
  90. data/ext/gl/gl-ext-nv.c +679 -0
  91. data/ext/gl/gl.c +48 -28
  92. data/ext/gl/mkrf_conf.rb +13 -10
  93. data/ext/glu/glu-enums.c +3 -2
  94. data/ext/glu/glu.c +136 -41
  95. data/ext/glu/mkrf_conf.rb +15 -12
  96. data/ext/glut/glut.c +37 -80
  97. data/ext/glut/mkrf_conf.rb +17 -13
  98. data/lib/opengl.rb +29 -53
  99. data/test/tc_common.rb +9 -3
  100. data/test/tc_ext_arb.rb +397 -3
  101. data/test/tc_ext_ati.rb +33 -0
  102. data/test/tc_ext_ext.rb +479 -2
  103. data/test/tc_ext_gremedy.rb +36 -0
  104. data/test/tc_ext_nv.rb +357 -0
  105. data/test/tc_func_10_11.rb +93 -67
  106. data/test/tc_func_12.rb +11 -11
  107. data/test/tc_func_13.rb +38 -18
  108. data/test/tc_func_14.rb +2 -2
  109. data/test/tc_func_15.rb +10 -10
  110. data/test/tc_func_20.rb +20 -20
  111. data/test/tc_func_21.rb +53 -22
  112. data/test/tc_glu.rb +9 -4
  113. data/test/tc_misc.rb +15 -2
  114. metadata +22 -8
  115. data/doc/extensions.txt +0 -361
  116. data/examples/RedBook/aaindex.rb +0 -97
  117. data/examples/misc/smooth.rb +0 -42
  118. data/examples/misc/test.rb +0 -65
@@ -94,7 +94,7 @@ end
94
94
  # Keyboard handler to exit when ESC is typed
95
95
  keyboard = lambda do |key, x, y|
96
96
  case(key)
97
- when 27
97
+ when ?\e
98
98
  glutDestroyWindow(window)
99
99
  exit(0)
100
100
  end
@@ -99,7 +99,7 @@ end
99
99
  # Keyboard handler to exit when ESC is typed
100
100
  keyboard = lambda do |key, x, y|
101
101
  case(key)
102
- when 27
102
+ when ?\e
103
103
  glutDestroyWindow(window)
104
104
  exit(0)
105
105
  end
@@ -110,7 +110,7 @@ end
110
110
  # Keyboard handler to exit when ESC is typed
111
111
  keyboard = lambda do |key, x, y|
112
112
  case(key)
113
- when 27
113
+ when ?\e
114
114
  glutDestroyWindow($window)
115
115
  exit(0)
116
116
  end
@@ -163,7 +163,7 @@ end
163
163
  # Keyboard handler to exit when ESC is typed
164
164
  keyboard = lambda do |key, x, y|
165
165
  case(key)
166
- when 27
166
+ when ?\e
167
167
  glutDestroyWindow($window)
168
168
  exit(0)
169
169
  end
@@ -58,7 +58,7 @@ end
58
58
  # Keyboard handler to exit when ESC is typed
59
59
  keyboard = lambda do |key, x, y|
60
60
  case(key)
61
- when 27
61
+ when ?\e
62
62
  exit(0)
63
63
  end
64
64
  glutPostRedisplay
@@ -156,11 +156,11 @@ key = lambda do |key,x,y|
156
156
  case(key)
157
157
  when ?b
158
158
  nextClearColor()
159
- when ?q, 27 # esc
159
+ when ?q, ?\e # esc
160
160
  exit(0)
161
161
  when ?t
162
162
  $gleModel << $gleModel.shift # rotate the array
163
- when 32 # spacebar
163
+ when ?\s # space
164
164
  $rotate = !$rotate
165
165
 
166
166
  if ($rotate==false)
@@ -286,21 +286,12 @@ timer = lambda do |value|
286
286
  glutTimerFunc(TIMER_FREQUENCY_MILLIS , timer, 0)
287
287
  end
288
288
 
289
- def printOpenGLError
290
- glErr = glGetError()
291
- if (glErr != GL_NO_ERROR)
292
- puts "glError - #{gluErrorString(glErr)}"
293
- raise
294
- end
295
- end
296
-
297
289
  def getUniLoc(program, name)
298
290
  loc = glGetUniformLocation(program, name)
299
291
 
300
292
  if (loc == -1)
301
293
  puts "No such uniform named #{name}"
302
294
  end
303
- printOpenGLError()
304
295
  return loc
305
296
  end
306
297
 
@@ -316,14 +307,12 @@ def installBrickShaders(vs_fname,fs_fname)
316
307
  # Compile the brick vertex shader, and print out
317
308
  # the compiler log file.
318
309
  glCompileShader(brickVS)
319
- printOpenGLError()
320
310
  vertCompiled = glGetShaderiv(brickVS, GL_COMPILE_STATUS)
321
311
  puts "Shader InfoLog:\n#{glGetShaderInfoLog(brickVS)}\n"
322
312
 
323
313
  # Compile the brick fragment shader, and print out
324
314
  # the compiler log file.
325
315
  glCompileShader(brickFS)
326
- printOpenGLError()
327
316
  fragCompiled = glGetShaderiv(brickFS, GL_COMPILE_STATUS)
328
317
  puts "Shader InfoLog:\n#{glGetShaderInfoLog(brickFS)}\n"
329
318
 
@@ -333,8 +322,7 @@ def installBrickShaders(vs_fname,fs_fname)
333
322
  glAttachShader(brickProg,brickVS)
334
323
  glAttachShader(brickProg,brickFS)
335
324
  # Link the program object and print out the info log
336
- glLinkProgram(brickProg)
337
- printOpenGLError()
325
+ glLinkProgram(brickProg)
338
326
  linked = glGetProgramiv(brickProg,GL_LINK_STATUS)
339
327
  puts "Program InfoLog:\n#{glGetProgramInfoLog(brickProg)}\n"
340
328
  return false if linked==0
@@ -74,14 +74,6 @@ $colors = []
74
74
  $velocities = []
75
75
  $startTimes = []
76
76
 
77
- def printOpenGLError
78
- glErr = glGetError()
79
- if (glErr != GL_NO_ERROR)
80
- puts "glError - #{gluErrorString(glErr)}"
81
- raise
82
- end
83
- end
84
-
85
77
  def nextClearColor
86
78
  glClearColor($clearColor[0][0],
87
79
  $clearColor[0][1],
@@ -96,7 +88,6 @@ def getUniLoc(program, name)
96
88
  if (loc == -1)
97
89
  puts "No such uniform named #{name}"
98
90
  end
99
- printOpenGLError()
100
91
  return loc
101
92
  end
102
93
 
@@ -109,8 +100,6 @@ def updateAnim
109
100
  end
110
101
 
111
102
  glUniform1f(location,$particleTime)
112
-
113
- printOpenGLError()
114
103
  end
115
104
 
116
105
  def drawPoints
@@ -175,9 +164,7 @@ end
175
164
  play = lambda do
176
165
  thisTime = glutGet(GLUT_ELAPSED_TIME)
177
166
  updateAnim()
178
- printOpenGLError()
179
167
  glutPostRedisplay()
180
- printOpenGLError()
181
168
  end
182
169
 
183
170
  display = lambda do
@@ -204,9 +191,9 @@ key = lambda do |key,x,y|
204
191
  case(key)
205
192
  when ?b
206
193
  nextClearColor()
207
- when ?q, 27 # esc
194
+ when ?q, ?\e # esc
208
195
  exit(0)
209
- when 32 # spacebar
196
+ when ?\s # space
210
197
  $rotate = !$rotate
211
198
 
212
199
  if ($rotate==false)
@@ -344,14 +331,12 @@ def installParticleShaders(vs_name,fs_name)
344
331
  # Compile the particle vertex shader, and print out
345
332
  # the compiler log file.
346
333
  glCompileShader($vertexShaderObject)
347
- printOpenGLError()
348
334
  vertCompiled = glGetShaderiv($vertexShaderObject, GL_COMPILE_STATUS)
349
335
  puts "Shader InfoLog:\n#{glGetShaderInfoLog($vertexShaderObject)}\n"
350
336
 
351
337
  # Compile the particle fragment shader, and print out
352
338
  # the compiler log file.
353
339
  glCompileShader($fragmentShaderObject)
354
- printOpenGLError()
355
340
  fragCompiled = glGetShaderiv($fragmentShaderObject, GL_COMPILE_STATUS)
356
341
  puts "Shader InfoLog:\n#{glGetShaderInfoLog($fragmentShaderObject)}\n"
357
342
 
@@ -368,7 +353,6 @@ def installParticleShaders(vs_name,fs_name)
368
353
 
369
354
  # Link the program object and print out the info log
370
355
  glLinkProgram($programObject)
371
- printOpenGLError()
372
356
  linked = glGetProgramiv($programObject, GL_LINK_STATUS)
373
357
  puts "Program InfoLog:\n#{glGetProgramInfoLog($programObject)}\n"
374
358
 
@@ -379,9 +363,7 @@ def installParticleShaders(vs_name,fs_name)
379
363
 
380
364
  # Set up initial uniform values
381
365
  glUniform4f(getUniLoc($programObject, "Background"), 0.0, 0.0, 0.0, 1.0)
382
- printOpenGLError();
383
366
  glUniform1f(getUniLoc($programObject, "Time"), -5.0)
384
- printOpenGLError();
385
367
 
386
368
  return true
387
369
  end
@@ -123,7 +123,7 @@ keyboard = proc do |key, x, y|
123
123
  when ?t ,?T
124
124
  $polySmooth = !$polySmooth
125
125
  glutPostRedisplay()
126
- when 27
126
+ when ?\e
127
127
  exit(0) # Escape key
128
128
  end
129
129
  end
@@ -95,11 +95,11 @@ end
95
95
 
96
96
  keyboard = Proc.new do |key, x, y|
97
97
  case (key)
98
- when 'r'[0],'R'[0]
98
+ when ?r,?R
99
99
  $rotAngle = $rotAngle + 20.0
100
100
  $rotAngle = 0.0 if ($rotAngle >= 360.0)
101
101
  glutPostRedisplay()
102
- when 27 # Escape Key
102
+ when ?\e # Escape Key
103
103
  exit(0)
104
104
  end
105
105
  end
@@ -141,7 +141,7 @@ end
141
141
 
142
142
  keyboard = Proc.new do |key, x, y|
143
143
  case (key)
144
- when 27
144
+ when ?\e
145
145
  exit(0);
146
146
  end
147
147
  end
@@ -195,7 +195,7 @@ end
195
195
 
196
196
  keyboard = proc do |key, x, y|
197
197
  case (key)
198
- when 27
198
+ when ?\e
199
199
  exit(0)
200
200
  end
201
201
  end
@@ -100,10 +100,10 @@ end
100
100
 
101
101
  keyboard = Proc.new do|key, x, y|
102
102
  case (key)
103
- when 't'[0],'T'[0]
103
+ when ?t,?T
104
104
  $leftFirst = !$leftFirst
105
105
  glutPostRedisplay()
106
- when 27 # Escape key
106
+ when ?\e # Escape key
107
107
  exit(0)
108
108
  end
109
109
  end
@@ -141,7 +141,7 @@ keyboard = proc do |key, x, y|
141
141
  $solidZ = MAXZ
142
142
  $transparentZ = MINZ
143
143
  glutPostRedisplay()
144
- when 27
144
+ when ?\e
145
145
  exit(0)
146
146
  end
147
147
  end
@@ -88,7 +88,7 @@ end
88
88
 
89
89
  keyboard = proc do |key, x, y|
90
90
  case (key)
91
- when 27
91
+ when ?\e
92
92
  exit(0)
93
93
  end
94
94
  end
@@ -120,7 +120,7 @@ end
120
120
 
121
121
  keyboard = Proc.new do |key, x, y|
122
122
  case (key)
123
- when 27
123
+ when ?\e
124
124
  exit(0);
125
125
  end
126
126
  end
@@ -107,7 +107,7 @@ end
107
107
 
108
108
  keyboard = Proc.new do |key, x, y|
109
109
  case (key)
110
- when 27
110
+ when ?\e
111
111
  exit(0)
112
112
  end
113
113
  end
@@ -78,7 +78,7 @@ end
78
78
 
79
79
  keyboard = Proc.new do |key, x, y|
80
80
  case (key)
81
- when 27
81
+ when ?\e
82
82
  exit(0)
83
83
  end
84
84
  end
@@ -117,7 +117,7 @@ end
117
117
 
118
118
  keyboard = Proc.new do |key, x, y|
119
119
  case (key)
120
- when 27
120
+ when ?\e
121
121
  exit(0)
122
122
  end
123
123
  end
@@ -53,7 +53,7 @@ end
53
53
 
54
54
  keyboard = Proc.new do |key, x, y|
55
55
  case (key)
56
- when 27
56
+ when ?\e
57
57
  exit(0);
58
58
  end
59
59
  end
@@ -81,7 +81,7 @@ end
81
81
 
82
82
  keyboard = Proc.new do |key, x, y|
83
83
  case (key)
84
- when 27
84
+ when ?\e
85
85
  exit(0)
86
86
  end
87
87
  end
@@ -184,7 +184,7 @@ end
184
184
 
185
185
  keyboard = proc do |key, x, y|
186
186
  case (key)
187
- when 27
187
+ when ?\e
188
188
  exit(0)
189
189
  end
190
190
  end
@@ -85,7 +85,7 @@ end
85
85
 
86
86
  keyboard = Proc.new do |key, x, y|
87
87
  case (key)
88
- when 27
88
+ when ?\e
89
89
  exit(0)
90
90
  end
91
91
  end
@@ -71,7 +71,7 @@ end
71
71
 
72
72
  keyboard = Proc.new do |key, x, y|
73
73
  case (key)
74
- when 27
74
+ when ?\e
75
75
  exit(0)
76
76
  end
77
77
  end
@@ -129,7 +129,7 @@ end
129
129
 
130
130
  keyboard = proc do |key, x, y|
131
131
  case (key)
132
- when 27
132
+ when ?\e
133
133
  exit(0)
134
134
  end
135
135
  end
@@ -140,7 +140,7 @@ end
140
140
 
141
141
  keyboard = Proc.new do |key, x, y|
142
142
  case (key)
143
- when 27
143
+ when ?\e
144
144
  exit(0)
145
145
  end
146
146
  end
@@ -100,7 +100,7 @@ end
100
100
  def printString(s)
101
101
  glPushAttrib(GL_LIST_BIT)
102
102
  glListBase($fontOffset)
103
- glCallLists(s)
103
+ glCallLists(GL_BYTE,s)
104
104
  glPopAttrib()
105
105
  end
106
106
 
@@ -131,7 +131,7 @@ end
131
131
 
132
132
  keyboard = proc do |key, x, y|
133
133
  case (key)
134
- when 27
134
+ when ?\e
135
135
  exit(0)
136
136
  end
137
137
  end
@@ -63,7 +63,7 @@ end
63
63
 
64
64
  keyboard = Proc.new do |key, x, y|
65
65
  case (key)
66
- when 27
66
+ when ?\e
67
67
  exit(0);
68
68
  end
69
69
  end
@@ -103,23 +103,23 @@ end
103
103
 
104
104
  keyboard = Proc.new do |key, x, y|
105
105
  case (key)
106
- when 'r'[0],'R'[0]
106
+ when ?r,?R
107
107
  $zoomFactor = 1.0
108
108
  glutPostRedisplay()
109
109
  printf("zoomFactor reset to 1.0\n")
110
- when 'z'[0]
110
+ when ?z
111
111
  $zoomFactor = $zoomFactor + 0.5
112
112
  if ($zoomFactor >= 3.0)
113
113
  $zoomFactor = 3.0
114
114
  end
115
115
  printf("zoomFactor is now %4.1f\n", $zoomFactor)
116
- when 'Z'[0]
116
+ when ?Z
117
117
  $zoomFactor = $zoomFactor - 0.5
118
118
  if ($zoomFactor <= 0.5)
119
119
  $zoomFactor = 0.5
120
120
  end
121
121
  printf("zoomFactor is now %4.1f\n", $zoomFactor)
122
- when 27
122
+ when ?\e
123
123
  exit(0)
124
124
  end
125
125
  end
@@ -111,7 +111,7 @@ end
111
111
 
112
112
  keyboard = Proc.new do |key, x, y|
113
113
  case (key)
114
- when 27
114
+ when ?\e
115
115
  exit(0)
116
116
  end
117
117
  end