opengl 0.8.0-x86-mingw32 → 0.9.0-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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +2 -0
- data/.gitignore +2 -1
- data/.travis.yml +19 -0
- data/History.rdoc +26 -0
- data/Manifest.txt +3 -23
- data/README.rdoc +43 -37
- data/Rakefile +6 -62
- data/examples/NeHe/nehe_lesson02.rb +3 -2
- data/examples/NeHe/nehe_lesson03.rb +3 -2
- data/examples/NeHe/nehe_lesson04.rb +3 -1
- data/examples/NeHe/nehe_lesson05.rb +4 -1
- data/examples/NeHe/nehe_lesson06.rb +9 -6
- data/examples/NeHe/nehe_lesson07.rb +9 -6
- data/examples/NeHe/nehe_lesson08.rb +9 -6
- data/examples/NeHe/nehe_lesson09.rb +10 -6
- data/examples/NeHe/nehe_lesson11.rb +9 -6
- data/examples/NeHe/nehe_lesson12.rb +9 -6
- data/examples/NeHe/nehe_lesson16.rb +50 -47
- data/examples/NeHe/nehe_lesson19.rb +10 -7
- data/examples/NeHe/nehe_lesson36.rb +234 -229
- data/examples/OrangeBook/brick.rb +227 -225
- data/examples/OrangeBook/particle.rb +233 -231
- data/examples/RedBook/aapoly.rb +71 -70
- data/examples/RedBook/aargb.rb +54 -52
- data/examples/RedBook/accanti.rb +96 -94
- data/examples/RedBook/accpersp.rb +106 -104
- data/examples/RedBook/alpha.rb +54 -52
- data/examples/RedBook/alpha3D.rb +90 -88
- data/examples/RedBook/bezcurve.rb +48 -46
- data/examples/RedBook/bezmesh.rb +71 -69
- data/examples/RedBook/checker.rb +57 -55
- data/examples/RedBook/clip.rb +41 -39
- data/examples/RedBook/colormat.rb +72 -70
- data/examples/RedBook/cube.rb +39 -37
- data/examples/RedBook/depthcue.rb +37 -35
- data/examples/RedBook/dof.rb +110 -109
- data/examples/RedBook/double.rb +40 -38
- data/examples/RedBook/drawf.rb +30 -28
- data/examples/RedBook/feedback.rb +79 -77
- data/examples/RedBook/fog.rb +90 -89
- data/examples/RedBook/font.rb +78 -76
- data/examples/RedBook/hello.rb +29 -27
- data/examples/RedBook/image.rb +57 -55
- data/examples/RedBook/jitter.rb +131 -131
- data/examples/RedBook/light.rb +2 -1
- data/examples/RedBook/lines.rb +70 -68
- data/examples/RedBook/list.rb +48 -46
- data/examples/RedBook/material.rb +200 -199
- data/examples/RedBook/mipmap.rb +84 -82
- data/examples/RedBook/model.rb +55 -53
- data/examples/RedBook/movelight.rb +52 -50
- data/examples/RedBook/pickdepth.rb +103 -101
- data/examples/RedBook/planet.rb +46 -44
- data/examples/RedBook/quadric.rb +97 -95
- data/examples/RedBook/robot.rb +55 -53
- data/examples/RedBook/select.rb +118 -116
- data/examples/RedBook/smooth.rb +35 -33
- data/examples/RedBook/stencil.rb +96 -94
- data/examples/RedBook/stroke.rb +75 -73
- data/examples/RedBook/surface.rb +93 -91
- data/examples/RedBook/teaambient.rb +71 -69
- data/examples/RedBook/teapots.rb +105 -103
- data/examples/RedBook/tess.rb +96 -94
- data/examples/RedBook/texbind.rb +79 -77
- data/examples/RedBook/texgen.rb +88 -86
- data/examples/RedBook/texturesurf.rb +57 -55
- data/examples/RedBook/varray.rb +85 -83
- data/examples/RedBook/wrap.rb +76 -74
- data/examples/misc/OGLBench.rb +114 -113
- data/examples/misc/anisotropic.rb +154 -152
- data/examples/misc/fbo_test.rb +37 -36
- data/examples/misc/font-glut.rb +47 -46
- data/examples/misc/glfwtest.rb +16 -16
- data/examples/misc/plane.rb +13 -13
- data/examples/misc/readpixel.rb +66 -65
- data/examples/misc/sdltest.rb +21 -19
- data/examples/misc/trislam.rb +548 -547
- data/ext/opengl/common.h +16 -38
- data/ext/opengl/conv.h +39 -41
- data/ext/opengl/extconf.rb +4 -31
- data/ext/opengl/funcdef.h +126 -124
- data/ext/opengl/gl-1.0-1.1.c +1917 -1917
- data/ext/opengl/gl-1.2.c +4 -667
- data/ext/opengl/gl-1.3.c +9 -9
- data/ext/opengl/gl-1.4.c +8 -8
- data/ext/opengl/gl-1.5.c +1 -1
- data/ext/opengl/gl-2.0.c +392 -388
- data/ext/opengl/gl-3.0.c +493 -0
- data/ext/opengl/gl-enums.c +1523 -5
- data/ext/opengl/gl-enums.h +4679 -122
- data/ext/opengl/gl-error.c +7 -7
- data/ext/opengl/gl-error.h +4 -4
- data/ext/opengl/gl-ext-arb.c +468 -464
- data/ext/opengl/gl-ext-ext.c +18 -18
- data/ext/opengl/gl-ext-nv.c +15 -15
- data/ext/opengl/gl.c +2 -0
- data/ext/opengl/gl_buffer.c +92 -92
- data/ext/opengl/opengl.c +1 -7
- data/lib/opengl.rb +23 -59
- data/lib/opengl/1.9/opengl.so +0 -0
- data/lib/opengl/2.0/opengl.so +0 -0
- data/lib/opengl/2.1/opengl.so +0 -0
- data/lib/opengl/test_case.rb +1 -2
- data/test/dummy.xorg.conf +140 -0
- data/test/test_gl.rb +18 -22
- data/test/test_gl_10_11.rb +220 -220
- data/test/test_gl_12.rb +11 -122
- data/test/test_gl_13.rb +202 -210
- data/test/test_gl_14.rb +16 -19
- data/test/test_gl_15.rb +2 -4
- data/test/test_gl_20.rb +45 -58
- data/test/test_gl_21.rb +46 -163
- data/test/test_gl_ext_arb.rb +54 -72
- data/test/test_gl_ext_ati.rb +0 -2
- data/test/test_gl_ext_ext.rb +66 -66
- data/test/test_gl_ext_gremedy.rb +8 -15
- data/test/test_gl_ext_nv.rb +109 -112
- data/test/test_opengl_buffer.rb +8 -25
- data/utils/README +0 -5
- data/utils/enumgen.rb +72 -76
- data/utils/extlistgen.rb +55 -55
- metadata +90 -67
- metadata.gz.sig +0 -0
- data/Rakefile.cross +0 -107
- data/docs/build_install.txt +0 -119
- data/docs/extensions.txt.in +0 -348
- data/docs/history.txt +0 -66
- data/docs/requirements_and_design.txt +0 -117
- data/docs/roadmap.txt +0 -28
- data/docs/scientific_use.txt +0 -35
- data/docs/supplies/page_template.html +0 -71
- data/docs/thanks.txt +0 -29
- data/docs/tutorial.txt +0 -469
- data/ext/opengl/glu-enums.c +0 -164
- data/ext/opengl/glu-enums.h +0 -463
- data/ext/opengl/glu.c +0 -1534
- data/ext/opengl/glut.c +0 -1145
- data/ext/opengl/glut_callbacks.c +0 -845
- data/lib/glu.rb +0 -1
- data/lib/glut.rb +0 -1
- data/lib/opengl/opengl.so +0 -0
- data/test/test_glu.rb +0 -309
- data/utils/mkdn2html.rb +0 -59
- data/utils/post-mkdn2html.rb +0 -91
- data/website/images/ogl.jpg +0 -0
- data/website/images/tab_bottom.gif +0 -0
- data/website/style.css +0 -198
data/examples/RedBook/aapoly.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
3
|
-
# ALL RIGHTS RESERVED
|
4
|
-
# Permission to use, copy, modify, and distribute this software for
|
3
|
+
# ALL RIGHTS RESERVED
|
4
|
+
# Permission to use, copy, modify, and distribute this software for
|
5
5
|
# any purpose and without fee is hereby granted, provided that the above
|
6
6
|
# copyright notice appear in all copies and that both the copyright notice
|
7
|
-
# and this permission notice appear in supporting documentation, and that
|
7
|
+
# and this permission notice appear in supporting documentation, and that
|
8
8
|
# the name of Silicon Graphics, Inc. not be used in advertising
|
9
9
|
# or publicity pertaining to distribution of the software without specific,
|
10
|
-
# written prior permission.
|
10
|
+
# written prior permission.
|
11
11
|
#
|
12
12
|
# THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
13
13
|
# AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
@@ -21,8 +21,8 @@
|
|
21
21
|
# ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
22
22
|
# ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
23
23
|
# POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
-
#
|
25
|
-
# US Government Users Restricted Rights
|
24
|
+
#
|
25
|
+
# US Government Users Restricted Rights
|
26
26
|
# Use, duplication, or disclosure by the Government is subject to
|
27
27
|
# restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
28
28
|
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
@@ -36,96 +36,98 @@
|
|
36
36
|
#
|
37
37
|
# aapoly.c
|
38
38
|
# This program draws filled polygons with antialiased
|
39
|
-
# edges. The special GL_SRC_ALPHA_SATURATE blending
|
39
|
+
# edges. The special GL_SRC_ALPHA_SATURATE blending
|
40
40
|
# function is used.
|
41
41
|
# Pressing the 't' key turns the antialiasing on and off.
|
42
42
|
require 'opengl'
|
43
|
+
require 'glu'
|
44
|
+
require 'glut'
|
43
45
|
include Gl,Glu,Glut
|
44
46
|
|
45
47
|
$polySmooth = true
|
46
48
|
|
47
49
|
def init
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
glCullFace(GL_BACK)
|
51
|
+
glEnable(GL_CULL_FACE)
|
52
|
+
glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE)
|
53
|
+
glClearColor(0.0, 0.0, 0.0, 0.0)
|
52
54
|
end
|
53
55
|
|
54
56
|
NFACE=6
|
55
57
|
NVERT=8
|
56
58
|
$indices = [
|
57
|
-
|
58
|
-
|
59
|
+
[4, 5, 6, 7], [2, 3, 7, 6], [0, 4, 7, 3],
|
60
|
+
[0, 1, 5, 4], [1, 5, 6, 2], [0, 3, 2, 1]
|
59
61
|
]
|
60
62
|
|
61
63
|
def drawCube(x0, x1, y0, y1, z0, z1)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
64
|
+
v = [[],[],[],[],[],[],[],[]]
|
65
|
+
c = [
|
66
|
+
[0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0],
|
67
|
+
[0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 1.0],
|
68
|
+
[0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0],
|
69
|
+
[0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]
|
70
|
+
]
|
71
|
+
|
72
|
+
# indices of front, top, left, bottom, right, back faces
|
73
|
+
|
74
|
+
v[0][0] = v[3][0] = v[4][0] = v[7][0] = x0
|
75
|
+
v[1][0] = v[2][0] = v[5][0] = v[6][0] = x1
|
76
|
+
v[0][1] = v[1][1] = v[4][1] = v[5][1] = y0
|
77
|
+
v[2][1] = v[3][1] = v[6][1] = v[7][1] = y1
|
78
|
+
v[0][2] = v[1][2] = v[2][2] = v[3][2] = z0
|
79
|
+
v[4][2] = v[5][2] = v[6][2] = v[7][2] = z1
|
80
|
+
|
81
|
+
glEnableClientState(GL_VERTEX_ARRAY)
|
82
|
+
glEnableClientState(GL_COLOR_ARRAY)
|
83
|
+
glVertexPointer(3, GL_FLOAT, 0, v.flatten!.pack("f*"))
|
84
|
+
glColorPointer(4, GL_FLOAT, 0, c.flatten!.pack("f*"))
|
85
|
+
glDrawElements(GL_QUADS, NFACE*4, GL_UNSIGNED_BYTE, $indices.flatten.pack("C*"))
|
86
|
+
glDisableClientState(GL_VERTEX_ARRAY)
|
87
|
+
glDisableClientState(GL_COLOR_ARRAY)
|
86
88
|
end
|
87
89
|
|
88
90
|
# Note: polygons must be drawn from front to back
|
89
91
|
# for proper blending.
|
90
92
|
display = proc do
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
93
|
+
if ($polySmooth)
|
94
|
+
glClear(GL_COLOR_BUFFER_BIT)
|
95
|
+
glEnable(GL_BLEND)
|
96
|
+
glEnable(GL_POLYGON_SMOOTH)
|
97
|
+
glDisable(GL_DEPTH_TEST)
|
98
|
+
else
|
99
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
100
|
+
glDisable(GL_BLEND)
|
101
|
+
glDisable(GL_POLYGON_SMOOTH)
|
102
|
+
glEnable(GL_DEPTH_TEST)
|
103
|
+
end
|
104
|
+
|
105
|
+
glPushMatrix()
|
106
|
+
glTranslate(0.0, 0.0, -8.0)
|
107
|
+
glRotate(30.0, 1.0, 0.0, 0.0)
|
108
|
+
glRotate(60.0, 0.0, 1.0, 0.0)
|
109
|
+
drawCube(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5)
|
110
|
+
glPopMatrix()
|
111
|
+
glutSwapBuffers()
|
110
112
|
end
|
111
113
|
|
112
114
|
reshape = proc do |w, h|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
glViewport(0, 0, w, h)
|
116
|
+
glMatrixMode(GL_PROJECTION)
|
117
|
+
glLoadIdentity()
|
118
|
+
gluPerspective(30.0, w.to_f/ h.to_f, 1.0, 20.0)
|
119
|
+
glMatrixMode(GL_MODELVIEW)
|
120
|
+
glLoadIdentity()
|
119
121
|
end
|
120
122
|
|
121
123
|
keyboard = proc do |key, x, y|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
case (key)
|
125
|
+
when ?t ,?T
|
126
|
+
$polySmooth = !$polySmooth
|
127
|
+
glutPostRedisplay()
|
128
|
+
when ?\e
|
129
|
+
exit(0) # Escape key
|
130
|
+
end
|
129
131
|
end
|
130
132
|
|
131
133
|
# Main Loop
|
@@ -139,4 +141,3 @@ glutReshapeFunc(reshape)
|
|
139
141
|
glutKeyboardFunc(keyboard)
|
140
142
|
glutDisplayFunc(display)
|
141
143
|
glutMainLoop()
|
142
|
-
|
data/examples/RedBook/aargb.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
3
|
-
# ALL RIGHTS RESERVED
|
4
|
-
# Permission to use, copy, modify, and distribute this software for
|
3
|
+
# ALL RIGHTS RESERVED
|
4
|
+
# Permission to use, copy, modify, and distribute this software for
|
5
5
|
# any purpose and without fee is hereby granted, provided that the above
|
6
6
|
# copyright notice appear in all copies and that both the copyright notice
|
7
|
-
# and this permission notice appear in supporting documentation, and that
|
7
|
+
# and this permission notice appear in supporting documentation, and that
|
8
8
|
# the name of Silicon Graphics, Inc. not be used in advertising
|
9
9
|
# or publicity pertaining to distribution of the software without specific,
|
10
|
-
# written prior permission.
|
10
|
+
# written prior permission.
|
11
11
|
#
|
12
12
|
# THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
13
13
|
# AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
@@ -21,8 +21,8 @@
|
|
21
21
|
# ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
22
22
|
# ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
23
23
|
# POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
-
#
|
25
|
-
# US Government Users Restricted Rights
|
24
|
+
#
|
25
|
+
# US Government Users Restricted Rights
|
26
26
|
# Use, duplication, or disclosure by the Government is subject to
|
27
27
|
# restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
28
28
|
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
@@ -36,9 +36,11 @@
|
|
36
36
|
#
|
37
37
|
# aargb.c
|
38
38
|
# This program draws shows how to draw anti-aliased lines. It draws
|
39
|
-
# two diagonal lines to form an X when 'r' is typed in the window,
|
39
|
+
# two diagonal lines to form an X when 'r' is typed in the window,
|
40
40
|
# the lines are rotated in opposite directions.
|
41
41
|
require 'opengl'
|
42
|
+
require 'glu'
|
43
|
+
require 'glut'
|
42
44
|
require 'mathn'
|
43
45
|
include Gl,Glu,Glut
|
44
46
|
|
@@ -48,64 +50,64 @@ $rotAngle = 0.0
|
|
48
50
|
# blending, hint, and line width. Print out implementation
|
49
51
|
# specific info on line width granularity and width.
|
50
52
|
def init
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
glEnable(GL_LINE_SMOOTH)
|
54
|
+
glEnable(GL_BLEND)
|
55
|
+
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
56
|
+
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE)
|
57
|
+
glLineWidth(1.5)
|
58
|
+
glClearColor(0.0, 0.0, 0.0, 0.0)
|
57
59
|
end
|
58
60
|
|
59
61
|
# Draw 2 diagonal lines to form an X
|
60
62
|
display = Proc.new do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
63
|
+
glClear(GL_COLOR_BUFFER_BIT)
|
64
|
+
|
65
|
+
glColor(0.0, 1.0, 0.0)
|
66
|
+
glPushMatrix()
|
67
|
+
glRotate(-$rotAngle, 0.0, 0.0, 0.1)
|
68
|
+
glBegin(GL_LINES)
|
69
|
+
glVertex(-0.5, 0.5)
|
70
|
+
glVertex(0.5, -0.5)
|
71
|
+
glEnd()
|
72
|
+
glPopMatrix()
|
73
|
+
|
74
|
+
glColor(0.0, 0.0, 1.0)
|
75
|
+
glPushMatrix()
|
76
|
+
glRotate($rotAngle, 0.0, 0.0, 0.1)
|
77
|
+
glBegin(GL_LINES)
|
78
|
+
glVertex(0.5, 0.5)
|
79
|
+
glVertex(-0.5, -0.5)
|
80
|
+
glEnd()
|
81
|
+
glPopMatrix()
|
82
|
+
glutSwapBuffers()
|
81
83
|
end
|
82
84
|
|
83
85
|
reshape = Proc.new do |w, h|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
86
|
+
glViewport(0, 0, w, h)
|
87
|
+
glMatrixMode(GL_PROJECTION)
|
88
|
+
glLoadIdentity()
|
89
|
+
if (w <= h)
|
90
|
+
gluOrtho2D(-1.0, 1.0, -1.0*h/w, 1.0*h/w)
|
91
|
+
else
|
92
|
+
gluOrtho2D(-1.0*w/h, 1.0*w/h, -1.0, 1.0)
|
93
|
+
end
|
94
|
+
glMatrixMode(GL_MODELVIEW)
|
95
|
+
glLoadIdentity()
|
94
96
|
end
|
95
97
|
|
96
98
|
keyboard = Proc.new do |key, x, y|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
case (key)
|
100
|
+
when ?r,?R
|
101
|
+
$rotAngle = $rotAngle + 20.0
|
102
|
+
$rotAngle = 0.0 if ($rotAngle >= 360.0)
|
103
|
+
glutPostRedisplay()
|
104
|
+
when ?\e # Escape Key
|
105
|
+
exit(0)
|
106
|
+
end
|
105
107
|
end
|
106
108
|
|
107
109
|
# Main Loop
|
108
|
-
# Open window with initial window size, title bar,
|
110
|
+
# Open window with initial window size, title bar,
|
109
111
|
# RGBA display mode, and handle input events.
|
110
112
|
glutInit
|
111
113
|
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
|
data/examples/RedBook/accanti.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
# Copyright (c) Mark J. Kilgard, 1994.
|
3
3
|
#
|
4
4
|
# (c) Copyright 1993, Silicon Graphics, Inc.
|
5
|
-
# ALL RIGHTS RESERVED
|
6
|
-
# Permission to use, copy, modify, and distribute this software for
|
5
|
+
# ALL RIGHTS RESERVED
|
6
|
+
# Permission to use, copy, modify, and distribute this software for
|
7
7
|
# any purpose and without fee is hereby granted, provided that the above
|
8
8
|
# copyright notice appear in all copies and that both the copyright notice
|
9
|
-
# and this permission notice appear in supporting documentation, and that
|
9
|
+
# and this permission notice appear in supporting documentation, and that
|
10
10
|
# the name of Silicon Graphics, Inc. not be used in advertising
|
11
11
|
# or publicity pertaining to distribution of the software without specific,
|
12
|
-
# written prior permission.
|
12
|
+
# written prior permission.
|
13
13
|
#
|
14
14
|
# THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
15
15
|
# AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
@@ -23,8 +23,8 @@
|
|
23
23
|
# ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
24
24
|
# ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
25
25
|
# POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
26
|
-
#
|
27
|
-
# US Government Users Restricted Rights
|
26
|
+
#
|
27
|
+
# US Government Users Restricted Rights
|
28
28
|
# Use, duplication, or disclosure by the Government is subject to
|
29
29
|
# restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
30
30
|
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
@@ -39,115 +39,117 @@
|
|
39
39
|
# accanti.c
|
40
40
|
|
41
41
|
require 'opengl'
|
42
|
-
require '
|
42
|
+
require 'glu'
|
43
|
+
require 'glut'
|
44
|
+
require_relative 'jitter'
|
43
45
|
include Gl,Glu,Glut
|
44
46
|
|
45
47
|
# Initialize lighting and other values.
|
46
48
|
def myinit
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
49
|
+
mat_ambient = [ 1.0, 1.0, 1.0, 1.0 ]
|
50
|
+
mat_specular = [ 1.0, 1.0, 1.0, 1.0 ]
|
51
|
+
light_position = [ 0.0, 0.0, 10.0, 1.0 ]
|
52
|
+
lm_ambient = [ 0.2, 0.2, 0.2, 1.0 ]
|
53
|
+
|
54
|
+
glMaterial(GL_FRONT, GL_AMBIENT, mat_ambient)
|
55
|
+
glMaterial(GL_FRONT, GL_SPECULAR, mat_specular)
|
56
|
+
glMaterial(GL_FRONT, GL_SHININESS, 50.0)
|
57
|
+
glLight(GL_LIGHT0, GL_POSITION, light_position)
|
58
|
+
glLightModel(GL_LIGHT_MODEL_AMBIENT, lm_ambient)
|
59
|
+
|
60
|
+
glEnable(GL_LIGHTING)
|
61
|
+
glEnable(GL_LIGHT0)
|
62
|
+
glDepthFunc(GL_LESS)
|
63
|
+
glEnable(GL_DEPTH_TEST)
|
64
|
+
glShadeModel(GL_FLAT)
|
65
|
+
|
66
|
+
glClearColor(0.0, 0.0, 0.0, 0.0)
|
67
|
+
glClearAccum(0.0, 0.0, 0.0, 0.0)
|
66
68
|
end
|
67
69
|
|
68
70
|
def displayObjects
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
71
|
+
torus_diffuse = [ 0.7, 0.7, 0.0, 1.0 ]
|
72
|
+
cube_diffuse = [ 0.0, 0.7, 0.7, 1.0 ]
|
73
|
+
sphere_diffuse = [ 0.7, 0.0, 0.7, 1.0 ]
|
74
|
+
octa_diffuse = [ 0.7, 0.4, 0.4, 1.0 ]
|
75
|
+
|
76
|
+
glPushMatrix()
|
77
|
+
glRotate(30.0, 1.0, 0.0, 0.0)
|
78
|
+
|
79
|
+
glPushMatrix()
|
80
|
+
glTranslate(-0.80, 0.35, 0.0)
|
81
|
+
glRotate(100.0, 1.0, 0.0, 0.0)
|
82
|
+
glMaterial(GL_FRONT, GL_DIFFUSE, torus_diffuse)
|
83
|
+
glutSolidTorus(0.275, 0.85, 16, 16)
|
84
|
+
glPopMatrix()
|
85
|
+
|
86
|
+
glPushMatrix()
|
87
|
+
glTranslate(-0.75, -0.50, 0.0)
|
88
|
+
glRotate(45.0, 0.0, 0.0, 1.0)
|
89
|
+
glRotate(45.0, 1.0, 0.0, 0.0)
|
90
|
+
glMaterial(GL_FRONT, GL_DIFFUSE, cube_diffuse)
|
91
|
+
glutSolidCube(1.5)
|
92
|
+
glPopMatrix()
|
93
|
+
|
94
|
+
glPushMatrix()
|
95
|
+
glTranslate(0.75, 0.60, 0.0)
|
96
|
+
glRotate(30.0, 1.0, 0.0, 0.0)
|
97
|
+
glMaterial(GL_FRONT, GL_DIFFUSE, sphere_diffuse)
|
98
|
+
glutSolidSphere(1.0, 16, 16)
|
99
|
+
glPopMatrix()
|
100
|
+
|
101
|
+
glPushMatrix()
|
102
|
+
glTranslate(0.70, -0.90, 0.25)
|
103
|
+
glMaterial(GL_FRONT, GL_DIFFUSE, octa_diffuse)
|
104
|
+
glutSolidOctahedron()
|
105
|
+
glPopMatrix()
|
106
|
+
|
107
|
+
glPopMatrix()
|
106
108
|
end
|
107
109
|
|
108
110
|
ACSIZE=8
|
109
111
|
|
110
112
|
myDisplay = proc do
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
113
|
+
viewport = glGetDoublev(GL_VIEWPORT)
|
114
|
+
|
115
|
+
glClear(GL_ACCUM_BUFFER_BIT)
|
116
|
+
for jitter in 0...ACSIZE
|
117
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
118
|
+
glPushMatrix()
|
119
|
+
# Note that 4.5 is the distance in world space between
|
120
|
+
# left and right and bottom and top.
|
121
|
+
# This formula converts fractional pixel movement to
|
122
|
+
# world coordinates.
|
123
|
+
glTranslate($j8[jitter][0]*4.5/viewport[2], $j8[jitter][1]*4.5/viewport[3], 0.0)
|
124
|
+
displayObjects()
|
125
|
+
glPopMatrix()
|
126
|
+
glAccum(GL_ACCUM, 1.0/ACSIZE)
|
127
|
+
end
|
128
|
+
glAccum(GL_RETURN, 1.0)
|
129
|
+
glutSwapBuffers()
|
128
130
|
end
|
129
131
|
|
130
132
|
myReshape = proc do |w, h|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
133
|
+
glViewport(0, 0, w, h)
|
134
|
+
glMatrixMode(GL_PROJECTION)
|
135
|
+
glLoadIdentity()
|
136
|
+
if (w <= h)
|
137
|
+
glOrtho(-2.25, 2.25, -2.25*h/w, 2.25*h/w, -10.0, 10.0)
|
138
|
+
else
|
139
|
+
glOrtho(-2.25*w/h, 2.25*w/h, -2.25, 2.25, -10.0, 10.0)
|
140
|
+
end
|
141
|
+
glMatrixMode(GL_MODELVIEW)
|
140
142
|
end
|
141
143
|
|
142
144
|
keyboard = Proc.new do |key, x, y|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
145
|
+
case (key)
|
146
|
+
when ?\e
|
147
|
+
exit(0);
|
148
|
+
end
|
147
149
|
end
|
148
150
|
|
149
151
|
# Main Loop
|
150
|
-
# Open window with initial window size, title bar,
|
152
|
+
# Open window with initial window size, title bar,
|
151
153
|
# RGBA display mode, and handle input events.
|
152
154
|
#
|
153
155
|
glutInit()
|