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,186 +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_12 < Test::Unit::TestCase
19
- def setup
20
- common_setup()
21
- end
22
-
23
- def teardown
24
- common_teardown()
25
- end
26
-
27
- def test_glblend
28
- return if not supported?(1.2)
29
- glBlendColor(0.0,1.0,0.0,1.0)
30
- assert_equal(glGetDoublev(GL_BLEND_COLOR),[0,1,0,1])
31
-
32
- glBlendEquation(GL_MIN)
33
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION),GL_MIN)
34
- glBlendEquation(GL_MAX)
35
- assert_equal(glGetIntegerv(GL_BLEND_EQUATION),GL_MAX)
36
- end
37
-
38
- def test_gldrawrangeelements
39
- return if not supported?(1.2)
40
- va = [0,0, 0,1, 1,1].pack("f*")
41
- glVertexPointer(2,GL_FLOAT,0,va)
42
-
43
- buf = glFeedbackBuffer(256,GL_3D)
44
- glRenderMode(GL_FEEDBACK)
45
-
46
- glEnable(GL_VERTEX_ARRAY)
47
-
48
- glDrawRangeElements(GL_POINTS,0,2,3,GL_UNSIGNED_BYTE,[0,1,2].pack("C*"))
49
- count = glRenderMode(GL_RENDER)
50
- assert_equal(count,12)
51
-
52
- glDisable(GL_VERTEX_ARRAY)
53
- end
54
-
55
- def test_colortable
56
- return if not supported?(1.2)
57
-
58
- ct = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
59
- ct2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
60
- glColorTable(GL_COLOR_TABLE,GL_RGB8,4,GL_RGB,GL_FLOAT,ct)
61
- assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct)
62
-
63
- glColorSubTable(GL_COLOR_TABLE,0,4,GL_RGB,GL_FLOAT,ct2)
64
- assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct2)
65
-
66
- glDrawPixels(4,1,GL_RGB,GL_FLOAT,ct)
67
- glCopyColorTable(GL_COLOR_TABLE,GL_RGB8,0,0,4)
68
- assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct)
69
-
70
- glDrawPixels(4,1,GL_RGB,GL_FLOAT,ct2)
71
- glCopyColorSubTable(GL_COLOR_TABLE,0,0,0,4)
72
- assert_equal(glGetColorTable(GL_COLOR_TABLE,GL_RGB,GL_FLOAT),ct2)
73
-
74
- glColorTableParameterfv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS,[0,1,0,1])
75
- assert_equal(glGetColorTableParameterfv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS),[0,1,0,1])
76
-
77
- glColorTableParameteriv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS,[1,0,1,0])
78
- assert_equal(glGetColorTableParameteriv(GL_COLOR_TABLE,GL_COLOR_TABLE_BIAS),[1,0,1,0])
79
- end
80
-
81
- def test_convolutionfilter
82
- return if not supported?(1.2)
83
-
84
- cf = ([0]*3+[1]*3+[0]*3+[1]*3).pack("f*")
85
- cf2 = ([1]*3+[0]*3+[1]*3+[0]*3).pack("f*")
86
- glConvolutionFilter1D(GL_CONVOLUTION_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT,cf)
87
- assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf)
88
-
89
- glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGB8, 2,2, GL_RGB, GL_FLOAT,cf2)
90
- assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf2)
91
-
92
- glDrawPixels(4,1,GL_RGB,GL_FLOAT,cf2)
93
- glCopyConvolutionFilter1D(GL_CONVOLUTION_1D,GL_RGB8,0,0,4)
94
- assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_1D, GL_RGB, GL_FLOAT),cf2)
95
-
96
- glDrawPixels(2,2,GL_RGB,GL_FLOAT,cf)
97
- glCopyConvolutionFilter2D(GL_CONVOLUTION_2D,GL_RGB8,0,0,2,2)
98
- assert_equal(glGetConvolutionFilter(GL_CONVOLUTION_2D, GL_RGB, GL_FLOAT),cf)
99
-
100
- glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_CONSTANT_BORDER)
101
- assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
102
-
103
- glConvolutionParameterf(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
104
- assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_REPLICATE_BORDER)
105
-
106
- glConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
107
- assert_equal(glGetConvolutionParameterfv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
108
-
109
- glConvolutionParameteri(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,GL_REPLICATE_BORDER)
110
- assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_REPLICATE_BORDER)
111
-
112
- glConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE,[GL_CONSTANT_BORDER])
113
- assert_equal(glGetConvolutionParameteriv(GL_CONVOLUTION_1D,GL_CONVOLUTION_BORDER_MODE),GL_CONSTANT_BORDER)
114
- end
115
-
116
- def test_separablefilter
117
- return if not supported?(1.2)
118
- sf_a = ([0]*3+[1]*3).pack("f*")
119
- sf_b = ([1]*3+[0]*3).pack("f*")
120
-
121
- glSeparableFilter2D(GL_SEPARABLE_2D,GL_RGB8, 2,2,GL_RGB,GL_FLOAT,sf_a,sf_b)
122
- assert_equal(glGetSeparableFilter(GL_SEPARABLE_2D,GL_RGB,GL_FLOAT), [sf_a,sf_b])
123
- end
124
-
125
- def test_histogram
126
- return if not supported?(1.2)
127
-
128
- glEnable(GL_HISTOGRAM)
129
-
130
- glHistogram(GL_HISTOGRAM,1,GL_RGB,GL_FALSE)
131
- assert_equal(glGetHistogramParameterfv(GL_HISTOGRAM,GL_HISTOGRAM_WIDTH),1)
132
- assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM,GL_HISTOGRAM_FORMAT),GL_RGB)
133
- assert_equal(glGetHistogramParameteriv(GL_HISTOGRAM,GL_HISTOGRAM_SINK),GL_FALSE)
134
-
135
- glDrawPixels(2,1,GL_RGB,GL_FLOAT,[1,1,1,1,1,1].pack("f*"))
136
- h = glGetHistogram(GL_HISTOGRAM,GL_FALSE,GL_RGB,GL_FLOAT)
137
- assert_equal(h.unpack("f*"),[2,2,2])
138
- glResetHistogram(GL_HISTOGRAM)
139
- h = glGetHistogram(GL_HISTOGRAM,GL_FALSE,GL_RGB,GL_FLOAT)
140
- assert_equal(h.unpack("f*"),[0,0,0])
141
-
142
- glDisable(GL_HISTOGRAM)
143
- end
144
-
145
- def test_minmax
146
- return if not supported?(1.2)
147
-
148
- glEnable(GL_MINMAX)
149
-
150
- glMinmax(GL_MINMAX,GL_RGB,GL_FALSE)
151
- assert_equal(glGetMinmaxParameteriv(GL_MINMAX,GL_MINMAX_FORMAT),GL_RGB)
152
- assert_equal(glGetMinmaxParameterfv(GL_MINMAX,GL_MINMAX_FORMAT),GL_RGB)
153
- assert_equal(glGetMinmaxParameteriv(GL_MINMAX,GL_MINMAX_SINK),GL_FALSE)
154
-
155
- glDrawPixels(2,1,GL_RGB,GL_FLOAT,[0,0,0,1,1,1].pack("f*"))
156
- mm = glGetMinmax(GL_MINMAX,GL_FALSE,GL_RGB,GL_FLOAT)
157
- assert_equal(mm.unpack("f*"),[0,0,0,1,1,1])
158
- glResetMinmax(GL_MINMAX)
159
- mm = glGetMinmax(GL_MINMAX,GL_FALSE,GL_RGB,GL_UNSIGNED_BYTE)
160
- assert(approx_equal(mm.unpack("f*"),[0,0,0,0,0,0]))
161
-
162
- glDisable(GL_MINMAX)
163
- end
164
-
165
- def test_texture_3D
166
- return if not supported?(1.2)
167
- image = ([0,0,0,1,1,1] * 2 * 2).pack("f*")
168
- image2 = ([1,1,1,0,0,0] * 2 * 2).pack("f*")
169
-
170
- textures = glGenTextures(1)
171
- glBindTexture(GL_TEXTURE_3D,textures[0])
172
-
173
- glTexImage3D(GL_TEXTURE_3D,0,GL_RGB8,2,2,2,0,GL_RGB,GL_FLOAT,image)
174
- assert_equal(glGetTexImage(GL_TEXTURE_3D,0,GL_RGB,GL_FLOAT),image)
175
-
176
- glTexSubImage3D(GL_TEXTURE_3D,0, 0,0,0, 2,2,2,GL_RGB,GL_FLOAT,image2)
177
- assert_equal(glGetTexImage(GL_TEXTURE_3D,0,GL_RGB,GL_FLOAT),image2)
178
-
179
- glDrawPixels(2,2,GL_RGB,GL_FLOAT,image)
180
- glCopyTexSubImage3D(GL_TEXTURE_3D,0,0,0,0,0,0,2,2)
181
- ti = glGetTexImage(GL_TEXTURE_3D,0,GL_RGB,GL_FLOAT).unpack("f*")
182
- assert_equal(ti,([0]*3 + [1]*3) * 2 + ([1]*3 + [0]*3) * 2)
183
-
184
- glDeleteTextures(textures)
185
- end
186
- end
@@ -1,197 +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_14 < Test::Unit::TestCase
19
- def setup
20
- common_setup()
21
- end
22
-
23
- def teardown
24
- common_teardown()
25
- end
26
-
27
- def test_arrays_2
28
- return if not supported?(1.4)
29
- sc = [0,1,0, 1,0,1].pack("f*")
30
- fc = [1, 0].pack("f*")
31
-
32
- glSecondaryColorPointer(3,GL_FLOAT,0,sc)
33
- assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE),3)
34
- assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE),GL_FLOAT)
35
- assert_equal(glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_STRIDE),0)
36
- assert_equal(glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER),sc)
37
- glFogCoordPointer(GL_FLOAT,0,fc)
38
- assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE),GL_FLOAT)
39
- assert_equal(glGetIntegerv(GL_FOG_COORD_ARRAY_STRIDE),0)
40
- assert_equal(glGetPointerv(GL_FOG_COORD_ARRAY_POINTER),fc)
41
-
42
- glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
43
- glEnableClientState(GL_FOG_COORD_ARRAY)
44
-
45
- glBegin(GL_TRIANGLES)
46
- glArrayElement(0)
47
- glEnd()
48
-
49
- assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0,1,0,1])
50
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),1)
51
-
52
- glBegin(GL_TRIANGLES)
53
- glArrayElement(1)
54
- glEnd()
55
-
56
- assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1,0,1,1])
57
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),0)
58
-
59
- glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
60
- glDisableClientState(GL_FOG_COORD_ARRAY)
61
- end
62
-
63
- def test_arrays_3
64
- return if not supported?(1.4)
65
- va = [0,0, 1,0, 1,1, 0,0, 1,0, 0,1].pack("f*")
66
- glVertexPointer(2,GL_FLOAT,0,va)
67
-
68
- glEnable(GL_VERTEX_ARRAY)
69
-
70
- buf = glFeedbackBuffer(256,GL_3D)
71
- glRenderMode(GL_FEEDBACK)
72
-
73
- glMultiDrawArrays(GL_POLYGON, [0,3], [3,3])
74
-
75
- i1 = [0,1,2].pack("C*")
76
- i2 = [3,4,5].pack("C*")
77
- glMultiDrawElements(GL_TRIANGLES,GL_UNSIGNED_BYTE,[i1,i2])
78
-
79
- count = glRenderMode(GL_RENDER)
80
- assert_equal(count,(3*3+2)*4)
81
- glDisable(GL_VERTEX_ARRAY)
82
- end
83
-
84
- def test_glblendfuncseparate
85
- return if not supported?(1.4)
86
- glBlendFuncSeparate(GL_SRC_COLOR,GL_SRC_COLOR,GL_SRC_COLOR,GL_SRC_COLOR)
87
- assert_equal(glGetIntegerv(GL_BLEND_SRC_RGB),GL_SRC_COLOR)
88
- assert_equal(glGetIntegerv(GL_BLEND_SRC_ALPHA),GL_SRC_COLOR)
89
- assert_equal(glGetIntegerv(GL_BLEND_DST_RGB),GL_SRC_COLOR)
90
- assert_equal(glGetIntegerv(GL_BLEND_DST_ALPHA),GL_SRC_COLOR)
91
- end
92
-
93
- def test_glpointparameter
94
- return if not supported?(1.4)
95
- glPointParameterf(GL_POINT_SIZE_MIN,2.0)
96
- assert_equal(glGetDoublev(GL_POINT_SIZE_MIN),2.0)
97
-
98
- glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION,[0,1,0])
99
- assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[0,1,0])
100
-
101
- glPointParameteri(GL_POINT_SIZE_MAX,4)
102
- assert_equal(glGetDoublev(GL_POINT_SIZE_MAX),4)
103
-
104
- glPointParameteriv(GL_POINT_DISTANCE_ATTENUATION,[1,0,1])
105
- assert_equal(glGetDoublev(GL_POINT_DISTANCE_ATTENUATION),[1,0,1])
106
- end
107
-
108
- def test_glfogcoord
109
- return if not supported?(1.4)
110
-
111
- glFogCoordf(2.0)
112
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
113
- glFogCoordfv([3.0])
114
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
115
-
116
- glFogCoordd(2.0)
117
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),2.0)
118
- glFogCoorddv([3.0])
119
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),3.0)
120
- end
121
-
122
- def test_glsecondarycolor
123
- return if not supported?(1.4)
124
-
125
- glSecondaryColor3b(2**7-1,0,2**7-1)
126
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
127
- glSecondaryColor3bv([0,2**7-1,0])
128
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
129
- glSecondaryColor3d(1.0,0.0,1.0)
130
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
131
- glSecondaryColor3dv([0.0,1.0,0.0])
132
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
133
- glSecondaryColor3f(1.0,0.0,1.0)
134
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
135
- glSecondaryColor3fv([0.0,1.0,0.0])
136
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
137
- glSecondaryColor3i(2**31-1,0,2**31-1)
138
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
139
- glSecondaryColor3iv([0,2**31-1,0])
140
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
141
- glSecondaryColor3s(2**15-1,0,2**15-1)
142
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
143
- glSecondaryColor3sv([0,2**15-1,0])
144
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
145
- glSecondaryColor3ub(2**8-1,0,2**8-1)
146
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
147
- glSecondaryColor3ubv([0,2**8-1,0])
148
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
149
- glSecondaryColor3ui(2**32-1,0,2**32-1)
150
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
151
- glSecondaryColor3uiv([0,2**32-1,0])
152
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
153
- glSecondaryColor3us(2**16-1,0,2**16-1)
154
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[1.0,0.0,1.0,1.0]))
155
- glSecondaryColor3usv([0,2**16-1,0])
156
- assert(approx_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0.0,1.0,0.0,1.0]))
157
- end
158
-
159
- def test_glwindowpos
160
- return if not supported?(1.4)
161
- # 2
162
- glWindowPos2d(1.0,2.0)
163
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
164
- glWindowPos2dv([2.0,1.0])
165
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
166
- glWindowPos2f(1.0,2.0)
167
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
168
- glWindowPos2fv([2.0,1.0])
169
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
170
- glWindowPos2i(1,2)
171
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
172
- glWindowPos2iv([2,1])
173
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
174
- glWindowPos2s(1,2)
175
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
176
- glWindowPos2sv([2,1])
177
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[2,1,0,1])
178
-
179
- # 3
180
- glWindowPos3d(1.0,2.0,0.5)
181
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0.5,1])
182
- glWindowPos3dv([3.0,2.0,1.0])
183
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
184
- glWindowPos3f(1.0,2.0,0.5)
185
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0.5,1])
186
- glWindowPos3fv([3.0,2.0,1.0])
187
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
188
- glWindowPos3i(1,2,0)
189
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
190
- glWindowPos3iv([3,2,1])
191
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
192
- glWindowPos3s(1,2,0)
193
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[1,2,0,1])
194
- glWindowPos3sv([3,2,1])
195
- assert_equal(glGetDoublev(GL_CURRENT_RASTER_POSITION),[3,2,1,1])
196
- end
197
- end
@@ -1,270 +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_15 < Test::Unit::TestCase
19
- def setup
20
- common_setup()
21
- end
22
-
23
- def teardown
24
- common_teardown()
25
- end
26
-
27
- def test_query
28
- return if not supported?(1.5)
29
- queries = glGenQueries(2)
30
- assert_equal(queries.size,2)
31
-
32
- glBeginQuery(GL_SAMPLES_PASSED,queries[1])
33
- assert_equal(glIsQuery(queries[1]),true)
34
-
35
- glBegin(GL_TRIANGLES)
36
- glVertex2i(0,0)
37
- glVertex2i(1,0)
38
- glVertex2i(1,1)
39
- glEnd()
40
-
41
- assert_equal(glGetQueryiv(GL_SAMPLES_PASSED,GL_CURRENT_QUERY),queries[1])
42
-
43
- glEndQuery(GL_SAMPLES_PASSED)
44
-
45
- r = glGetQueryObjectiv(queries[1],GL_QUERY_RESULT_AVAILABLE)
46
- assert((r==GL_TRUE || r==GL_FALSE))
47
-
48
- if (r==GL_TRUE)
49
- assert(glGetQueryObjectiv(queries[1],GL_QUERY_RESULT)[0] > 0)
50
- assert(glGetQueryObjectuiv(queries[1],GL_QUERY_RESULT)[0] > 0)
51
- end
52
-
53
- glDeleteQueries(queries)
54
- assert_equal(glIsQuery(queries[1]),false)
55
- end
56
-
57
- def test_buffers
58
- return if not supported?(1.5)
59
- buffers = glGenBuffers(2)
60
- glBindBuffer(GL_ARRAY_BUFFER,buffers[0])
61
- assert_equal(glIsBuffer(buffers[0]),true)
62
-
63
- data = [0,1,2,3].pack("C*")
64
- data2 = [4,5,6,7].pack("C*")
65
-
66
- glBufferData(GL_ARRAY_BUFFER,4,data,GL_STREAM_READ)
67
- assert_equal(glGetBufferSubData(GL_ARRAY_BUFFER,0,4),data)
68
-
69
- assert_equal(glGetBufferParameteriv(GL_ARRAY_BUFFER,GL_BUFFER_USAGE),GL_STREAM_READ)
70
-
71
- glBufferSubData(GL_ARRAY_BUFFER,0,4,data2)
72
- assert_equal(glGetBufferSubData(GL_ARRAY_BUFFER,0,4),data2)
73
-
74
- assert_equal(glMapBuffer(GL_ARRAY_BUFFER,GL_READ_ONLY),data2)
75
- r = glUnmapBuffer(GL_ARRAY_BUFFER)
76
- assert(r == true || r == false)
77
- glDeleteBuffers(buffers)
78
- assert_equal(glIsBuffer(buffers[0]),false)
79
-
80
- # FIXME: GetBufferPointerv not yet implemented
81
- end
82
-
83
- def test_buffer_binding_element_array
84
- return if not supported?(1.5)
85
-
86
- glEnableClientState(GL_VERTEX_ARRAY)
87
- va = [0,0, 0,1, 1,1].pack("f*")
88
- glVertexPointer(2,GL_FLOAT,0,va)
89
-
90
- #
91
- data = [0,1,2].pack("C*")
92
- buffers = glGenBuffers(1)
93
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,buffers[0])
94
- glBufferData(GL_ELEMENT_ARRAY_BUFFER,3,data,GL_DYNAMIC_DRAW)
95
-
96
- #
97
- feedback = glFeedbackBuffer(256,GL_3D)
98
- glRenderMode(GL_FEEDBACK)
99
-
100
- glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,0)
101
- glDrawRangeElements(GL_TRIANGLES,0,3,3,GL_UNSIGNED_BYTE,0)
102
-
103
- count = glRenderMode(GL_RENDER)
104
- assert_equal(count,22)
105
-
106
- glDisableClientState(GL_VERTEX_ARRAY)
107
- glDeleteBuffers(buffers)
108
- end
109
-
110
- def test_buffer_binding_array_1
111
- return if not supported?(1.5)
112
-
113
- glEnableClientState(GL_VERTEX_ARRAY)
114
- va = [0,0, 0,1, 1,1].pack("f*")
115
-
116
- #
117
- buffers = glGenBuffers(1)
118
- glBindBuffer(GL_ARRAY_BUFFER,buffers[0])
119
- glBufferData(GL_ARRAY_BUFFER,6*4,va,GL_DYNAMIC_DRAW)
120
-
121
- glVertexPointer(2,GL_FLOAT,0,0)
122
- assert_equal(glGetPointerv(GL_VERTEX_ARRAY_POINTER),0)
123
- #
124
- feedback = glFeedbackBuffer(256,GL_3D)
125
- glRenderMode(GL_FEEDBACK)
126
-
127
- glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,[0,1,2].pack("f*"))
128
-
129
- count = glRenderMode(GL_RENDER)
130
- assert_equal(count,11)
131
-
132
- glDeleteBuffers(buffers)
133
- glDisableClientState(GL_VERTEX_ARRAY)
134
- end
135
-
136
- def test_buffer_binding_array_2
137
- return if not supported?(1.5)
138
-
139
- efa = [0].pack("C*")
140
- na = [0,1,0].pack("f*")
141
- ca = [1,0,1,0].pack("f*")
142
- ta = [1,0,1,0].pack("f*")
143
-
144
- buffers = glGenBuffers(4)
145
- # load data into buffers
146
- buffer_efa,buffer_na,buffer_ca,buffer_ta = buffers
147
-
148
- glBindBuffer(GL_ARRAY_BUFFER,buffer_efa)
149
- glBufferData(GL_ARRAY_BUFFER,1,efa,GL_DYNAMIC_DRAW)
150
-
151
- glBindBuffer(GL_ARRAY_BUFFER,buffer_na)
152
- glBufferData(GL_ARRAY_BUFFER,3*4,na,GL_DYNAMIC_DRAW)
153
-
154
- glBindBuffer(GL_ARRAY_BUFFER,buffer_ca)
155
- glBufferData(GL_ARRAY_BUFFER,4*4,ca,GL_DYNAMIC_DRAW)
156
-
157
- glBindBuffer(GL_ARRAY_BUFFER,buffer_ta)
158
- glBufferData(GL_ARRAY_BUFFER,4*4,ta,GL_DYNAMIC_DRAW)
159
-
160
- # load buffers into arrays
161
- glBindBuffer(GL_ARRAY_BUFFER,buffer_na)
162
- glEdgeFlagPointer(0,0)
163
- assert_equal(glGetPointerv(GL_EDGE_FLAG_ARRAY_POINTER),0)
164
-
165
- glBindBuffer(GL_ARRAY_BUFFER,buffer_na)
166
- glNormalPointer(GL_FLOAT,0,0)
167
- assert_equal(glGetPointerv(GL_NORMAL_ARRAY_POINTER),0)
168
-
169
- glBindBuffer(GL_ARRAY_BUFFER,buffer_ca)
170
- glColorPointer(4,GL_FLOAT,0,0)
171
- assert_equal(glGetPointerv(GL_COLOR_ARRAY_POINTER),0)
172
-
173
- glBindBuffer(GL_ARRAY_BUFFER,buffer_ta)
174
- glTexCoordPointer(4,GL_FLOAT,0,0)
175
- assert_equal(glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER),0)
176
-
177
- # not really testing index
178
- glIndexPointer(GL_INT,2,0)
179
- assert_equal(glGetPointerv(GL_INDEX_ARRAY_POINTER),0)
180
-
181
- # draw arrays
182
- glEnable(GL_NORMAL_ARRAY)
183
- glEnable(GL_COLOR_ARRAY)
184
- glEnable(GL_TEXTURE_COORD_ARRAY)
185
- glEnable(GL_EDGE_FLAG_ARRAY)
186
-
187
- glBegin(GL_TRIANGLES)
188
- glArrayElement(0)
189
- glEnd()
190
-
191
- assert_equal(glGetDoublev(GL_CURRENT_NORMAL),[0,1,0])
192
- assert_equal(glGetDoublev(GL_CURRENT_COLOR),[1,0,1,0])
193
- assert_equal(glGetDoublev(GL_CURRENT_TEXTURE_COORDS),[1,0,1,0])
194
- assert_equal(glGetBooleanv(GL_EDGE_FLAG),GL_FALSE)
195
-
196
- glDisable(GL_EDGE_FLAG_ARRAY)
197
- glDisable(GL_TEXTURE_COORD_ARRAY)
198
- glDisable(GL_COLOR_ARRAY)
199
- glDisable(GL_NORMAL_ARRAY)
200
-
201
- glDeleteBuffers(buffers)
202
- end
203
-
204
- def test_buffer_binding_array_3
205
- return if not supported?(1.5)
206
-
207
- sc = [0,1,0].pack("f*")
208
- fc = [1].pack("f*")
209
-
210
- buffers = glGenBuffers(2)
211
- # load data into buffers
212
- buffer_sc,buffer_fc = buffers
213
-
214
- glBindBuffer(GL_ARRAY_BUFFER,buffer_sc)
215
- glBufferData(GL_ARRAY_BUFFER,3*4,sc,GL_DYNAMIC_DRAW)
216
-
217
- glBindBuffer(GL_ARRAY_BUFFER,buffer_fc)
218
- glBufferData(GL_ARRAY_BUFFER,1*4,fc,GL_DYNAMIC_DRAW)
219
-
220
- # load buffers into arrays
221
- glBindBuffer(GL_ARRAY_BUFFER,buffer_sc)
222
- glSecondaryColorPointer(3,GL_FLOAT,0,0)
223
- assert_equal(glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER),0)
224
-
225
- glBindBuffer(GL_ARRAY_BUFFER,buffer_fc)
226
- glFogCoordPointer(GL_FLOAT,0,0)
227
- assert_equal(glGetPointerv(GL_FOG_COORD_ARRAY_POINTER),0)
228
-
229
- # draw arrays
230
- glEnableClientState(GL_SECONDARY_COLOR_ARRAY)
231
- glEnableClientState(GL_FOG_COORD_ARRAY)
232
-
233
- glBegin(GL_TRIANGLES)
234
- glArrayElement(0)
235
- glEnd()
236
-
237
- assert_equal(glGetDoublev(GL_CURRENT_SECONDARY_COLOR),[0,1,0,1])
238
- assert_equal(glGetDoublev(GL_CURRENT_FOG_COORD),1)
239
-
240
- glDisableClientState(GL_SECONDARY_COLOR_ARRAY)
241
- glDisableClientState(GL_FOG_COORD_ARRAY)
242
-
243
- glDeleteBuffers(buffers)
244
- end
245
-
246
- def test_buffer_binding_array_4
247
- return if not supported?(1.5)
248
- va = [0,0, 1,0, 1,1, 0,0, 1,0, 0,1].pack("f*")
249
- glVertexPointer(2,GL_FLOAT,0,va)
250
-
251
- glEnable(GL_VERTEX_ARRAY)
252
-
253
- buf = glFeedbackBuffer(256,GL_3D)
254
- glRenderMode(GL_FEEDBACK)
255
-
256
- data = [0,1,2,3,4,5]
257
- buffers = glGenBuffers(3)
258
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,buffers[0])
259
- glBufferData(GL_ELEMENT_ARRAY_BUFFER,6,data.pack("C*"),GL_DYNAMIC_DRAW)
260
-
261
- glMultiDrawElements(GL_TRIANGLES,GL_UNSIGNED_BYTE,[3,3],[0,3])
262
-
263
- count = glRenderMode(GL_RENDER)
264
- assert_equal(count,(3*3+2)*2)
265
-
266
- glDisable(GL_VERTEX_ARRAY)
267
- glDeleteBuffers(buffers)
268
- end
269
-
270
- end