ruby-opengl 0.40.1 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/doc/build_install.txt +48 -28
- data/doc/extensions.txt +361 -0
- data/doc/history.txt +8 -2
- data/doc/requirements_and_design.txt +0 -13
- data/doc/roadmap.txt +11 -13
- data/doc/supplies/page_template.html +11 -5
- data/doc/thanks.txt +2 -4
- data/doc/tutorial.txt +1 -4
- data/examples/{nehe_lesson02.rb → NeHe/nehe_lesson02.rb} +0 -0
- data/examples/{nehe_lesson03.rb → NeHe/nehe_lesson03.rb} +0 -0
- data/examples/{nehe_lesson04.rb → NeHe/nehe_lesson04.rb} +0 -0
- data/examples/{nehe_lesson05.rb → NeHe/nehe_lesson05.rb} +0 -0
- data/examples/NeHe/nehe_lesson36.rb +303 -0
- data/examples/OrangeBook/3Dlabs-License.txt +33 -0
- data/examples/OrangeBook/brick.frag +36 -0
- data/examples/OrangeBook/brick.rb +388 -0
- data/examples/OrangeBook/brick.vert +41 -0
- data/examples/OrangeBook/particle.frag +17 -0
- data/examples/OrangeBook/particle.rb +424 -0
- data/examples/OrangeBook/particle.vert +38 -0
- data/examples/README +13 -83
- data/examples/RedBook/aaindex.rb +97 -0
- data/examples/RedBook/aapoly.rb +142 -0
- data/examples/RedBook/aargb.rb +119 -0
- data/examples/RedBook/accanti.rb +162 -0
- data/examples/RedBook/accpersp.rb +215 -0
- data/examples/RedBook/alpha.rb +123 -0
- data/examples/RedBook/alpha3D.rb +158 -0
- data/examples/RedBook/bezcurve.rb +105 -0
- data/examples/RedBook/bezmesh.rb +137 -0
- data/examples/RedBook/checker.rb +124 -0
- data/examples/RedBook/clip.rb +95 -0
- data/examples/RedBook/colormat.rb +135 -0
- data/examples/RedBook/cube.rb +69 -0
- data/examples/RedBook/depthcue.rb +99 -0
- data/examples/RedBook/dof.rb +205 -0
- data/examples/{legacy → RedBook}/double.rb +59 -58
- data/examples/{legacy → RedBook}/drawf.rb +47 -54
- data/examples/RedBook/feedback.rb +145 -0
- data/examples/RedBook/fog.rb +167 -0
- data/examples/RedBook/font.rb +151 -0
- data/examples/RedBook/hello.rb +79 -0
- data/examples/RedBook/image.rb +137 -0
- data/examples/{legacy → RedBook}/jitter.rb +60 -62
- data/examples/RedBook/lines.rb +128 -0
- data/examples/RedBook/list.rb +111 -0
- data/examples/RedBook/material.rb +275 -0
- data/examples/RedBook/mipmap.rb +156 -0
- data/examples/{legacy → RedBook}/model.rb +66 -72
- data/examples/{legacy → RedBook}/movelight.rb +67 -75
- data/examples/RedBook/pickdepth.rb +179 -0
- data/examples/{legacy → RedBook}/planet.rb +62 -66
- data/examples/RedBook/quadric.rb +158 -0
- data/examples/RedBook/robot.rb +115 -0
- data/examples/RedBook/select.rb +196 -0
- data/examples/RedBook/smooth.rb +95 -0
- data/examples/RedBook/stencil.rb +163 -0
- data/examples/RedBook/stroke.rb +167 -0
- data/examples/RedBook/surface.rb +166 -0
- data/examples/RedBook/teaambient.rb +132 -0
- data/examples/RedBook/teapots.rb +182 -0
- data/examples/RedBook/tess.rb +183 -0
- data/examples/RedBook/texbind.rb +147 -0
- data/examples/RedBook/texgen.rb +169 -0
- data/examples/RedBook/texturesurf.rb +128 -0
- data/examples/RedBook/varray.rb +159 -0
- data/examples/RedBook/wrap.rb +148 -0
- data/examples/misc/anisotropic.rb +194 -0
- data/examples/misc/font-glut.rb +46 -0
- data/examples/{plane.rb → misc/plane.rb} +0 -0
- data/examples/misc/readpixel.rb +65 -0
- data/examples/{smooth.rb → misc/smooth.rb} +0 -0
- data/examples/{test.rb → misc/test.rb} +0 -0
- data/ext/common/common.h +252 -70
- data/ext/common/gl-enums.h +6102 -7334
- data/ext/common/gl-types.h +47 -0
- data/ext/common/glu-enums.h +469 -0
- data/ext/gl/gl-1.0-1.1.c +842 -2464
- data/ext/gl/gl-1.2.c +217 -281
- data/ext/gl/gl-1.3.c +113 -133
- data/ext/gl/gl-1.4.c +98 -334
- data/ext/gl/gl-1.5.c +28 -34
- data/ext/gl/gl-2.0.c +26 -235
- data/ext/gl/gl-2.1.c +31 -124
- data/ext/gl/gl-enums.c +786 -631
- data/ext/gl/gl-ext-arb.c +66 -0
- data/ext/gl/gl-ext-ext.c +218 -0
- data/ext/gl/gl.c +138 -31
- data/ext/gl/mkrf_conf.rb +1 -0
- data/ext/glu/glu-enums.c +163 -0
- data/ext/glu/glu.c +1003 -1205
- data/ext/glu/mkrf_conf.rb +1 -0
- data/ext/glut/glut.c +1056 -1175
- data/lib/opengl.rb +90 -3
- data/test/tc_common.rb +26 -13
- data/test/tc_ext_arb.rb +73 -0
- data/test/tc_ext_ext.rb +74 -0
- data/test/tc_func_12.rb +8 -8
- data/test/tc_func_13.rb +17 -11
- data/test/tc_func_14.rb +8 -8
- data/test/tc_func_15.rb +190 -2
- data/test/tc_func_20.rb +36 -10
- data/test/tc_func_21.rb +445 -2
- data/test/tc_glu.rb +305 -0
- data/test/tc_misc.rb +1 -0
- metadata +84 -68
- data/doc/screenshots.txt +0 -23
- data/examples/legacy/COPYRIGHT +0 -8
- data/examples/legacy/aaindex.rb +0 -98
- data/examples/legacy/aapoly.rb +0 -153
- data/examples/legacy/aargb.rb +0 -139
- data/examples/legacy/accanti.rb +0 -159
- data/examples/legacy/accpersp.rb +0 -216
- data/examples/legacy/alpha.rb +0 -133
- data/examples/legacy/alpha3D.rb +0 -165
- data/examples/legacy/bezcurve.rb +0 -107
- data/examples/legacy/bezmesh.rb +0 -131
- data/examples/legacy/checker.rb +0 -121
- data/examples/legacy/clip.rb +0 -104
- data/examples/legacy/colormat.rb +0 -145
- data/examples/legacy/cube.rb +0 -73
- data/examples/legacy/depthcue.rb +0 -101
- data/examples/legacy/dof.rb +0 -212
- data/examples/legacy/feedback.rb +0 -152
- data/examples/legacy/fog.rb +0 -172
- data/examples/legacy/font-glut.rb +0 -41
- data/examples/legacy/font.rb +0 -158
- data/examples/legacy/hello.rb +0 -75
- data/examples/legacy/image.rb +0 -145
- data/examples/legacy/lines.rb +0 -135
- data/examples/legacy/list.rb +0 -120
- data/examples/legacy/material.rb +0 -290
- data/examples/legacy/mipmap.rb +0 -159
- data/examples/legacy/pickdepth.rb +0 -180
- data/examples/legacy/quadric.rb +0 -180
- data/examples/legacy/readpixel.rb +0 -59
- data/examples/legacy/robot.rb +0 -120
- data/examples/legacy/select.rb +0 -207
- data/examples/legacy/smooth.rb +0 -41
- data/examples/legacy/stencil.rb +0 -154
- data/examples/legacy/stroke.rb +0 -170
- data/examples/legacy/surface.rb +0 -170
- data/examples/legacy/teaambient.rb +0 -132
- data/examples/legacy/teapots.rb +0 -188
- data/examples/legacy/tess.rb +0 -222
- data/examples/legacy/texbind.rb +0 -157
- data/examples/legacy/texgen.rb +0 -171
- data/examples/legacy/texturesurf.rb +0 -128
- data/examples/legacy/varray.rb +0 -167
- data/examples/legacy/wrap.rb +0 -158
- data/lib/gl_prev.rb +0 -46
- data/lib/glu_prev.rb +0 -46
- data/lib/glut_prev.rb +0 -45
data/examples/legacy/hello.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
3
|
-
#ALL RIGHTS RESERVED
|
4
|
-
#Permission to use, copy, modify, and distribute this software for
|
5
|
-
#any purpose and without fee is hereby granted, provided that the above
|
6
|
-
#copyright notice appear in all copies and that both the copyright notice
|
7
|
-
#and this permission notice appear in supporting documentation, and that
|
8
|
-
#the name of Silicon Graphics, Inc. not be used in advertising
|
9
|
-
#or publicity pertaining to distribution of the software without specific,
|
10
|
-
#written prior permission.
|
11
|
-
#
|
12
|
-
#THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
13
|
-
#AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
14
|
-
#INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
15
|
-
#FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
16
|
-
#GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
17
|
-
#SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
18
|
-
#KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
19
|
-
#LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
20
|
-
#THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
21
|
-
#ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
22
|
-
#ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
23
|
-
#POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
-
#
|
25
|
-
#US Government Users Restricted Rights
|
26
|
-
#Use, duplication, or disclosure by the Government is subject to
|
27
|
-
#restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
28
|
-
#(c)(1)(ii) of the Rights in Technical Data and Computer Software
|
29
|
-
#clause at DFARS 252.227-7013 and/or in similar or successor
|
30
|
-
#clauses in the FAR or the DOD or NASA FAR Supplement.
|
31
|
-
#Unpublished-- rights reserved under the copyright laws of the
|
32
|
-
#United States. Contractor/manufacturer is Silicon Graphics,
|
33
|
-
#Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
34
|
-
#
|
35
|
-
#OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
|
36
|
-
#
|
37
|
-
|
38
|
-
#
|
39
|
-
#hello.c
|
40
|
-
#This is a simple, introductory OpenGL program.
|
41
|
-
#
|
42
|
-
require "gl_prev"
|
43
|
-
require "glu_prev"
|
44
|
-
require "glut_prev"
|
45
|
-
|
46
|
-
display = Proc.new {
|
47
|
-
GL.Clear (GL::COLOR_BUFFER_BIT);
|
48
|
-
|
49
|
-
GL.Color(1.0, 1.0, 1.0);
|
50
|
-
GL.Begin(GL::POLYGON);
|
51
|
-
GL.Vertex(0.25, 0.25, 0.0);
|
52
|
-
GL.Vertex(0.75, 0.25, 0.0);
|
53
|
-
GL.Vertex(0.75, 0.75, 0.0);
|
54
|
-
GL.Vertex(0.25, 0.75, 0.0);
|
55
|
-
GL.End();
|
56
|
-
|
57
|
-
GL.Flush();
|
58
|
-
}
|
59
|
-
|
60
|
-
def init
|
61
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
62
|
-
|
63
|
-
GL.MatrixMode(GL::PROJECTION);
|
64
|
-
GL.LoadIdentity();
|
65
|
-
GL.Ortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
66
|
-
end
|
67
|
-
|
68
|
-
GLUT.Init
|
69
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
70
|
-
GLUT.InitWindowSize(250, 250);
|
71
|
-
GLUT.InitWindowPosition(100, 100);
|
72
|
-
GLUT.CreateWindow("hello");
|
73
|
-
init();
|
74
|
-
GLUT.DisplayFunc(display);
|
75
|
-
GLUT.MainLoop();
|
data/examples/legacy/image.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
#/*
|
2
|
-
# * Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
3
|
-
# * ALL RIGHTS RESERVED
|
4
|
-
# * Permission to use, copy, modify, and distribute this software for
|
5
|
-
# * any purpose and without fee is hereby granted, provided that the above
|
6
|
-
# * copyright notice appear in all copies and that both the copyright notice
|
7
|
-
# * and this permission notice appear in supporting documentation, and that
|
8
|
-
# * the name of Silicon Graphics, Inc. not be used in advertising
|
9
|
-
# * or publicity pertaining to distribution of the software without specific,
|
10
|
-
# * written prior permission.
|
11
|
-
# *
|
12
|
-
# * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
13
|
-
# * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
14
|
-
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
15
|
-
# * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
16
|
-
# * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
17
|
-
# * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
18
|
-
# * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
19
|
-
# * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
20
|
-
# * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
21
|
-
# * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
22
|
-
# * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
23
|
-
# * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
-
# *
|
25
|
-
# * US Government Users Restricted Rights
|
26
|
-
# * Use, duplication, or disclosure by the Government is subject to
|
27
|
-
# * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
28
|
-
# * (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
29
|
-
# * clause at DFARS 252.227-7013 and/or in similar or successor
|
30
|
-
# * clauses in the FAR or the DOD or NASA FAR Supplement.
|
31
|
-
# * Unpublished-- rights reserved under the copyright laws of the
|
32
|
-
# * United States. Contractor/manufacturer is Silicon Graphics,
|
33
|
-
# * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
34
|
-
# *
|
35
|
-
# * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
|
36
|
-
# */
|
37
|
-
#
|
38
|
-
#/* image.c
|
39
|
-
# * This program demonstrates drawing pixels and shows the effect
|
40
|
-
# * of glDrawPixels(), glCopyPixels(), and glPixelZoom().
|
41
|
-
# * Interaction: moving the mouse while pressing the mouse button
|
42
|
-
# * will copy the image in the lower-left corner of the window
|
43
|
-
# * to the mouse position, using the current pixel zoom factors.
|
44
|
-
# * There is no attempt to prevent you from drawing over the original
|
45
|
-
# * image. If you press the 'r' key, the original image and zoom
|
46
|
-
# * factors are reset. If you press the 'z' or 'Z' keys, you change
|
47
|
-
# * the zoom factors.
|
48
|
-
# */
|
49
|
-
|
50
|
-
require "gl_prev"
|
51
|
-
require "glu_prev"
|
52
|
-
require "glut_prev"
|
53
|
-
require "mathn"
|
54
|
-
|
55
|
-
# /* Create checkerboard image */
|
56
|
-
CheckImageWidth=64
|
57
|
-
CheckImageHeight=64
|
58
|
-
$checkImage=[]
|
59
|
-
|
60
|
-
$zoomFactor = 1.0;
|
61
|
-
$height = 0.0;
|
62
|
-
|
63
|
-
def makeCheckImage
|
64
|
-
for i in 0..CheckImageWidth-1
|
65
|
-
for j in 0..CheckImageHeight-1
|
66
|
-
c = if ((i&0x8==0) != (j&0x8==0)) then 255; else 0; end;
|
67
|
-
$checkImage[(i+CheckImageWidth*j)*3+0] = c;
|
68
|
-
$checkImage[(i+CheckImageWidth*j)*3+1] = c;
|
69
|
-
$checkImage[(i+CheckImageWidth*j)*3+2] = c;
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def init
|
75
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
76
|
-
GL.ShadeModel(GL::FLAT);
|
77
|
-
makeCheckImage();
|
78
|
-
GL.PixelStorei(GL::UNPACK_ALIGNMENT, 1);
|
79
|
-
end
|
80
|
-
|
81
|
-
display = Proc.new {
|
82
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
83
|
-
GL.RasterPos(0, 0);
|
84
|
-
GL.DrawPixels(CheckImageWidth, CheckImageHeight, GL::RGB, GL::UNSIGNED_BYTE, $checkImage.pack("C*"));
|
85
|
-
GL.Flush();
|
86
|
-
}
|
87
|
-
|
88
|
-
reshape = Proc.new {|w, h|
|
89
|
-
GL.Viewport(0, 0, w, h);
|
90
|
-
$height = h;
|
91
|
-
GL.MatrixMode(GL::PROJECTION);
|
92
|
-
GL.LoadIdentity();
|
93
|
-
GLU.Ortho2D(0.0, w, 0.0, h);
|
94
|
-
GL.MatrixMode(GL::MODELVIEW);
|
95
|
-
GL.LoadIdentity();
|
96
|
-
}
|
97
|
-
|
98
|
-
$screeny = 0.0
|
99
|
-
motion = Proc.new {|x, y|
|
100
|
-
|
101
|
-
$screeny = $height - y;
|
102
|
-
GL.RasterPos(x, $screeny);
|
103
|
-
GL.PixelZoom($zoomFactor, $zoomFactor);
|
104
|
-
GL.CopyPixels(0, 0, CheckImageWidth, CheckImageHeight, GL::COLOR);
|
105
|
-
GL.PixelZoom(1.0, 1.0);
|
106
|
-
GL.Flush();
|
107
|
-
}
|
108
|
-
|
109
|
-
# /* ARGSUSED1 */
|
110
|
-
keyboard = Proc.new {|key, x, y|
|
111
|
-
case (key)
|
112
|
-
when 'r'[0],'R'[0]
|
113
|
-
$zoomFactor = 1.0;
|
114
|
-
GLUT.PostRedisplay();
|
115
|
-
printf("zoomFactor reset to 1.0\n");
|
116
|
-
when 'z'[0]
|
117
|
-
$zoomFactor = $zoomFactor + 0.5;
|
118
|
-
if ($zoomFactor >= 3.0)
|
119
|
-
$zoomFactor = 3.0;
|
120
|
-
end
|
121
|
-
printf("zoomFactor is now %4.1f\n", $zoomFactor);
|
122
|
-
when 'Z'[0]
|
123
|
-
$zoomFactor = $zoomFactor - 0.5;
|
124
|
-
if ($zoomFactor <= 0.5)
|
125
|
-
$zoomFactor = 0.5;
|
126
|
-
end
|
127
|
-
printf("zoomFactor is now %4.1f\n", $zoomFactor);
|
128
|
-
when 27
|
129
|
-
exit(0);
|
130
|
-
end
|
131
|
-
}
|
132
|
-
|
133
|
-
#int main(int argc, char** argv)
|
134
|
-
#{
|
135
|
-
GLUT.Init
|
136
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
137
|
-
GLUT.InitWindowSize(250, 250);
|
138
|
-
GLUT.InitWindowPosition(100, 100);
|
139
|
-
GLUT.CreateWindow($0);
|
140
|
-
init();
|
141
|
-
GLUT.DisplayFunc(display);
|
142
|
-
GLUT.ReshapeFunc(reshape);
|
143
|
-
GLUT.KeyboardFunc(keyboard);
|
144
|
-
GLUT.MotionFunc(motion);
|
145
|
-
GLUT.MainLoop();
|
data/examples/legacy/lines.rb
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
#/*
|
2
|
-
# * Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
3
|
-
# * ALL RIGHTS RESERVED
|
4
|
-
# * Permission to use, copy, modify, and distribute this software for
|
5
|
-
# * any purpose and without fee is hereby granted, provided that the above
|
6
|
-
# * copyright notice appear in all copies and that both the copyright notice
|
7
|
-
# * and this permission notice appear in supporting documentation, and that
|
8
|
-
# * the name of Silicon Graphics, Inc. not be used in advertising
|
9
|
-
# * or publicity pertaining to distribution of the software without specific,
|
10
|
-
# * written prior permission.
|
11
|
-
# *
|
12
|
-
# * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
13
|
-
# * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
14
|
-
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
15
|
-
# * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
16
|
-
# * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
17
|
-
# * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
18
|
-
# * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
19
|
-
# * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
20
|
-
# * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
21
|
-
# * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
22
|
-
# * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
23
|
-
# * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
-
# *
|
25
|
-
# * US Government Users Restricted Rights
|
26
|
-
# * Use, duplication, or disclosure by the Government is subject to
|
27
|
-
# * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
28
|
-
# * (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
29
|
-
# * clause at DFARS 252.227-7013 and/or in similar or successor
|
30
|
-
# * clauses in the FAR or the DOD or NASA FAR Supplement.
|
31
|
-
# * Unpublished-- rights reserved under the copyright laws of the
|
32
|
-
# * United States. Contractor/manufacturer is Silicon Graphics,
|
33
|
-
# * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
34
|
-
# *
|
35
|
-
# * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
|
36
|
-
# */
|
37
|
-
#
|
38
|
-
#/*
|
39
|
-
# * lines.c
|
40
|
-
# * This program demonstrates geometric primitives and
|
41
|
-
# * their attributes.
|
42
|
-
# */
|
43
|
-
|
44
|
-
require "gl_prev"
|
45
|
-
require "glu_prev"
|
46
|
-
require "glut_prev"
|
47
|
-
require "mathn"
|
48
|
-
|
49
|
-
def drawOneLine(x1,y1,x2,y2)
|
50
|
-
GL.Begin(GL::LINES);
|
51
|
-
GL.Vertex((x1),(y1)); GL.Vertex((x2),(y2)); GL.End();
|
52
|
-
end
|
53
|
-
|
54
|
-
def init
|
55
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
56
|
-
GL.ShadeModel(GL::FLAT);
|
57
|
-
end
|
58
|
-
|
59
|
-
display = Proc.new {
|
60
|
-
|
61
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
62
|
-
|
63
|
-
#/* select white for all lines */
|
64
|
-
GL.Color(1.0, 1.0, 1.0);
|
65
|
-
|
66
|
-
#/* in 1st row, 3 lines, each with a different stipple */
|
67
|
-
GL.Enable(GL::LINE_STIPPLE);
|
68
|
-
|
69
|
-
GL.LineStipple(1, 0x0101); # /* dotted */
|
70
|
-
drawOneLine(50.0, 125.0, 150.0, 125.0);
|
71
|
-
GL.LineStipple(1, 0x00FF); # /* dashed */
|
72
|
-
drawOneLine(150.0, 125.0, 250.0, 125.0);
|
73
|
-
GL.LineStipple(1, 0x1C47); #/* dash/dot/dash */
|
74
|
-
drawOneLine(250.0, 125.0, 350.0, 125.0);
|
75
|
-
|
76
|
-
#/* in 2nd row, 3 wide lines, each with different stipple */
|
77
|
-
GL.LineWidth (5.0);
|
78
|
-
GL.LineStipple(1, 0x0101); # /* dotted */
|
79
|
-
drawOneLine(50.0, 100.0, 150.0, 100.0);
|
80
|
-
GL.LineStipple(1, 0x00FF); # /* dashed */
|
81
|
-
drawOneLine(150.0, 100.0, 250.0, 100.0);
|
82
|
-
GL.LineStipple(1, 0x1C47); # /* dash/dot/dash */
|
83
|
-
drawOneLine(250.0, 100.0, 350.0, 100.0);
|
84
|
-
GL.LineWidth(1.0);
|
85
|
-
|
86
|
-
# /* in 3rd row, 6 lines, with dash/dot/dash stipple */
|
87
|
-
# /* as part of a single connected line strip */
|
88
|
-
GL.LineStipple(1, 0x1C47); # /* dash/dot/dash */
|
89
|
-
GL.Begin(GL::LINE_STRIP);
|
90
|
-
for i in 0..6
|
91
|
-
GL.Vertex(50.0 + (i * 50.0), 75.0);
|
92
|
-
end
|
93
|
-
GL.End();
|
94
|
-
|
95
|
-
#/* in 4th row, 6 independent lines with same stipple */
|
96
|
-
for i in 0..5
|
97
|
-
drawOneLine(50.0 + (i * 50.0), 50.0, 50.0 + ((i+1) * 50.0), 50.0);
|
98
|
-
end
|
99
|
-
|
100
|
-
# /* in 5th row, 1 line, with dash/dot/dash stipple */
|
101
|
-
# /* and a stipple repeat factor of 5 */
|
102
|
-
GL.LineStipple(5, 0x1C47); #/* dash/dot/dash */
|
103
|
-
drawOneLine(50.0, 25.0, 350.0, 25.0);
|
104
|
-
|
105
|
-
GL.Disable(GL::LINE_STIPPLE);
|
106
|
-
GL.Flush();
|
107
|
-
}
|
108
|
-
|
109
|
-
reshape = Proc.new {|w, h|
|
110
|
-
GL.Viewport(0, 0, w, h);
|
111
|
-
GL.MatrixMode(GL::PROJECTION);
|
112
|
-
GL.LoadIdentity();
|
113
|
-
GLU.Ortho2D(0.0, w, 0.0, h);
|
114
|
-
}
|
115
|
-
|
116
|
-
# /* ARGSUSED1 */
|
117
|
-
keyboard = Proc.new {|key, x, y|
|
118
|
-
case (key)
|
119
|
-
when 27
|
120
|
-
exit(0);
|
121
|
-
end
|
122
|
-
}
|
123
|
-
|
124
|
-
# int main(int argc, char** argv)
|
125
|
-
# {
|
126
|
-
GLUT.Init
|
127
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
128
|
-
GLUT.InitWindowSize(400, 150);
|
129
|
-
GLUT.InitWindowPosition(100, 100);
|
130
|
-
GLUT.CreateWindow($0);
|
131
|
-
init();
|
132
|
-
GLUT.DisplayFunc(display);
|
133
|
-
GLUT.ReshapeFunc(reshape);
|
134
|
-
GLUT.KeyboardFunc(keyboard);
|
135
|
-
GLUT.MainLoop();
|
data/examples/legacy/list.rb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
#/*
|
2
|
-
# * Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
3
|
-
# * ALL RIGHTS RESERVED
|
4
|
-
# * Permission to use, copy, modify, and distribute this software for
|
5
|
-
# * any purpose and without fee is hereby granted, provided that the above
|
6
|
-
# * copyright notice appear in all copies and that both the copyright notice
|
7
|
-
# * and this permission notice appear in supporting documentation, and that
|
8
|
-
# * the name of Silicon Graphics, Inc. not be used in advertising
|
9
|
-
# * or publicity pertaining to distribution of the software without specific,
|
10
|
-
# * written prior permission.
|
11
|
-
# *
|
12
|
-
# * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
13
|
-
# * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
14
|
-
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
15
|
-
# * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
16
|
-
# * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
17
|
-
# * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
18
|
-
# * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
19
|
-
# * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
20
|
-
# * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
21
|
-
# * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
22
|
-
# * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
23
|
-
# * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
-
# *
|
25
|
-
# * US Government Users Restricted Rights
|
26
|
-
# * Use, duplication, or disclosure by the Government is subject to
|
27
|
-
# * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
28
|
-
# * (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
29
|
-
# * clause at DFARS 252.227-7013 and/or in similar or successor
|
30
|
-
# * clauses in the FAR or the DOD or NASA FAR Supplement.
|
31
|
-
# * Unpublished-- rights reserved under the copyright laws of the
|
32
|
-
# * United States. Contractor/manufacturer is Silicon Graphics,
|
33
|
-
# * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
34
|
-
# *
|
35
|
-
# * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
|
36
|
-
# */
|
37
|
-
#
|
38
|
-
#/*
|
39
|
-
# * list.c
|
40
|
-
# * This program demonstrates how to make and execute a
|
41
|
-
# * display list. Note that attributes, such as current
|
42
|
-
# * color and matrix, are changed.
|
43
|
-
# */
|
44
|
-
require "gl_prev"
|
45
|
-
require "glu_prev"
|
46
|
-
require "glut_prev"
|
47
|
-
require "mathn"
|
48
|
-
|
49
|
-
$listName = 0;
|
50
|
-
|
51
|
-
def init
|
52
|
-
$listName = GL.GenLists(1);
|
53
|
-
GL.NewList($listName, GL::COMPILE);
|
54
|
-
GL.Color(1.0, 0.0, 0.0); # /* current color red */
|
55
|
-
GL.Begin(GL::TRIANGLES);
|
56
|
-
GL.Vertex(0.0, 0.0);
|
57
|
-
GL.Vertex(1.0, 0.0);
|
58
|
-
GL.Vertex(0.0, 1.0);
|
59
|
-
GL.End();
|
60
|
-
GL.Translate(1.5, 0.0, 0.0); # /* move position */
|
61
|
-
GL.EndList();
|
62
|
-
GL.ShadeModel(GL::FLAT);
|
63
|
-
end
|
64
|
-
|
65
|
-
def drawLine
|
66
|
-
GL.Begin(GL::LINES);
|
67
|
-
GL.Vertex(0.0, 0.5);
|
68
|
-
GL.Vertex(15.0, 0.5);
|
69
|
-
GL.End();
|
70
|
-
end
|
71
|
-
|
72
|
-
display = Proc.new {
|
73
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
74
|
-
GL.Color(0.0, 1.0, 0.0); # /* current color green */
|
75
|
-
for i in (0..9 ) # /* draw 10 triangles */
|
76
|
-
GL.CallList($listName);
|
77
|
-
end
|
78
|
-
drawLine(); # /* is this line green? NO! */
|
79
|
-
# /* where is the line drawn? */
|
80
|
-
GL.Flush();
|
81
|
-
}
|
82
|
-
|
83
|
-
reshape = Proc.new {|w, h|
|
84
|
-
GL.Viewport(0, 0, w, h);
|
85
|
-
GL.MatrixMode(GL::PROJECTION);
|
86
|
-
GL.LoadIdentity();
|
87
|
-
if (w <= h)
|
88
|
-
GLU.Ortho2D(0.0, 2.0, -0.5 * h/w, 1.5 * h/w);
|
89
|
-
else
|
90
|
-
GLU.Ortho2D(0.0, 2.0 * w/h, -0.5, 1.5);
|
91
|
-
end
|
92
|
-
GL.MatrixMode(GL::MODELVIEW);
|
93
|
-
GL.LoadIdentity();
|
94
|
-
}
|
95
|
-
|
96
|
-
# /* ARGSUSED1 */
|
97
|
-
keyboard = Proc.new {|key, x, y|
|
98
|
-
case (key)
|
99
|
-
when 27
|
100
|
-
exit(0);
|
101
|
-
end
|
102
|
-
}
|
103
|
-
|
104
|
-
# /* Main Loop
|
105
|
-
# * Open window with initial window size, title bar,
|
106
|
-
# * RGBA display mode, and handle input events.
|
107
|
-
# */
|
108
|
-
# int main(int argc, char** argv)
|
109
|
-
# {
|
110
|
-
GLUT.Init
|
111
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
112
|
-
GLUT.InitWindowSize(650, 50);
|
113
|
-
GLUT.CreateWindow($0);
|
114
|
-
init();
|
115
|
-
GLUT.ReshapeFunc(reshape);
|
116
|
-
GLUT.DisplayFunc(display);
|
117
|
-
GLUT.KeyboardFunc(keyboard);
|
118
|
-
GLUT.MainLoop();
|
119
|
-
# return 0;
|
120
|
-
#}
|