opengl 0.7.0.pre1-x86-mingw32 → 0.7.0.pre2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.autotest +29 -0
  2. data/.gitignore +5 -8
  3. data/History.rdoc +33 -0
  4. data/Manifest.txt +72 -57
  5. data/README.rdoc +72 -25
  6. data/Rakefile +60 -72
  7. data/Rakefile.cross +5 -2
  8. data/{doc → docs}/build_install.txt +0 -0
  9. data/{doc → docs}/extensions.txt.in +0 -0
  10. data/{doc → docs}/history.txt +0 -0
  11. data/{doc → docs}/requirements_and_design.txt +0 -0
  12. data/{doc → docs}/roadmap.txt +0 -0
  13. data/{doc → docs}/scientific_use.txt +0 -0
  14. data/{doc → docs}/supplies/page_template.html +0 -0
  15. data/{doc → docs}/thanks.txt +0 -0
  16. data/{doc → docs}/tutorial.txt +0 -0
  17. data/examples/NeHe/NeHe.png +0 -0
  18. data/examples/NeHe/crate.png +0 -0
  19. data/examples/NeHe/glass.png +0 -0
  20. data/examples/NeHe/nehe_lesson02.rb +82 -83
  21. data/examples/NeHe/nehe_lesson03.rb +88 -88
  22. data/examples/NeHe/nehe_lesson04.rb +93 -96
  23. data/examples/NeHe/nehe_lesson05.rb +137 -144
  24. data/examples/NeHe/nehe_lesson06.rb +183 -0
  25. data/examples/NeHe/nehe_lesson07.rb +237 -0
  26. data/examples/NeHe/nehe_lesson08.rb +252 -0
  27. data/examples/NeHe/nehe_lesson09.rb +199 -0
  28. data/examples/NeHe/nehe_lesson11.rb +173 -0
  29. data/examples/NeHe/nehe_lesson12.rb +200 -0
  30. data/examples/NeHe/nehe_lesson16.rb +208 -0
  31. data/examples/NeHe/nehe_lesson19.rb +206 -0
  32. data/examples/NeHe/particle.png +0 -0
  33. data/examples/NeHe/star.png +0 -0
  34. data/examples/NeHe/tim.png +0 -0
  35. data/examples/RedBook/light.rb +154 -0
  36. data/examples/misc/OGLBench.rb +2 -2
  37. data/examples/misc/trislam.rb +2 -2
  38. data/ext/{common → opengl}/common.h +2 -11
  39. data/ext/{common → opengl}/conv.h +43 -31
  40. data/ext/{glut → opengl}/extconf.rb +14 -7
  41. data/ext/{common → opengl}/funcdef.h +155 -125
  42. data/ext/{gl → opengl}/gl-1.0-1.1.c +426 -162
  43. data/ext/{gl → opengl}/gl-1.2.c +70 -66
  44. data/ext/{gl → opengl}/gl-1.3.c +19 -19
  45. data/ext/{gl → opengl}/gl-1.4.c +23 -23
  46. data/ext/{gl → opengl}/gl-1.5.c +46 -47
  47. data/ext/{gl → opengl}/gl-2.0.c +66 -60
  48. data/ext/{gl → opengl}/gl-2.1.c +4 -4
  49. data/ext/{gl → opengl}/gl-enums.c +2 -1
  50. data/ext/{common → opengl}/gl-enums.h +0 -0
  51. data/ext/{gl → opengl}/gl-error.c +12 -4
  52. data/ext/{common → opengl}/gl-error.h +7 -2
  53. data/ext/{gl → opengl}/gl-ext-3dfx.c +1 -1
  54. data/ext/{gl → opengl}/gl-ext-arb.c +75 -70
  55. data/ext/{gl → opengl}/gl-ext-ati.c +3 -3
  56. data/ext/{gl → opengl}/gl-ext-ext.c +54 -54
  57. data/ext/{gl → opengl}/gl-ext-gremedy.c +3 -3
  58. data/ext/{gl → opengl}/gl-ext-nv.c +49 -48
  59. data/ext/{common → opengl}/gl-types.h +0 -0
  60. data/ext/{gl → opengl}/gl.c +8 -10
  61. data/ext/{glu → opengl}/glu-enums.c +1 -1
  62. data/ext/{common → opengl}/glu-enums.h +0 -0
  63. data/ext/{glu → opengl}/glu.c +7 -3
  64. data/ext/{glut → opengl}/glut.c +98 -48
  65. data/ext/opengl/opengl.c +11 -0
  66. data/lib/gl.rb +1 -0
  67. data/lib/glu.rb +1 -0
  68. data/lib/glut.rb +1 -0
  69. data/lib/opengl.rb +13 -14
  70. data/lib/opengl/opengl.so +0 -0
  71. data/lib/opengl/test_case.rb +87 -0
  72. data/test/{tc_misc.rb → test_gl.rb} +2 -14
  73. data/test/test_gl_10_11.rb +1363 -0
  74. data/test/test_gl_12.rb +182 -0
  75. data/test/{tc_func_13.rb → test_gl_13.rb} +14 -14
  76. data/test/test_gl_14.rb +221 -0
  77. data/test/test_gl_15.rb +260 -0
  78. data/test/test_gl_20.rb +430 -0
  79. data/test/test_gl_21.rb +553 -0
  80. data/test/test_gl_ext_arb.rb +526 -0
  81. data/test/{tc_ext_ati.rb → test_gl_ext_ati.rb} +11 -14
  82. data/test/test_gl_ext_ext.rb +608 -0
  83. data/test/{tc_ext_gremedy.rb → test_gl_ext_gremedy.rb} +6 -6
  84. data/test/test_gl_ext_nv.rb +352 -0
  85. data/test/test_glu.rb +309 -0
  86. metadata +159 -102
  87. data/History.txt +0 -36
  88. data/ext/gl/extconf.rb +0 -43
  89. data/ext/glu/extconf.rb +0 -51
  90. data/test/README +0 -10
  91. data/test/tc_common.rb +0 -98
  92. data/test/tc_ext_arb.rb +0 -467
  93. data/test/tc_ext_ext.rb +0 -551
  94. data/test/tc_ext_nv.rb +0 -357
  95. data/test/tc_func_10_11.rb +0 -1281
  96. data/test/tc_func_12.rb +0 -186
  97. data/test/tc_func_14.rb +0 -197
  98. data/test/tc_func_15.rb +0 -270
  99. data/test/tc_func_20.rb +0 -346
  100. data/test/tc_func_21.rb +0 -541
  101. data/test/tc_glu.rb +0 -310
  102. data/test/tc_include_gl.rb +0 -35
  103. data/test/tc_require_gl.rb +0 -34
@@ -1,551 +0,0 @@
1
- #
2
- # Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
3
- #
4
- # This program is distributed under the terms of the MIT license.
5
- # See the included MIT-LICENSE file for the terms of this license.
6
- #
7
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
12
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
13
- # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
- #
15
-
16
- require 'test/unit'
17
-
18
- class Test_EXT_EXT < Test::Unit::TestCase
19
- def setup
20
- common_setup()
21
- end
22
-
23
- def teardown
24
- if Gl.is_available?("GL_EXT_framebuffer_object")
25
- glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0)
26
- glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0)
27
- end
28
- common_teardown()
29
- end
30
-
31
- def test_gl_ext_polygon_offset
32
- return if not supported?("GL_EXT_polygon_offset")
33
-
34
- glPolygonOffsetEXT(1.0,2.0)
35
- assert_equal(glGetIntegerv(GL_POLYGON_OFFSET_FACTOR_EXT),1.0)
36
- assert_equal(glGetIntegerv(GL_POLYGON_OFFSET_BIAS_EXT),2.0)
37
- end
38
-
39
- def test_gl_ext_framebuffer_object
40
- return if not supported?("GL_EXT_framebuffer_object")
41
- t = glGenTextures(3)
42
- glBindTexture(GL_TEXTURE_2D, t[0])
43
- glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,$window_size,$window_size,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
44
-
45
- glBindTexture(GL_TEXTURE_1D, t[1])
46
- glTexImage1D(GL_TEXTURE_1D,0,GL_RGBA8,$window_size,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
47
-
48
- glBindTexture(GL_TEXTURE_3D, t[2])
49
- glTexImage3D(GL_TEXTURE_3D,0,GL_RGBA8,$window_size,$window_size,1,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
50
-
51
- fb = glGenFramebuffersEXT(1)
52
- assert(fb.size==1)
53
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fb[0])
54
- assert_equal(glIsFramebufferEXT(fb[0]),true)
55
-
56
- rb = glGenRenderbuffersEXT(1)
57
- assert(rb.size==1)
58
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,rb[0])
59
- assert_equal(glIsRenderbufferEXT(rb[0]),true)
60
-
61
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, $window_size, $window_size)
62
-
63
- assert_equal(glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_WIDTH_EXT),$window_size)
64
- assert_equal(glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_HEIGHT_EXT),$window_size)
65
- assert_equal(glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_INTERNAL_FORMAT_EXT),GL_DEPTH_COMPONENT)
66
-
67
-
68
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb[0]);
69
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, t[0], 0)
70
-
71
- status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
72
- assert(status == GL_FRAMEBUFFER_COMPLETE_EXT || status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
73
-
74
- assert_equal(glGetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT),GL_TEXTURE)
75
-
76
- glGenerateMipmapEXT(GL_TEXTURE_2D)
77
-
78
- glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_1D, t[1], 0)
79
- glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_3D, t[2], 0, 0)
80
-
81
- glDeleteRenderbuffersEXT(rb)
82
- glDeleteFramebuffersEXT(fb)
83
- glDeleteTextures(t)
84
- end
85
-
86
- def test_gl_ext_gpu_program_parameters
87
- return if not supported?("GL_EXT_gpu_program_parameters")
88
-
89
- glProgramEnvParameters4fvEXT(GL_VERTEX_PROGRAM_ARB,1, [1,2,3,4,5,6,7,8])
90
- assert_equal(glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB,1),[1,2,3,4])
91
- assert_equal(glGetProgramEnvParameterdvARB(GL_VERTEX_PROGRAM_ARB,2),[5,6,7,8])
92
- end
93
-
94
- def test_gl_ext_framebuffer_blit
95
- return if not supported?("GL_EXT_framebuffer_blit")
96
- fbo = glGenFramebuffersEXT(2)
97
- texture = glGenTextures(2)
98
- data = [1,1,1,1, 0,0,0,0, 1,1,1,1, 0,0,0,0]
99
-
100
- glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo[0])
101
- glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo[1])
102
-
103
- glBindTexture(GL_TEXTURE_2D, texture[0])
104
- glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,2,2,0,GL_RGBA,GL_UNSIGNED_BYTE,data.pack("C*"))
105
- glGenerateMipmapEXT(GL_TEXTURE_2D);
106
-
107
- glBindTexture(GL_TEXTURE_2D, texture[1])
108
- glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,2,2,0,GL_RGBA,GL_UNSIGNED_BYTE,nil)
109
- glGenerateMipmapEXT(GL_TEXTURE_2D);
110
-
111
- glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture[0], 0)
112
- glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture[1], 0)
113
-
114
- status = glCheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER_EXT)
115
- assert_equal(status,GL_FRAMEBUFFER_COMPLETE_EXT)
116
- status = glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT)
117
- assert_equal(status,GL_FRAMEBUFFER_COMPLETE_EXT)
118
-
119
- glBlitFramebufferEXT(0, 0, 2, 2,
120
- 0, 0, 2, 2,
121
- GL_COLOR_BUFFER_BIT,
122
- GL_NEAREST)
123
-
124
- glBindTexture(GL_TEXTURE_2D, texture[1])
125
- tex = glGetTexImage(GL_TEXTURE_2D,0,GL_RGBA,GL_UNSIGNED_BYTE).unpack("C*")
126
- assert_equal(tex,data)
127
-
128
- glDeleteTextures(texture)
129
- glDeleteFramebuffersEXT(fbo)
130
- end
131
-
132
- def test_gl_ext_framebuffer_multisample
133
- return if not supported?("GL_EXT_framebuffer_multisample")
134
- rb = glGenRenderbuffersEXT(1)[0]
135
-
136
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,rb)
137
- glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,4,GL_RGBA,2,2)
138
- samples = glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,GL_RENDERBUFFER_SAMPLES_EXT)
139
- assert_equal(samples,4)
140
-
141
- glDeleteRenderbuffersEXT(rb)
142
- end
143
-
144
- def test_gl_ext_pointparameter
145
- return if not supported?("GL_EXT_point_parameters")
146
- glPointParameterfEXT(GL_POINT_SIZE_MIN,1.0)
147
- assert_equal(glGetDoublev(GL_POINT_SIZE_MIN),1.0)
148
-
149
- glPointParameterfvEXT(GL_POINT_DISTANCE_ATTENUATION,[1,0,1])
150
- assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[1,0,1])
151
- end
152
-
153
- def test_gl_ext_stencil_two_side
154
- return if not supported?("GL_EXT_stencil_two_side")
155
- glActiveStencilFaceEXT(GL_FRONT)
156
- assert_equal(glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT),GL_FRONT)
157
- glActiveStencilFaceEXT(GL_BACK)
158
- assert_equal(glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT),GL_BACK)
159
- end
160
-
161
- def test_gl_ext_stencil_clear_tag
162
- return if not supported?("GL_EXT_stencil_clear_tag")
163
- glStencilClearTagEXT(1,2)
164
- assert_equal(glGetIntegerv(GL_STENCIL_TAG_BITS_EXT),1)
165
- assert_equal(glGetIntegerv(GL_STENCIL_CLEAR_TAG_VALUE_EXT),2)
166
- end
167
-
168
- def test_gl_ext_secondary_color
169
- return if not supported?("GL_EXT_secondary_color")
170
-
171
- glSecondaryColor3bEXT(2**7-1,0,2**7-1)
172
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
173
- glSecondaryColor3bvEXT([0,2**7-1,0])
174
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
175
- glSecondaryColor3dEXT(1.0,0.0,1.0)
176
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
177
- glSecondaryColor3dvEXT([0.0,1.0,0.0])
178
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
179
- glSecondaryColor3fEXT(1.0,0.0,1.0)
180
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
181
- glSecondaryColor3fvEXT([0.0,1.0,0.0])
182
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
183
- glSecondaryColor3iEXT(2**31-1,0,2**31-1)
184
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
185
- glSecondaryColor3ivEXT([0,2**31-1,0])
186
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
187
- glSecondaryColor3sEXT(2**15-1,0,2**15-1)
188
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
189
- glSecondaryColor3svEXT([0,2**15-1,0])
190
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
191
- glSecondaryColor3ubEXT(2**8-1,0,2**8-1)
192
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
193
- glSecondaryColor3ubvEXT([0,2**8-1,0])
194
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
195
- glSecondaryColor3uiEXT(2**32-1,0,2**32-1)
196
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
197
- glSecondaryColor3uivEXT([0,2**32-1,0])
198
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
199
- glSecondaryColor3usEXT(2**16-1,0,2**16-1)
200
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
201
- glSecondaryColor3usvEXT([0,2**16-1,0])
202
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
203
-
204
- sc = [0,1,0, 1,0,1].pack("f*")
205
-
206
- glSecondaryColorPointerEXT(3,GL_FLOAT,0,sc)
207
- assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE),3)
208
- assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE),GL_FLOAT)
209
- assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE),0)
210
- assert_equal(glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER),sc)
211
- glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
212
-
213
- glBegin(GL_TRIANGLES)
214
- glArrayElement(0)
215
- glEnd()
216
-
217
- assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0,1,0,1])
218
-
219
- glBegin(GL_TRIANGLES)
220
- glArrayElement(1)
221
- glEnd()
222
-
223
- assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1,0,1,1])
224
-
225
- glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
226
- end
227
-
228
- def test_gl_ext_blend_color
229
- return if not supported?("GL_EXT_blend_color")
230
- glBlendColorEXT(1.0,0.0,1.0,0.0)
231
- assert_equal(glGetFloatv(GL_BLEND_COLOR_EXT),[1,0,1,0])
232
- glBlendColorEXT(0.0,1.0,0.0,1.0)
233
- assert_equal(glGetFloatv(GL_BLEND_COLOR_EXT),[0,1,0,1])
234
- end
235
-
236
- def test_gl_ext_blend_minmax
237
- return if not supported?("GL_EXT_blend_minmax")
238
- glBlendEquationEXT(GL_MIN_EXT)
239
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION_EXT),GL_MIN_EXT)
240
- glBlendEquationEXT(GL_MAX_EXT)
241
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION_EXT),GL_MAX_EXT)
242
- end
243
-
244
- def test_gl_ext_blend_func_separate
245
- return if not supported?("GL_EXT_blend_func_separate")
246
- glBlendFuncSeparateEXT(GL_ZERO,GL_ONE,GL_ZERO,GL_ONE)
247
- assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB_EXT),GL_ZERO)
248
- assert_equal(glGetIntegerv(GL_BLEND_DST_RGB_EXT),GL_ONE)
249
- assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA_EXT),GL_ZERO)
250
- assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA_EXT),GL_ONE)
251
- glBlendFuncSeparateEXT(GL_ONE,GL_ZERO,GL_ONE,GL_ZERO)
252
- assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB_EXT),GL_ONE)
253
- assert_equal(glGetIntegerv(GL_BLEND_DST_RGB_EXT),GL_ZERO)
254
- assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA_EXT),GL_ONE)
255
- assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA_EXT),GL_ZERO)
256
- end
257
-
258
- def test_gl_ext_blend_equation_separate
259
- return if not supported?("GL_EXT_blend_equation_separate")
260
- glBlendEquationSeparateEXT(GL_FUNC_ADD,GL_FUNC_SUBTRACT)
261
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB_EXT),GL_FUNC_ADD)
262
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA_EXT),GL_FUNC_SUBTRACT)
263
- glBlendEquationSeparateEXT(GL_FUNC_SUBTRACT,GL_FUNC_ADD)
264
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION_RGB_EXT),GL_FUNC_SUBTRACT)
265
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION_ALPHA_EXT),GL_FUNC_ADD)
266
- end
267
-
268
- def test_gl_ext_depth_bounds_test
269
- return if not supported?("GL_EXT_depth_bounds_test")
270
- glDepthBoundsEXT(0.2,0.8)
271
- assert(approx_equal(glGetDoublev(GL_DEPTH_BOUNDS_EXT),[0.2,0.8]))
272
- end
273
-
274
- def test_gl_ext_timer_query
275
- return if not supported?("GL_EXT_timer_query")
276
- queries = glGenQueries(2)
277
- glBeginQuery(GL_TIME_ELAPSED_EXT,queries[0])
278
- glBegin(GL_QUADS)
279
- glVertex2i(0,0)
280
- glVertex2i(0,1)
281
- glVertex2i(1,1)
282
- glVertex2i(1,0)
283
- glEnd
284
- glEndQuery(GL_TIME_ELAPSED_EXT)
285
-
286
- while glGetQueryObjectiv(queries[0], GL_QUERY_RESULT_AVAILABLE)==GL_FALSE
287
- #
288
- end
289
- assert(glGetQueryObjecti64vEXT(queries[0], GL_QUERY_RESULT)>0)
290
- assert(glGetQueryObjectui64vEXT(queries[0], GL_QUERY_RESULT)>0)
291
-
292
- glDeleteQueries(queries)
293
- end
294
-
295
- def test_gl_ext_texture_object
296
- return if not supported?("GL_EXT_texture_object")
297
- textures = glGenTexturesEXT(2)
298
- glBindTextureEXT(GL_TEXTURE_1D,textures[0])
299
- glBindTextureEXT(GL_TEXTURE_2D,textures[1])
300
- assert_equal(glIsTextureEXT(textures[0]),true)
301
- assert_equal(glAreTexturesResidentEXT(textures).size,2)
302
-
303
- glPrioritizeTexturesEXT(textures,[0.5,1.0])
304
- assert_equal(glGetTexParameterfv(GL_TEXTURE_1D,GL_TEXTURE_PRIORITY),0.5)
305
- assert_equal(glGetTexParameterfv(GL_TEXTURE_2D,GL_TEXTURE_PRIORITY),1.0)
306
-
307
- glDeleteTexturesEXT(textures)
308
- assert_equal(glIsTextureEXT(textures[0]),false)
309
- end
310
-
311
- def test_gl_ext_compiled_vertex_array
312
- return if not supported?("GL_EXT_compiled_vertex_array")
313
- glLockArraysEXT(1,2)
314
- assert_equal(glGetIntegerv(GL_ARRAY_ELEMENT_LOCK_FIRST_EXT),1)
315
- assert_equal(glGetIntegerv(GL_ARRAY_ELEMENT_LOCK_COUNT_EXT),2)
316
- glUnlockArraysEXT()
317
- end
318
-
319
- def test_gl_ext_fogcoord
320
- return if not supported?("GL_EXT_fog_coord")
321
-
322
- glFogCoordfEXT(2.0)
323
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
324
- glFogCoordfvEXT([3.0])
325
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
326
-
327
- glFogCoorddEXT(2.0)
328
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
329
- glFogCoorddvEXT([3.0])
330
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
331
-
332
- fc = [1, 0].pack("f*")
333
- glFogCoordPointerEXT(GL_FLOAT,0,fc)
334
- assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE),GL_FLOAT)
335
- assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE),0)
336
- assert_equal(glGetPointerv(GL_FOG_COORD_ARRAY_POINTER),fc)
337
-
338
- glEnableClientState(GL_FOG_COORD_ARRAY)
339
-
340
- glBegin(GL_TRIANGLES)
341
- glArrayElement(0)
342
- glEnd()
343
-
344
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),1)
345
-
346
- glBegin(GL_TRIANGLES)
347
- glArrayElement(1)
348
- glEnd()
349
-
350
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),0)
351
-
352
- glDisableClientState(GL_FOG_COORD_ARRAY)
353
- end
354
-
355
- def test_gl_ext_multi_draw_arrays
356
- return if not supported?("GL_EXT_multi_draw_arrays")
357
- va = [0,0, 1,0, 1,1, 0,0, 1,0, 0,1].pack("f*")
358
- glVertexPointer(2,GL_FLOAT,0,va)
359
-
360
- glEnable(GL_VERTEX_ARRAY)
361
-
362
- buf = glFeedbackBuffer(256,GL_3D)
363
- glRenderMode(GL_FEEDBACK)
364
-
365
- glMultiDrawArraysEXT(GL_POLYGON, [0,3], [3,3])
366
-
367
- i1 = [0,1,2].pack("C*")
368
- i2 = [3,4,5].pack("C*")
369
- glMultiDrawElementsEXT(GL_TRIANGLES,GL_UNSIGNED_BYTE,[i1,i2])
370
-
371
- count = glRenderMode(GL_RENDER)
372
- assert_equal(count,(3*3+2)*4)
373
- glDisable(GL_VERTEX_ARRAY)
374
- end
375
-
376
- def test_gl_ext_drawrangeelements
377
- return if not supported?("GL_EXT_draw_range_elements")
378
- va = [0,0, 0,1, 1,1].pack("f*")
379
- glVertexPointer(2,GL_FLOAT,0,va)
380
-
381
- buf = glFeedbackBuffer(256,GL_3D)
382
- glRenderMode(GL_FEEDBACK)
383
-
384
- glEnable(GL_VERTEX_ARRAY)
385
-
386
- glDrawRangeElementsEXT(GL_POINTS,0,2,3,GL_UNSIGNED_BYTE,[0,1,2].pack("C*"))
387
- count = glRenderMode(GL_RENDER)
388
- assert_equal(count,12)
389
-
390
- glDisable(GL_VERTEX_ARRAY)
391
- end
392
-
393
- def test_gl_ext_geometry_shader4
394
- return if not supported?("GL_EXT_geometry_shader4")
395
- program = glCreateProgramObjectARB()
396
-
397
- glProgramParameteriEXT(program,GL_GEOMETRY_INPUT_TYPE_EXT ,GL_LINES_ADJACENCY_EXT)
398
- assert_equal(glGetObjectParameterivARB(program,GL_GEOMETRY_INPUT_TYPE_EXT),GL_LINES_ADJACENCY_EXT)
399
-
400
- glDeleteObjectARB(program)
401
- end
402
-
403
- def test_gl_ext_gpu_shader4
404
- return if not supported?(["GL_EXT_gpu_shader4","GL_ARB_vertex_program"])
405
-
406
- programs = glGenProgramsARB(1)
407
- program = "!!ARBvp1.0\nTEMP vv;\nEND"
408
-
409
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, programs[0])
410
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, program)
411
-
412
- glVertexAttribI1iEXT(1,1)
413
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],1)
414
- glVertexAttribI1uiEXT(1,2)
415
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],2)
416
- glVertexAttribI1ivEXT(1,[3])
417
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],3)
418
- glVertexAttribI1uivEXT(1,[4])
419
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0],4)
420
-
421
- glVertexAttribI2iEXT(1,1,2)
422
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[1,2])
423
- glVertexAttribI2uiEXT(1,2,3)
424
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[2,3])
425
- glVertexAttribI2ivEXT(1,[3,4])
426
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[3,4])
427
- glVertexAttribI2uivEXT(1,[4,5])
428
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,2],[4,5])
429
-
430
- glVertexAttribI3iEXT(1,1,2,3)
431
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[1,2,3])
432
- glVertexAttribI3uiEXT(1,2,3,4)
433
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[2,3,4])
434
- glVertexAttribI3ivEXT(1,[3,4,5])
435
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[3,4,5])
436
- glVertexAttribI3uivEXT(1,[4,5,6])
437
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB)[0,3],[4,5,6])
438
-
439
- glVertexAttribI4iEXT(1,1,2,3,4)
440
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[1,2,3,4])
441
- glVertexAttribI4uiEXT(1,2,3,4,5)
442
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[2,3,4,5])
443
- glVertexAttribI4ivEXT(1,[3,4,5,6])
444
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[3,4,5,6])
445
- glVertexAttribI4uivEXT(1,[4,5,6,7])
446
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[4,5,6,7])
447
-
448
- glVertexAttribI4bvEXT(1,[1,2,3,4])
449
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[1,2,3,4])
450
- glVertexAttribI4svEXT(1,[2,3,4,5])
451
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[2,3,4,5])
452
- glVertexAttribI4ubvEXT(1,[1,2,3,4])
453
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[1,2,3,4])
454
- glVertexAttribI4usvEXT(1,[2,3,4,5])
455
- assert_equal(glGetVertexAttribIivEXT(1,GL_CURRENT_VERTEX_ATTRIB_ARB),[2,3,4,5])
456
-
457
- glVertexAttribIPointerEXT(1,2,GL_INT,0,[1,1].pack("i*"))
458
- assert_equal(glGetVertexAttribPointervARB(1),[1,1].pack("i*"))
459
-
460
- glDeleteProgramsARB(programs)
461
- end
462
-
463
- def test_gl_ext_gpu_shader4_2
464
- return if not supported?(["GL_EXT_gpu_shader4","GL_ARB_shader_objects"])
465
-
466
- vertex_shader_source = "attribute vec4 test; uniform float testvec1; uniform vec2 testvec2; uniform vec3 testvec3; uniform vec4 testvec4; uniform unsigned int testivec1; uniform uvec2 testivec2; uniform uvec3 testivec3; uniform uvec4 testivec4; void main() { gl_Position = testvec1 * test * testvec2.x * testvec3.x * testivec1 * testivec2.x * testivec3.x * testivec4.x + testvec4;}"
467
-
468
- program = glCreateProgramObjectARB()
469
- vs = glCreateShaderObjectARB(GL_VERTEX_SHADER)
470
- glShaderSourceARB(vs,vertex_shader_source)
471
-
472
- glCompileShaderARB(vs)
473
- glAttachObjectARB(program,vs)
474
- glLinkProgramARB(program)
475
- glUseProgramObjectARB(program)
476
-
477
- assert((tv1il = glGetUniformLocationARB(program,"testivec1"))>=0)
478
- assert((tv2il = glGetUniformLocationARB(program,"testivec2"))>=0)
479
- assert((tv3il = glGetUniformLocationARB(program,"testivec3"))>=0)
480
- assert((tv4il = glGetUniformLocationARB(program,"testivec4"))>=0)
481
-
482
- glUniform1uiEXT(tv1il,3)
483
- assert_equal(glGetUniformuivEXT(program,tv1il),3)
484
- glUniform1uivEXT(tv1il,[4])
485
- assert_equal(glGetUniformuivEXT(program,tv1il),4)
486
- glUniform2uiEXT(tv2il,1,2)
487
- assert_equal(glGetUniformuivEXT(program,tv2il),[1,2])
488
- glUniform2uivEXT(tv2il,[3,4])
489
- assert_equal(glGetUniformuivEXT(program,tv2il),[3,4])
490
- glUniform3uiEXT(tv3il,1,2,3)
491
- assert_equal(glGetUniformuivEXT(program,tv3il),[1,2,3])
492
- glUniform3uivEXT(tv3il,[3,4,5])
493
- assert_equal(glGetUniformuivEXT(program,tv3il),[3,4,5])
494
- glUniform4uiEXT(tv4il,1,2,3,4)
495
- assert_equal(glGetUniformuivEXT(program,tv4il),[1,2,3,4])
496
- glUniform4uivEXT(tv4il,[3,4,5,6])
497
- assert_equal(glGetUniformuivEXT(program,tv4il),[3,4,5,6])
498
-
499
- glBindFragDataLocationEXT(program,1,"test")
500
- assert_equal(glGetFragDataLocationEXT(program,"test"),-1)
501
- end
502
-
503
- def test_gl_ext_draw_instanced
504
- return if not supported?("GL_EXT_draw_instanced")
505
-
506
- glEnableClientState(GL_VERTEX_ARRAY)
507
-
508
- va = [0,0, 0,1, 1,1].pack("f*")
509
- glVertexPointer(2,GL_FLOAT,0,va)
510
-
511
- buf = glFeedbackBuffer(256,GL_3D)
512
- glRenderMode(GL_FEEDBACK)
513
-
514
- glDrawArraysInstancedEXT(GL_TRIANGLES,0,3,2)
515
-
516
- glDrawElementsInstancedEXT(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,[0,1,2].pack("C*"),2)
517
- count = glRenderMode(GL_RENDER)
518
- assert_equal(count,2*2*11)
519
-
520
- glDisableClientState(GL_VERTEX_ARRAY)
521
- end
522
-
523
- def test_gl_ext_texture_buffer_object
524
- return if not supported?("GL_EXT_texture_buffer_object")
525
-
526
- buf = glGenBuffers(1)[0]
527
- glBindBuffer(GL_TEXTURE_BUFFER_EXT, buf)
528
-
529
- tex = glGenTextures(1)[0]
530
- glBindTexture(GL_TEXTURE_BUFFER_EXT, tex)
531
- glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA32F_ARB, buf)
532
-
533
- assert_equal(glGetIntegerv(GL_TEXTURE_BINDING_BUFFER_EXT),tex)
534
- assert_equal(glGetIntegerv(GL_TEXTURE_BUFFER_FORMAT_EXT),GL_RGBA32F_ARB)
535
-
536
- glDeleteBuffers(buf)
537
- glDeleteTextures(tex)
538
- end
539
-
540
- def test_gl_ext_texture_integer
541
- return if not supported?("GL_EXT_texture_integer")
542
-
543
- glClearColorIiEXT(1,2,3,4)
544
- glClearColorIuiEXT(1,2,3,4)
545
-
546
- glTexParameterIivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,[1,2,3,4])
547
- assert_equal(glGetTexParameterIivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR),[1,2,3,4])
548
- glTexParameterIuivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR,[5,6,7,8])
549
- assert_equal(glGetTexParameterIuivEXT(GL_TEXTURE_2D,GL_TEXTURE_BORDER_COLOR),[5,6,7,8])
550
- end
551
- end