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/stencil.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
|
@@ -37,12 +37,14 @@
|
|
37
37
|
# OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
38
38
|
#
|
39
39
|
# stencil.c
|
40
|
-
# This program draws two rotated tori in a window.
|
41
|
-
# A diamond in the center of the window masks out part
|
42
|
-
# of the scene. Within this mask, a different model
|
40
|
+
# This program draws two rotated tori in a window.
|
41
|
+
# A diamond in the center of the window masks out part
|
42
|
+
# of the scene. Within this mask, a different model
|
43
43
|
# (a sphere) is drawn in a different color.
|
44
44
|
#
|
45
45
|
require 'opengl'
|
46
|
+
require 'glu'
|
47
|
+
require 'glut'
|
46
48
|
require 'rational'
|
47
49
|
include Gl,Glu,Glut
|
48
50
|
|
@@ -50,106 +52,106 @@ YELLOWMAT=1
|
|
50
52
|
BLUEMAT=2
|
51
53
|
|
52
54
|
def myinit
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
55
|
+
yellow_diffuse = [ 0.7, 0.7, 0.0, 1.0 ]
|
56
|
+
yellow_specular = [ 1.0, 1.0, 1.0, 1.0 ]
|
57
|
+
|
58
|
+
blue_diffuse = [ 0.1, 0.1, 0.7, 1.0 ]
|
59
|
+
blue_specular = [ 0.1, 1.0, 1.0, 1.0 ]
|
60
|
+
|
61
|
+
position_one = [ 1.0, 1.0, 1.0, 0.0 ]
|
62
|
+
|
63
|
+
glNewList(YELLOWMAT, GL_COMPILE)
|
64
|
+
glMaterial(GL_FRONT, GL_DIFFUSE, yellow_diffuse)
|
65
|
+
glMaterial(GL_FRONT, GL_SPECULAR, yellow_specular)
|
66
|
+
glMaterial(GL_FRONT, GL_SHININESS, 64.0)
|
67
|
+
glEndList()
|
68
|
+
|
69
|
+
glNewList(BLUEMAT, GL_COMPILE)
|
70
|
+
glMaterial(GL_FRONT, GL_DIFFUSE, blue_diffuse)
|
71
|
+
glMaterial(GL_FRONT, GL_SPECULAR, blue_specular)
|
72
|
+
glMaterial(GL_FRONT, GL_SHININESS, 45.0)
|
73
|
+
glEndList()
|
74
|
+
|
75
|
+
glLight(GL_LIGHT0, GL_POSITION, position_one)
|
76
|
+
|
77
|
+
glEnable(GL_LIGHT0)
|
78
|
+
glEnable(GL_LIGHTING)
|
79
|
+
glEnable(GL_DEPTH_TEST)
|
80
|
+
|
81
|
+
glClearStencil(0x0)
|
82
|
+
glEnable(GL_STENCIL_TEST)
|
81
83
|
end
|
82
84
|
|
83
85
|
# Draw a sphere in a diamond-shaped section in the
|
84
86
|
# middle of a window with 2 tori.
|
85
87
|
display = Proc.new do
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
88
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
89
|
+
|
90
|
+
# draw blue sphere where the stencil is 1
|
91
|
+
glStencilFunc(GL_EQUAL, 0x1, 0x1)
|
92
|
+
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)
|
93
|
+
glCallList(BLUEMAT)
|
94
|
+
glutSolidSphere(0.5, 15, 15)
|
95
|
+
|
96
|
+
# draw the tori where the stencil is not 1
|
97
|
+
glStencilFunc(GL_NOTEQUAL, 0x1, 0x1)
|
98
|
+
glPushMatrix()
|
99
|
+
glRotate(45.0, 0.0, 0.0, 1.0)
|
100
|
+
glRotate(45.0, 0.0, 1.0, 0.0)
|
101
|
+
glCallList(YELLOWMAT)
|
102
|
+
glutSolidTorus(0.275, 0.85, 15, 15)
|
103
|
+
glPushMatrix()
|
104
|
+
glRotate(90.0, 1.0, 0.0, 0.0)
|
105
|
+
glutSolidTorus(0.275, 0.85, 15, 15)
|
106
|
+
glPopMatrix()
|
107
|
+
glPopMatrix()
|
108
|
+
|
109
|
+
glutSwapBuffers()
|
108
110
|
end
|
109
111
|
|
110
|
-
# Whenever the window is reshaped, redefine the
|
112
|
+
# Whenever the window is reshaped, redefine the
|
111
113
|
# coordinate system and redraw the stencil area.
|
112
114
|
myReshape = Proc.new do |w, h|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
115
|
+
glViewport(0, 0, w, h)
|
116
|
+
|
117
|
+
# create a diamond shaped stencil area
|
118
|
+
glMatrixMode(GL_PROJECTION)
|
119
|
+
glLoadIdentity()
|
120
|
+
if w<=h
|
121
|
+
gluOrtho2D(-3.0, 3.0, -3.0*h/w, 3*h/w)
|
122
|
+
else
|
123
|
+
gluOrtho2D(-3.0*w/h, 3.0*w/h, -3.0, 3)
|
124
|
+
end
|
125
|
+
glMatrixMode(GL_MODELVIEW)
|
126
|
+
glLoadIdentity()
|
127
|
+
|
128
|
+
glClear(GL_STENCIL_BUFFER_BIT)
|
129
|
+
glStencilFunc(GL_ALWAYS, 0x1, 0x1)
|
130
|
+
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE)
|
131
|
+
glBegin(GL_QUADS)
|
132
|
+
glVertex2f(-1.0, 0.0)
|
133
|
+
glVertex2f(0.0, 1.0)
|
134
|
+
glVertex2f(1.0, 0.0)
|
135
|
+
glVertex2f(0.0, -1.0)
|
136
|
+
glEnd()
|
137
|
+
|
138
|
+
glMatrixMode(GL_PROJECTION)
|
139
|
+
glLoadIdentity()
|
140
|
+
GLU.Perspective(45.0, w.to_f/h.to_f, 3.0, 7.0)
|
141
|
+
glMatrixMode(GL_MODELVIEW)
|
142
|
+
glLoadIdentity()
|
143
|
+
glTranslate(0.0, 0.0, -5.0)
|
142
144
|
end
|
143
145
|
|
144
146
|
keyboard = Proc.new do |key, x, y|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
147
|
+
case (key)
|
148
|
+
when ?\e
|
149
|
+
exit(0);
|
150
|
+
end
|
149
151
|
end
|
150
152
|
|
151
153
|
# Main Loop
|
152
|
-
# Open window with initial window size, title bar,
|
154
|
+
# Open window with initial window size, title bar,
|
153
155
|
# RGB display mode, and handle input events.
|
154
156
|
glutInit()
|
155
157
|
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL)
|
data/examples/RedBook/stroke.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
|
@@ -36,13 +36,15 @@
|
|
36
36
|
#
|
37
37
|
# OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
38
38
|
#
|
39
|
-
# stroke.c
|
40
|
-
# This program demonstrates some characters of a
|
39
|
+
# stroke.c
|
40
|
+
# This program demonstrates some characters of a
|
41
41
|
# stroke (vector) font. The characters are represented
|
42
|
-
# by display lists, which are given numbers which
|
42
|
+
# by display lists, which are given numbers which
|
43
43
|
# correspond to the ASCII values of the characters.
|
44
44
|
# Use of glCallLists() is demonstrated.
|
45
45
|
require 'opengl'
|
46
|
+
require 'glu'
|
47
|
+
require 'glut'
|
46
48
|
require 'mathn'
|
47
49
|
include Gl,Glu,Glut
|
48
50
|
|
@@ -51,109 +53,109 @@ STROKE=2
|
|
51
53
|
END_=3
|
52
54
|
|
53
55
|
Adata = [
|
54
|
-
|
55
|
-
|
56
|
+
[[0, 0], PT], [[0, 9], PT], [[1, 10], PT], [[4, 10], PT],
|
57
|
+
[[5, 9], PT], [[5, 0], STROKE], [[0, 5], PT], [[5, 5], END_]
|
56
58
|
]
|
57
59
|
|
58
60
|
Edata = [
|
59
|
-
|
60
|
-
|
61
|
+
[[5, 0], PT], [[0, 0], PT], [[0, 10], PT], [[5, 10], STROKE],
|
62
|
+
[[0, 5], PT], [[4, 5], END_]
|
61
63
|
]
|
62
64
|
|
63
65
|
Pdata = [
|
64
|
-
|
65
|
-
|
66
|
+
[[0, 0], PT], [[0, 10], PT], [[4, 10], PT], [[5, 9], PT], [[5, 6], PT],
|
67
|
+
[[4, 5], PT], [[0, 5], END_]
|
66
68
|
]
|
67
69
|
|
68
70
|
Rdata = [
|
69
|
-
|
70
|
-
|
71
|
+
[[0, 0], PT], [[0, 10], PT], [[4, 10], PT], [[5, 9], PT], [[5, 6], PT],
|
72
|
+
[[4, 5], PT], [[0, 5], STROKE], [[3, 5], PT], [[5, 0], END_]
|
71
73
|
]
|
72
74
|
|
73
75
|
Sdata = [
|
74
|
-
|
75
|
-
|
76
|
-
|
76
|
+
[[0, 1], PT], [[1, 0], PT], [[4, 0], PT], [[5, 1], PT], [[5, 4], PT],
|
77
|
+
[[4, 5], PT], [[1, 5], PT], [[0, 6], PT], [[0, 9], PT], [[1, 10], PT],
|
78
|
+
[[4, 10], PT], [[5, 9], END_]
|
77
79
|
]
|
78
80
|
|
79
81
|
# drawLetter() interprets the instructions from the array
|
80
82
|
# for that letter and renders the letter with line segments.
|
81
83
|
def drawLetter(l)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
84
|
+
i = 0
|
85
|
+
glBegin(GL_LINE_STRIP)
|
86
|
+
while true
|
87
|
+
case (l[i][1])
|
88
|
+
when PT
|
89
|
+
glVertex(l[i][0])
|
90
|
+
when STROKE
|
91
|
+
glVertex(l[i][0])
|
92
|
+
glEnd()
|
93
|
+
glBegin(GL_LINE_STRIP)
|
94
|
+
when END_
|
95
|
+
glVertex(l[i][0])
|
96
|
+
glEnd()
|
97
|
+
glTranslate(8.0, 0.0, 0.0)
|
98
|
+
return
|
99
|
+
end
|
100
|
+
i += 1
|
101
|
+
end
|
100
102
|
end
|
101
103
|
|
102
104
|
# Create a display list for each of 6 characters
|
103
105
|
def myinit
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
106
|
+
glShadeModel(GL_FLAT)
|
107
|
+
|
108
|
+
base = glGenLists(128)
|
109
|
+
glListBase(base)
|
110
|
+
glNewList(base+'A'[0], GL_COMPILE); drawLetter(Adata); glEndList()
|
111
|
+
glNewList(base+'E'[0], GL_COMPILE); drawLetter(Edata); glEndList()
|
112
|
+
glNewList(base+'P'[0], GL_COMPILE); drawLetter(Pdata); glEndList()
|
113
|
+
glNewList(base+'R'[0], GL_COMPILE); drawLetter(Rdata); glEndList()
|
114
|
+
glNewList(base+'S'[0], GL_COMPILE); drawLetter(Sdata); glEndList()
|
115
|
+
glNewList(base+' '[0], GL_COMPILE); glTranslate(8.0, 0.0, 0.0); glEndList()
|
114
116
|
end
|
115
117
|
|
116
118
|
$test1 = "A SPARE SERAPE APPEARS AS"
|
117
119
|
$test2 = "APES PREPARE RARE PEPPERS"
|
118
120
|
|
119
121
|
def printStrokedString(s)
|
120
|
-
|
122
|
+
glCallLists(GL_BYTE,s)
|
121
123
|
end
|
122
124
|
|
123
125
|
display = Proc.new do
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
126
|
+
glClear(GL_COLOR_BUFFER_BIT)
|
127
|
+
glColor(1.0, 1.0, 1.0)
|
128
|
+
glPushMatrix()
|
129
|
+
glScale(2.0, 2.0, 2.0)
|
130
|
+
glTranslate(10.0, 30.0, 0.0)
|
131
|
+
printStrokedString($test1)
|
132
|
+
glPopMatrix()
|
133
|
+
glPushMatrix()
|
134
|
+
glScale(2.0, 2.0, 2.0)
|
135
|
+
glTranslate(10.0, 13.0, 0.0)
|
136
|
+
printStrokedString($test2)
|
137
|
+
glPopMatrix()
|
138
|
+
glutSwapBuffers()
|
137
139
|
end
|
138
140
|
|
139
141
|
reshape = Proc.new do |w, h|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
glViewport(0, 0, w, h)
|
143
|
+
glMatrixMode(GL_PROJECTION)
|
144
|
+
glLoadIdentity()
|
145
|
+
glOrtho(0.0, w, 0.0, h, -1.0, 1.0)
|
146
|
+
glMatrixMode(GL_MODELVIEW)
|
147
|
+
glLoadIdentity()
|
146
148
|
end
|
147
149
|
|
148
150
|
keyboard = Proc.new do |key, x, y|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
151
|
+
case (key)
|
152
|
+
when ?\e
|
153
|
+
exit(0);
|
154
|
+
end
|
153
155
|
end
|
154
156
|
|
155
157
|
# Main Loop
|
156
|
-
# Open window with initial window size, title bar,
|
158
|
+
# Open window with initial window size, title bar,
|
157
159
|
# RGBA display mode, and handle input events.
|
158
160
|
glutInit
|
159
161
|
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
|