opengl 0.7.0.pre1-x86-mingw32

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.
Files changed (141) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +8 -0
  3. data/History.txt +36 -0
  4. data/MIT-LICENSE +18 -0
  5. data/Manifest.txt +140 -0
  6. data/README.rdoc +51 -0
  7. data/Rakefile +129 -0
  8. data/Rakefile.cross +104 -0
  9. data/doc/build_install.txt +119 -0
  10. data/doc/extensions.txt.in +348 -0
  11. data/doc/history.txt +66 -0
  12. data/doc/requirements_and_design.txt +117 -0
  13. data/doc/roadmap.txt +28 -0
  14. data/doc/scientific_use.txt +35 -0
  15. data/doc/supplies/page_template.html +71 -0
  16. data/doc/thanks.txt +29 -0
  17. data/doc/tutorial.txt +469 -0
  18. data/examples/NeHe/nehe_lesson02.rb +117 -0
  19. data/examples/NeHe/nehe_lesson03.rb +122 -0
  20. data/examples/NeHe/nehe_lesson04.rb +133 -0
  21. data/examples/NeHe/nehe_lesson05.rb +186 -0
  22. data/examples/NeHe/nehe_lesson36.rb +303 -0
  23. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  24. data/examples/OrangeBook/brick.frag +36 -0
  25. data/examples/OrangeBook/brick.rb +376 -0
  26. data/examples/OrangeBook/brick.vert +41 -0
  27. data/examples/OrangeBook/particle.frag +17 -0
  28. data/examples/OrangeBook/particle.rb +406 -0
  29. data/examples/OrangeBook/particle.vert +38 -0
  30. data/examples/README +16 -0
  31. data/examples/RedBook/aapoly.rb +142 -0
  32. data/examples/RedBook/aargb.rb +119 -0
  33. data/examples/RedBook/accanti.rb +162 -0
  34. data/examples/RedBook/accpersp.rb +215 -0
  35. data/examples/RedBook/alpha.rb +123 -0
  36. data/examples/RedBook/alpha3D.rb +158 -0
  37. data/examples/RedBook/bezcurve.rb +105 -0
  38. data/examples/RedBook/bezmesh.rb +137 -0
  39. data/examples/RedBook/checker.rb +124 -0
  40. data/examples/RedBook/clip.rb +95 -0
  41. data/examples/RedBook/colormat.rb +135 -0
  42. data/examples/RedBook/cube.rb +69 -0
  43. data/examples/RedBook/depthcue.rb +99 -0
  44. data/examples/RedBook/dof.rb +205 -0
  45. data/examples/RedBook/double.rb +105 -0
  46. data/examples/RedBook/drawf.rb +91 -0
  47. data/examples/RedBook/feedback.rb +145 -0
  48. data/examples/RedBook/fog.rb +167 -0
  49. data/examples/RedBook/font.rb +151 -0
  50. data/examples/RedBook/hello.rb +79 -0
  51. data/examples/RedBook/image.rb +137 -0
  52. data/examples/RedBook/jitter.rb +207 -0
  53. data/examples/RedBook/lines.rb +128 -0
  54. data/examples/RedBook/list.rb +111 -0
  55. data/examples/RedBook/material.rb +275 -0
  56. data/examples/RedBook/mipmap.rb +156 -0
  57. data/examples/RedBook/model.rb +113 -0
  58. data/examples/RedBook/movelight.rb +132 -0
  59. data/examples/RedBook/pickdepth.rb +179 -0
  60. data/examples/RedBook/planet.rb +108 -0
  61. data/examples/RedBook/quadric.rb +158 -0
  62. data/examples/RedBook/robot.rb +115 -0
  63. data/examples/RedBook/select.rb +196 -0
  64. data/examples/RedBook/smooth.rb +95 -0
  65. data/examples/RedBook/stencil.rb +163 -0
  66. data/examples/RedBook/stroke.rb +167 -0
  67. data/examples/RedBook/surface.rb +166 -0
  68. data/examples/RedBook/teaambient.rb +132 -0
  69. data/examples/RedBook/teapots.rb +182 -0
  70. data/examples/RedBook/tess.rb +183 -0
  71. data/examples/RedBook/texbind.rb +147 -0
  72. data/examples/RedBook/texgen.rb +169 -0
  73. data/examples/RedBook/texturesurf.rb +128 -0
  74. data/examples/RedBook/varray.rb +159 -0
  75. data/examples/RedBook/wrap.rb +148 -0
  76. data/examples/misc/OGLBench.rb +337 -0
  77. data/examples/misc/anisotropic.rb +194 -0
  78. data/examples/misc/fbo_test.rb +356 -0
  79. data/examples/misc/font-glut.rb +46 -0
  80. data/examples/misc/glfwtest.rb +30 -0
  81. data/examples/misc/plane.rb +161 -0
  82. data/examples/misc/readpixel.rb +65 -0
  83. data/examples/misc/sdltest.rb +34 -0
  84. data/examples/misc/trislam.rb +828 -0
  85. data/ext/common/common.h +448 -0
  86. data/ext/common/conv.h +234 -0
  87. data/ext/common/funcdef.h +280 -0
  88. data/ext/common/gl-enums.h +10031 -0
  89. data/ext/common/gl-error.h +23 -0
  90. data/ext/common/gl-types.h +67 -0
  91. data/ext/common/glu-enums.h +463 -0
  92. data/ext/gl/extconf.rb +43 -0
  93. data/ext/gl/gl-1.0-1.1.c +2811 -0
  94. data/ext/gl/gl-1.2.c +814 -0
  95. data/ext/gl/gl-1.3.c +443 -0
  96. data/ext/gl/gl-1.4.c +348 -0
  97. data/ext/gl/gl-1.5.c +225 -0
  98. data/ext/gl/gl-2.0.c +657 -0
  99. data/ext/gl/gl-2.1.c +57 -0
  100. data/ext/gl/gl-enums.c +3354 -0
  101. data/ext/gl/gl-error.c +104 -0
  102. data/ext/gl/gl-ext-3dfx.c +27 -0
  103. data/ext/gl/gl-ext-arb.c +866 -0
  104. data/ext/gl/gl-ext-ati.c +41 -0
  105. data/ext/gl/gl-ext-ext.c +889 -0
  106. data/ext/gl/gl-ext-gremedy.c +41 -0
  107. data/ext/gl/gl-ext-nv.c +679 -0
  108. data/ext/gl/gl.c +216 -0
  109. data/ext/glu/extconf.rb +51 -0
  110. data/ext/glu/glu-enums.c +164 -0
  111. data/ext/glu/glu.c +1530 -0
  112. data/ext/glut/extconf.rb +67 -0
  113. data/ext/glut/glut.c +1624 -0
  114. data/lib/opengl.rb +89 -0
  115. data/test/README +10 -0
  116. data/test/tc_common.rb +98 -0
  117. data/test/tc_ext_arb.rb +467 -0
  118. data/test/tc_ext_ati.rb +33 -0
  119. data/test/tc_ext_ext.rb +551 -0
  120. data/test/tc_ext_gremedy.rb +36 -0
  121. data/test/tc_ext_nv.rb +357 -0
  122. data/test/tc_func_10_11.rb +1281 -0
  123. data/test/tc_func_12.rb +186 -0
  124. data/test/tc_func_13.rb +229 -0
  125. data/test/tc_func_14.rb +197 -0
  126. data/test/tc_func_15.rb +270 -0
  127. data/test/tc_func_20.rb +346 -0
  128. data/test/tc_func_21.rb +541 -0
  129. data/test/tc_glu.rb +310 -0
  130. data/test/tc_include_gl.rb +35 -0
  131. data/test/tc_misc.rb +54 -0
  132. data/test/tc_require_gl.rb +34 -0
  133. data/utils/README +11 -0
  134. data/utils/enumgen.rb +112 -0
  135. data/utils/extlistgen.rb +90 -0
  136. data/utils/mkdn2html.rb +59 -0
  137. data/utils/post-mkdn2html.rb +91 -0
  138. data/website/images/ogl.jpg +0 -0
  139. data/website/images/tab_bottom.gif +0 -0
  140. data/website/style.css +198 -0
  141. metadata +274 -0
@@ -0,0 +1,33 @@
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_ATI < Test::Unit::TestCase
19
+ def setup
20
+ common_setup()
21
+ end
22
+
23
+ def teardown
24
+ common_teardown()
25
+ end
26
+
27
+ def test_gl_ati_draw_buffers
28
+ return if not supported?("GL_ATI_draw_buffers")
29
+ glDrawBuffersATI([GL_BACK_LEFT,GL_FRONT_LEFT])
30
+ assert_equal(glGetIntegerv(GL_DRAW_BUFFER0),GL_BACK_LEFT)
31
+ assert_equal(glGetIntegerv(GL_DRAW_BUFFER1),GL_FRONT_LEFT)
32
+ end
33
+ end
@@ -0,0 +1,551 @@
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