glu2 8.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.autotest +29 -0
- data/.gemtest +0 -0
- data/.gitignore +6 -0
- data/.travis.yml +15 -0
- data/History.rdoc +25 -0
- data/MIT-LICENSE +18 -0
- data/Manifest.txt +20 -0
- data/README.rdoc +38 -0
- data/Rakefile +69 -0
- data/ext/glu/common.h +227 -0
- data/ext/glu/conv.h +143 -0
- data/ext/glu/extconf.rb +38 -0
- data/ext/glu/gl-enums.h +14588 -0
- data/ext/glu/glu-enums.c +164 -0
- data/ext/glu/glu-enums.h +463 -0
- data/ext/glu/glu.c +1543 -0
- data/lib/glu/dummy.rb +2 -0
- data/lib/glu.rb +28 -0
- data/test/dummy.xorg.conf +131 -0
- data/test/test_glu.rb +310 -0
- metadata +147 -0
data/lib/glu/dummy.rb
ADDED
data/lib/glu.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
begin
|
2
|
+
RUBY_VERSION =~ /(\d+.\d+)/
|
3
|
+
require "glu/#{Regexp.last_match(1)}/glu"
|
4
|
+
rescue LoadError
|
5
|
+
require 'glu/glu'
|
6
|
+
end
|
7
|
+
|
8
|
+
# (Glu.)gluSphere -> GLU.Sphere
|
9
|
+
# (Glu::)GLU_INSIDE -> GLU::INSIDE
|
10
|
+
module GLU
|
11
|
+
extend self
|
12
|
+
include Glu
|
13
|
+
|
14
|
+
Glu.constants.each do |cn|
|
15
|
+
n = cn.to_s.sub(/^GLU_/, '')
|
16
|
+
const_set(n, Glu.const_get(cn))
|
17
|
+
end
|
18
|
+
|
19
|
+
Glu.methods(false).each do |mn|
|
20
|
+
n = mn.to_s.sub(/^glu/, '')
|
21
|
+
alias_method(n, mn)
|
22
|
+
public(n)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module Glu2
|
27
|
+
VERSION = '8.4.0'
|
28
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# This file is used to setup a dummy X server for testing on http://travis-ci.org
|
2
|
+
# See config file ".travis.yml"
|
3
|
+
|
4
|
+
##Xdummy:##
|
5
|
+
Section "ServerFlags"
|
6
|
+
Option "DontVTSwitch" "true"
|
7
|
+
Option "AllowMouseOpenFail" "true"
|
8
|
+
Option "PciForceNone" "true"
|
9
|
+
Option "AutoEnableDevices" "false"
|
10
|
+
Option "AutoAddDevices" "false"
|
11
|
+
EndSection
|
12
|
+
|
13
|
+
|
14
|
+
##Xdummy:##
|
15
|
+
Section "InputDevice"
|
16
|
+
Identifier "NoMouse"
|
17
|
+
Option "CorePointer" "true"
|
18
|
+
Driver "void"
|
19
|
+
EndSection
|
20
|
+
|
21
|
+
Section "InputDevice"
|
22
|
+
Identifier "NoKeyboard"
|
23
|
+
Option "CoreKeyboard" "true"
|
24
|
+
Driver "void"
|
25
|
+
EndSection
|
26
|
+
|
27
|
+
##Xdummy:##
|
28
|
+
Section "Device"
|
29
|
+
Identifier "Videocard0"
|
30
|
+
Driver "dummy"
|
31
|
+
#VideoRam 4096000
|
32
|
+
VideoRam 256000
|
33
|
+
EndSection
|
34
|
+
|
35
|
+
##Xdummy:##
|
36
|
+
Section "Monitor"
|
37
|
+
Identifier "Monitor0"
|
38
|
+
HorizSync 10.0 - 300.0
|
39
|
+
VertRefresh 10.0 - 200.0
|
40
|
+
DisplaySize 4335 1084
|
41
|
+
#The following modeline is invalid (calculator overflowed):
|
42
|
+
#Modeline "32000x32000@0" -38917.43 32000 32032 -115848 -115816 32000 32775 32826 33601
|
43
|
+
Modeline "16384x8192@10" 2101.93 16384 16416 24400 24432 8192 8390 8403 8602
|
44
|
+
Modeline "8192x4096@10" 424.46 8192 8224 9832 9864 4096 4195 4202 4301
|
45
|
+
Modeline "5120x3200@10" 199.75 5120 5152 5904 5936 3200 3277 3283 3361
|
46
|
+
Modeline "3840x2880@10" 133.43 3840 3872 4376 4408 2880 2950 2955 3025
|
47
|
+
Modeline "3840x2560@10" 116.93 3840 3872 4312 4344 2560 2622 2627 2689
|
48
|
+
Modeline "3840x2048@10" 91.45 3840 3872 4216 4248 2048 2097 2101 2151
|
49
|
+
Modeline "2048x2048@10" 49.47 2048 2080 2264 2296 2048 2097 2101 2151
|
50
|
+
Modeline "2560x1600@10" 47.12 2560 2592 2768 2800 1600 1639 1642 1681
|
51
|
+
Modeline "1920x1200@10" 26.28 1920 1952 2048 2080 1200 1229 1231 1261
|
52
|
+
Modeline "1920x1080@10" 23.53 1920 1952 2040 2072 1080 1106 1108 1135
|
53
|
+
Modeline "1680x1050@10" 20.08 1680 1712 1784 1816 1050 1075 1077 1103
|
54
|
+
Modeline "1600x900@20" 33.92 1600 1632 1760 1792 900 921 924 946
|
55
|
+
Modeline "1440x900@20" 30.66 1440 1472 1584 1616 900 921 924 946
|
56
|
+
Modeline "1360x768@20" 24.49 1360 1392 1480 1512 768 786 789 807
|
57
|
+
#common resolutions for android devices (both orientations):
|
58
|
+
Modeline "800x1280@20" 25.89 800 832 928 960 1280 1310 1315 1345
|
59
|
+
Modeline "1280x800@20" 24.15 1280 1312 1400 1432 800 819 822 841
|
60
|
+
Modeline "720x1280@25" 30.22 720 752 864 896 1280 1309 1315 1345
|
61
|
+
Modeline "1280x720@25" 27.41 1280 1312 1416 1448 720 737 740 757
|
62
|
+
Modeline "768x1024@25" 24.93 768 800 888 920 1024 1047 1052 1076
|
63
|
+
Modeline "1024x768@25" 23.77 1024 1056 1144 1176 768 785 789 807
|
64
|
+
Modeline "600x1024@25" 19.90 600 632 704 736 1024 1047 1052 1076
|
65
|
+
Modeline "1024x600@25" 18.26 1024 1056 1120 1152 600 614 617 631
|
66
|
+
Modeline "536x960@25" 16.74 536 568 624 656 960 982 986 1009
|
67
|
+
Modeline "960x536@25" 15.23 960 992 1048 1080 536 548 551 563
|
68
|
+
Modeline "600x800@25" 15.17 600 632 688 720 800 818 822 841
|
69
|
+
Modeline "800x600@25" 14.50 800 832 880 912 600 614 617 631
|
70
|
+
Modeline "480x854@25" 13.34 480 512 560 592 854 873 877 897
|
71
|
+
Modeline "848x480@25" 12.09 848 880 920 952 480 491 493 505
|
72
|
+
Modeline "480x800@25" 12.43 480 512 552 584 800 818 822 841
|
73
|
+
Modeline "800x480@25" 11.46 800 832 872 904 480 491 493 505
|
74
|
+
Modeline "320x480@50" 10.73 320 352 392 424 480 490 494 505
|
75
|
+
Modeline "480x320@50" 9.79 480 512 544 576 320 327 330 337
|
76
|
+
Modeline "240x400@50" 6.96 240 272 296 328 400 408 412 421
|
77
|
+
Modeline "400x240@50" 6.17 400 432 448 480 240 245 247 253
|
78
|
+
Modeline "240x320@50" 5.47 240 272 288 320 320 327 330 337
|
79
|
+
Modeline "320x240@50" 5.10 320 352 368 400 240 245 247 253
|
80
|
+
#resolutions for android devices (both orientations)
|
81
|
+
#minus the status bar
|
82
|
+
#38px status bar (and width rounded up)
|
83
|
+
Modeline "800x1242@20" 25.03 800 832 920 952 1242 1271 1275 1305
|
84
|
+
Modeline "1280x762@20" 22.93 1280 1312 1392 1424 762 780 783 801
|
85
|
+
Modeline "720x1242@25" 29.20 720 752 856 888 1242 1271 1276 1305
|
86
|
+
Modeline "1280x682@25" 25.85 1280 1312 1408 1440 682 698 701 717
|
87
|
+
Modeline "768x986@25" 23.90 768 800 888 920 986 1009 1013 1036
|
88
|
+
Modeline "1024x730@25" 22.50 1024 1056 1136 1168 730 747 750 767
|
89
|
+
Modeline "600x986@25" 19.07 600 632 704 736 986 1009 1013 1036
|
90
|
+
Modeline "1024x562@25" 17.03 1024 1056 1120 1152 562 575 578 591
|
91
|
+
Modeline "536x922@25" 16.01 536 568 624 656 922 943 947 969
|
92
|
+
Modeline "960x498@25" 14.09 960 992 1040 1072 498 509 511 523
|
93
|
+
Modeline "600x762@25" 14.39 600 632 680 712 762 779 783 801
|
94
|
+
Modeline "800x562@25" 13.52 800 832 880 912 562 575 578 591
|
95
|
+
Modeline "480x810@25" 12.59 480 512 552 584 810 828 832 851
|
96
|
+
Modeline "848x442@25" 11.09 848 880 920 952 442 452 454 465
|
97
|
+
Modeline "480x762@25" 11.79 480 512 552 584 762 779 783 801
|
98
|
+
Modeline "800x442@25" 10.51 800 832 864 896 442 452 454 465
|
99
|
+
#32px status bar (no need for rounding):
|
100
|
+
Modeline "320x448@50" 9.93 320 352 384 416 448 457 461 471
|
101
|
+
Modeline "480x288@50" 8.75 480 512 544 576 288 294 297 303
|
102
|
+
#24px status bar:
|
103
|
+
Modeline "240x376@50" 6.49 240 272 296 328 376 384 387 395
|
104
|
+
Modeline "400x216@50" 5.50 400 432 448 480 216 220 222 227
|
105
|
+
Modeline "240x296@50" 5.02 240 272 288 320 296 302 305 311
|
106
|
+
Modeline "320x216@50" 4.55 320 352 368 400 216 220 222 227
|
107
|
+
EndSection
|
108
|
+
|
109
|
+
##Xdummy:##
|
110
|
+
Section "Screen"
|
111
|
+
Identifier "Screen0"
|
112
|
+
Device "Videocard0"
|
113
|
+
Monitor "Monitor0"
|
114
|
+
DefaultDepth 24
|
115
|
+
SubSection "Display"
|
116
|
+
Viewport 0 0
|
117
|
+
Depth 24
|
118
|
+
Modes "32000x32000" "16384x8192" "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200"
|
119
|
+
#Virtual 32000 32000
|
120
|
+
#Virtual 16384 8192
|
121
|
+
#Virtual 8192 4096
|
122
|
+
Virtual 1920 1440
|
123
|
+
EndSubSection
|
124
|
+
EndSection
|
125
|
+
|
126
|
+
Section "ServerLayout"
|
127
|
+
Identifier "dummy_layout"
|
128
|
+
Screen "screen0"
|
129
|
+
InputDevice "NoMouse"
|
130
|
+
InputDevice "NoKeyboard"
|
131
|
+
EndSection
|
data/test/test_glu.rb
ADDED
@@ -0,0 +1,310 @@
|
|
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 'opengl/test_case'
|
17
|
+
require 'glu'
|
18
|
+
|
19
|
+
include Glu
|
20
|
+
|
21
|
+
class TestGlu < OpenGL::TestCase
|
22
|
+
|
23
|
+
def test_gluortho
|
24
|
+
res = [ [2.0/WINDOW_SIZE, 0, 0, 0],
|
25
|
+
[0, 2.0/WINDOW_SIZE, 0, 0],
|
26
|
+
[0, 0, -1, 0],
|
27
|
+
[-1, -1, 0, 1] ]
|
28
|
+
|
29
|
+
glMatrixMode(GL_PROJECTION)
|
30
|
+
glLoadIdentity()
|
31
|
+
gluOrtho2D(0, WINDOW_SIZE, 0, WINDOW_SIZE)
|
32
|
+
assert_equal res, glGetDoublev(GL_PROJECTION_MATRIX)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_glugetstring
|
36
|
+
refute_empty gluGetString GLU_VERSION
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_gluerrorstring
|
40
|
+
refute_empty gluErrorString GL_INVALID_VALUE
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_glubuild2dmipmaps
|
44
|
+
textures = glGenTextures(1)
|
45
|
+
glBindTexture(GL_TEXTURE_2D, textures[0])
|
46
|
+
|
47
|
+
image = ([0, 0, 0, 1, 1, 1] * 8).pack("f*") # 16 RGB pixels
|
48
|
+
|
49
|
+
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB8, 4, 4, GL_RGB, GL_FLOAT, image)
|
50
|
+
im = glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT)
|
51
|
+
|
52
|
+
assert_equal image, im
|
53
|
+
assert_equal 4*4*3, im.unpack("f*").size
|
54
|
+
|
55
|
+
im = glGetTexImage(GL_TEXTURE_2D, 1, GL_RGB, GL_FLOAT)
|
56
|
+
assert_equal 2*2*3, im.unpack("f*").size
|
57
|
+
|
58
|
+
im = glGetTexImage(GL_TEXTURE_2D, 2, GL_RGB, GL_FLOAT)
|
59
|
+
assert_equal 1*1*3, im.unpack("f*").size
|
60
|
+
|
61
|
+
glDeleteTextures(textures)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_glubuild1dmipmaps
|
65
|
+
textures = glGenTextures(1)
|
66
|
+
glBindTexture(GL_TEXTURE_1D, textures[0])
|
67
|
+
|
68
|
+
image = ([0, 0, 0, 1, 1, 1] * 2).pack("f*") # 4 RGB pixels
|
69
|
+
|
70
|
+
gluBuild1DMipmaps(GL_TEXTURE_1D, GL_RGB8, 4, GL_RGB, GL_FLOAT, image)
|
71
|
+
|
72
|
+
im = glGetTexImage(GL_TEXTURE_1D, 0, GL_RGB, GL_FLOAT)
|
73
|
+
assert_equal image, im
|
74
|
+
assert_equal 4*3, im.unpack("f*").size
|
75
|
+
im = glGetTexImage(GL_TEXTURE_1D, 1, GL_RGB, GL_FLOAT)
|
76
|
+
assert_equal 2*3, im.unpack("f*").size
|
77
|
+
im = glGetTexImage(GL_TEXTURE_1D, 2, GL_RGB, GL_FLOAT)
|
78
|
+
assert_equal 1*3, im.unpack("f*").size
|
79
|
+
|
80
|
+
glDeleteTextures(textures)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_glulookat
|
84
|
+
m = [[0, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 0, 0], [0, 0, -1, 1]]
|
85
|
+
gluLookAt(1, 0, 0, 0, 0, 0, 0, 1, 0)
|
86
|
+
assert_equal m, glGetDoublev(GL_PROJECTION_MATRIX)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_gluproject
|
90
|
+
pos = gluProject(1, 1, 1)
|
91
|
+
assert_equal pos, [WINDOW_SIZE, WINDOW_SIZE, 1]
|
92
|
+
|
93
|
+
mp = glGetDoublev(GL_PROJECTION_MATRIX)
|
94
|
+
mm = Matrix.rows(glGetDoublev(GL_MODELVIEW_MATRIX))
|
95
|
+
view = glGetDoublev(GL_VIEWPORT)
|
96
|
+
pos = gluProject(1, 1, 1, mp, mm, view)
|
97
|
+
assert_equal([WINDOW_SIZE, WINDOW_SIZE, 1], pos)
|
98
|
+
|
99
|
+
assert_raises ArgumentError do pos = gluProject(1, 1, 1, mp, [1, 2, 3, 4], view) end
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_gluunproject
|
103
|
+
pos = gluUnProject(WINDOW_SIZE, WINDOW_SIZE, 1)
|
104
|
+
assert_equal([1, 1, 1], pos)
|
105
|
+
|
106
|
+
mp = glGetDoublev(GL_PROJECTION_MATRIX)
|
107
|
+
mm = Matrix.rows(glGetDoublev(GL_MODELVIEW_MATRIX))
|
108
|
+
view = glGetDoublev(GL_VIEWPORT)
|
109
|
+
pos = gluUnProject(WINDOW_SIZE, WINDOW_SIZE, 1, mp, mm, view)
|
110
|
+
assert_equal([1, 1, 1], pos)
|
111
|
+
assert_raises ArgumentError do pos = gluUnProject(WINDOW_SIZE, WINDOW_SIZE, 1, mp, [1, 2, 3, 4], view) end
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_glupickmatrix
|
115
|
+
t = WINDOW_SIZE / 5.0
|
116
|
+
m = [[t, 0.0, 0.0, 0.0], [0.0, t, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [t, t, 0.0, 1.0]]
|
117
|
+
glMatrixMode(GL_PROJECTION)
|
118
|
+
|
119
|
+
glLoadIdentity()
|
120
|
+
gluPickMatrix(0, 0)
|
121
|
+
assert_each_in_delta m, glGetDoublev(GL_PROJECTION_MATRIX)
|
122
|
+
|
123
|
+
glLoadIdentity()
|
124
|
+
gluPickMatrix(0, 0, 5, 5)
|
125
|
+
assert_each_in_delta m, glGetDoublev(GL_PROJECTION_MATRIX)
|
126
|
+
|
127
|
+
glLoadIdentity()
|
128
|
+
gluPickMatrix(0, 0, 5, 5, glGetDoublev(GL_VIEWPORT))
|
129
|
+
assert_each_in_delta m, glGetDoublev(GL_PROJECTION_MATRIX)
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_gluperspective
|
133
|
+
m = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -3, -1], [0, 0, -4, 0]]
|
134
|
+
gluPerspective(90, 1, 1, 2)
|
135
|
+
assert_equal m, glGetDoublev(GL_PROJECTION_MATRIX)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_gluscaleimage
|
139
|
+
image = ([0, 0, 0, 1, 1, 1] * 8).pack("f*") # 16 RGB pixels
|
140
|
+
scaled = gluScaleImage(GL_RGB, 4, 4, GL_FLOAT, image, 2, 2, GL_FLOAT)
|
141
|
+
assert_equal(2*2*3, scaled.unpack("f*").length)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_gluquadrics
|
145
|
+
ecount = 0
|
146
|
+
error_func = lambda do |error|
|
147
|
+
ecount+=1
|
148
|
+
end
|
149
|
+
|
150
|
+
q = gluNewQuadric()
|
151
|
+
gluQuadricDrawStyle(q, GL_LINE)
|
152
|
+
gluQuadricNormals(q, GL_SMOOTH)
|
153
|
+
gluQuadricOrientation(q, GLU_OUTSIDE)
|
154
|
+
gluQuadricTexture(q, GL_FALSE)
|
155
|
+
gluQuadricCallback(q, GLU_ERROR, error_func)
|
156
|
+
|
157
|
+
buf = glFeedbackBuffer(1024, GL_3D)
|
158
|
+
glRenderMode(GL_FEEDBACK)
|
159
|
+
gluSphere(q, 1.0, 4, 3)
|
160
|
+
count = glRenderMode(GL_RENDER)
|
161
|
+
refute_equal 0, count
|
162
|
+
|
163
|
+
glRenderMode(GL_FEEDBACK)
|
164
|
+
gluCylinder(q, 1.0, 1.0, 1.0, 4, 3)
|
165
|
+
count = glRenderMode(GL_RENDER)
|
166
|
+
refute_equal 0, count
|
167
|
+
|
168
|
+
glRenderMode(GL_FEEDBACK)
|
169
|
+
gluDisk(q, 1.0, 2.0, 4, 3)
|
170
|
+
count = glRenderMode(GL_RENDER)
|
171
|
+
refute_equal 0, count
|
172
|
+
|
173
|
+
glRenderMode(GL_FEEDBACK)
|
174
|
+
gluPartialDisk(q, 1.0, 2.0, 4, 3, 0, 360)
|
175
|
+
count = glRenderMode(GL_RENDER)
|
176
|
+
refute_equal 0, count
|
177
|
+
|
178
|
+
assert_equal 0, ecount
|
179
|
+
gluSphere(q, 0.0, 0, 0)
|
180
|
+
assert_equal 1, ecount
|
181
|
+
gluDeleteQuadric(q)
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_glunurbs
|
185
|
+
ecount = 0
|
186
|
+
|
187
|
+
glViewport(0, 0, WINDOW_SIZE, WINDOW_SIZE)
|
188
|
+
glMatrixMode(GL_PROJECTION)
|
189
|
+
glOrtho(0, WINDOW_SIZE, 0, WINDOW_SIZE, -1, 1)
|
190
|
+
|
191
|
+
n_error = lambda do |error|
|
192
|
+
ecount += 1
|
193
|
+
end
|
194
|
+
|
195
|
+
m = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
|
196
|
+
m2 = Matrix.rows(m)
|
197
|
+
|
198
|
+
n = gluNewNurbsRenderer()
|
199
|
+
gluNurbsCallback(n, GLU_ERROR, n_error)
|
200
|
+
gluNurbsProperty(n, GLU_SAMPLING_TOLERANCE, 40)
|
201
|
+
assert_equal 40, gluGetNurbsProperty(n, GLU_SAMPLING_TOLERANCE)
|
202
|
+
|
203
|
+
gluLoadSamplingMatrices(n, m, m2, glGetIntegerv(GL_VIEWPORT))
|
204
|
+
assert_raises ArgumentError do gluLoadSamplingMatrices(n, m, [1, 2, 3, 4], glGetIntegerv(GL_VIEWPORT)) end
|
205
|
+
|
206
|
+
knots = [0, 0, 0, 0, 1, 1, 1, 1]
|
207
|
+
ctlpoints_curve = [[50, 50, 0], [400, 50, 0], [400, 400, 0], [50, 400, 0]]
|
208
|
+
|
209
|
+
# generate surface control points
|
210
|
+
ctlpoints = Array.new(4).collect { Array.new(4).collect { Array.new(3, nil) } } # 4*4*3 array
|
211
|
+
0.upto(3) do |u|
|
212
|
+
0.upto(3) do |v|
|
213
|
+
ctlpoints[u][v][0]=2.0*(u-1.5)
|
214
|
+
ctlpoints[u][v][1]=2.0*(v-1.5)
|
215
|
+
|
216
|
+
if ((u==1 || u==2) && (v==1 || v==2))
|
217
|
+
ctlpoints[u][v][2]=6.0
|
218
|
+
else
|
219
|
+
ctlpoints[u][v][2]=0.0
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
buf = glFeedbackBuffer(1024*1024*8, GL_3D) # large enough buffer for tesselated surface
|
225
|
+
glRenderMode(GL_FEEDBACK)
|
226
|
+
gluBeginCurve(n)
|
227
|
+
gluNurbsCurve(n, knots, ctlpoints_curve, 4, GL_MAP1_VERTEX_3)
|
228
|
+
gluEndCurve(n)
|
229
|
+
|
230
|
+
gluBeginSurface(n)
|
231
|
+
gluNurbsSurface(n, knots, knots, ctlpoints, 4, 4, GL_MAP2_VERTEX_3)
|
232
|
+
gluEndSurface(n)
|
233
|
+
|
234
|
+
count = glRenderMode(GL_RENDER)
|
235
|
+
refute_equal 1, count
|
236
|
+
|
237
|
+
assert_equal 0, ecount
|
238
|
+
gluBeginTrim(n)
|
239
|
+
gluPwlCurve(n, [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]], GLU_MAP1_TRIM_2)
|
240
|
+
gluEndTrim(n)
|
241
|
+
|
242
|
+
gluDeleteNurbsRenderer(n)
|
243
|
+
assert_equal 1, ecount
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_glutess
|
247
|
+
glViewport(0, 0, WINDOW_SIZE, WINDOW_SIZE)
|
248
|
+
glMatrixMode(GL_PROJECTION)
|
249
|
+
glOrtho(0, WINDOW_SIZE, 0, WINDOW_SIZE, -1, 1)
|
250
|
+
vcount, bcount, ecount = 0, 0, 0
|
251
|
+
|
252
|
+
cb_begin = lambda do |type|
|
253
|
+
bcount += 1
|
254
|
+
end
|
255
|
+
cb_end = lambda do
|
256
|
+
ecount += 1
|
257
|
+
end
|
258
|
+
cb_vertex = lambda do |data|
|
259
|
+
vcount += 1
|
260
|
+
end
|
261
|
+
cb_error = lambda do |error|
|
262
|
+
p gluErrorString(error)
|
263
|
+
end
|
264
|
+
|
265
|
+
t = gluNewTess()
|
266
|
+
gluTessCallback(t, GLU_TESS_BEGIN, cb_begin)
|
267
|
+
gluTessCallback(t, GLU_TESS_END, cb_end)
|
268
|
+
gluTessCallback(t, GLU_TESS_ERROR, cb_error)
|
269
|
+
gluTessCallback(t, GLU_TESS_VERTEX, cb_vertex)
|
270
|
+
gluTessProperty(t, GLU_TESS_BOUNDARY_ONLY, GL_TRUE)
|
271
|
+
assert_equal GL_TRUE, gluGetTessProperty(t, GLU_TESS_BOUNDARY_ONLY)
|
272
|
+
gluTessProperty(t, GLU_TESS_BOUNDARY_ONLY, GL_FALSE)
|
273
|
+
assert_equal GL_FALSE, gluGetTessProperty(t, GLU_TESS_BOUNDARY_ONLY)
|
274
|
+
|
275
|
+
gluTessNormal(t, 0.0, 0.0, 0.0)
|
276
|
+
|
277
|
+
rect = [[50.0, 50.0, 0.0],
|
278
|
+
[200.0, 50.0, 0.0],
|
279
|
+
[200.0, 200.0, 0.0],
|
280
|
+
[50.0, 200.0, 0.0]]
|
281
|
+
tri = [[75.0, 75.0, 0.0],
|
282
|
+
[125.0, 175.0, 0.0],
|
283
|
+
[175.0, 75.0, 0.0]]
|
284
|
+
|
285
|
+
gluTessBeginPolygon(t, nil)
|
286
|
+
gluTessBeginContour(t)
|
287
|
+
gluTessVertex(t, rect[0], rect[0])
|
288
|
+
gluTessVertex(t, rect[1], rect[1])
|
289
|
+
gluTessVertex(t, rect[2], rect[2])
|
290
|
+
gluTessVertex(t, rect[3], rect[3])
|
291
|
+
gluTessEndContour(t)
|
292
|
+
gluTessBeginContour(t)
|
293
|
+
gluTessVertex(t, tri[0], tri[0])
|
294
|
+
gluTessVertex(t, tri[1], tri[1])
|
295
|
+
gluTessVertex(t, tri[2], tri[2])
|
296
|
+
gluTessEndContour(t)
|
297
|
+
gluTessEndPolygon(t)
|
298
|
+
|
299
|
+
gluTessCallback(t, GLU_TESS_BEGIN, nil)
|
300
|
+
gluTessCallback(t, GLU_TESS_END, nil)
|
301
|
+
gluTessCallback(t, GLU_TESS_ERROR, nil)
|
302
|
+
gluTessCallback(t, GLU_TESS_VERTEX, nil)
|
303
|
+
|
304
|
+
gluDeleteTess(t)
|
305
|
+
|
306
|
+
assert_equal 1, bcount
|
307
|
+
assert_equal 1, ecount
|
308
|
+
assert_equal 9, vcount
|
309
|
+
end
|
310
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: glu2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 8.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vedran Rodic
|
8
|
+
- Eric Hodel
|
9
|
+
- Lars Kanis
|
10
|
+
- Blaž Hrastnik
|
11
|
+
- Alain Hoang
|
12
|
+
- Jan Dvorak
|
13
|
+
- Minh Thu Vo
|
14
|
+
- James Adam
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
date: 2024-09-08 00:00:00.000000000 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rake-compiler
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
type: :development
|
28
|
+
prerelease: false
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rake-compiler-dock
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.0
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.6.0
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rdoc
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.0'
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '7'
|
58
|
+
type: :development
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '4.0'
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '7'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: hoe
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '4.2'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '4.2'
|
82
|
+
description: Glu bindings for the opengl gem, split into a separate gem because of
|
83
|
+
Glu deprecation.
|
84
|
+
email:
|
85
|
+
- vrodic@gmail.com
|
86
|
+
- drbrain@segment7.net
|
87
|
+
- ''
|
88
|
+
- blaz.hrast@gmail.com
|
89
|
+
- ''
|
90
|
+
- ''
|
91
|
+
- ''
|
92
|
+
- ''
|
93
|
+
executables: []
|
94
|
+
extensions:
|
95
|
+
- ext/glu/extconf.rb
|
96
|
+
extra_rdoc_files:
|
97
|
+
- History.rdoc
|
98
|
+
- Manifest.txt
|
99
|
+
- README.rdoc
|
100
|
+
files:
|
101
|
+
- ".autotest"
|
102
|
+
- ".gemtest"
|
103
|
+
- ".gitignore"
|
104
|
+
- ".travis.yml"
|
105
|
+
- History.rdoc
|
106
|
+
- MIT-LICENSE
|
107
|
+
- Manifest.txt
|
108
|
+
- README.rdoc
|
109
|
+
- Rakefile
|
110
|
+
- ext/glu/common.h
|
111
|
+
- ext/glu/conv.h
|
112
|
+
- ext/glu/extconf.rb
|
113
|
+
- ext/glu/gl-enums.h
|
114
|
+
- ext/glu/glu-enums.c
|
115
|
+
- ext/glu/glu-enums.h
|
116
|
+
- ext/glu/glu.c
|
117
|
+
- lib/glu.rb
|
118
|
+
- lib/glu/dummy.rb
|
119
|
+
- test/dummy.xorg.conf
|
120
|
+
- test/test_glu.rb
|
121
|
+
homepage: https://github.com/vrodic/ruby-glu2
|
122
|
+
licenses:
|
123
|
+
- MIT
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options:
|
127
|
+
- "--main"
|
128
|
+
- README.rdoc
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 1.9.2
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubygems_version: 3.5.18
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Glu bindings for the opengl gem, split into a separate gem because of Glu
|
146
|
+
deprecation.
|
147
|
+
test_files: []
|