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/bezcurve.rb
DELETED
@@ -1,107 +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
|
-
#/* bezcurve.c
|
39
|
-
# * This program uses evaluators to draw a Bezier curve.
|
40
|
-
# */
|
41
|
-
|
42
|
-
require "gl_prev"
|
43
|
-
require "glu_prev"
|
44
|
-
require "glut_prev"
|
45
|
-
|
46
|
-
|
47
|
-
$ctrlpoints = [
|
48
|
-
[ -4.0, -4.0, 0.0], [ -2.0, 4.0, 0.0],
|
49
|
-
[2.0, -4.0, 0.0], [4.0, 4.0, 0.0]];
|
50
|
-
|
51
|
-
def init
|
52
|
-
GL::ClearColor(0.0, 0.0, 0.0, 0.0);
|
53
|
-
GL::ShadeModel(GL::FLAT);
|
54
|
-
GL::Map1d(GL::MAP1_VERTEX_3, 0.0, 1.0, 3, 4, $ctrlpoints.flatten);
|
55
|
-
GL::Enable(GL::MAP1_VERTEX_3);
|
56
|
-
end
|
57
|
-
|
58
|
-
display = proc {
|
59
|
-
GL::Clear(GL::COLOR_BUFFER_BIT);
|
60
|
-
GL::Color(1.0, 1.0, 1.0);
|
61
|
-
GL::Begin(GL::LINE_STRIP);
|
62
|
-
for i in 0...30
|
63
|
-
GL::EvalCoord1d(i.to_f/30.0);
|
64
|
-
end
|
65
|
-
GL::End();
|
66
|
-
# /* The following code displays the control points as dots. */
|
67
|
-
GL::PointSize(5.0);
|
68
|
-
GL::Color(1.0, 1.0, 0.0);
|
69
|
-
GL::Begin(GL::POINTS);
|
70
|
-
for i in 0...4
|
71
|
-
GL::Vertex($ctrlpoints[i]);
|
72
|
-
end
|
73
|
-
GL::End();
|
74
|
-
GL::Flush();
|
75
|
-
}
|
76
|
-
|
77
|
-
reshape = proc {|w, h|
|
78
|
-
GL::Viewport(0, 0, w, h);
|
79
|
-
GL::MatrixMode(GL::PROJECTION);
|
80
|
-
GL::LoadIdentity();
|
81
|
-
if (w <= h)
|
82
|
-
GL::Ortho(-5.0, 5.0, -5.0*h/w, 5.0*h/w, -5.0, 5.0);
|
83
|
-
else
|
84
|
-
GL::Ortho(-5.0*w/h, 5.0*w/h, -5.0, 5.0, -5.0, 5.0);
|
85
|
-
end
|
86
|
-
GL::MatrixMode(GL::MODELVIEW);
|
87
|
-
GL::LoadIdentity();
|
88
|
-
}
|
89
|
-
|
90
|
-
# /* ARGSUSED1 */
|
91
|
-
keyboard = proc {|key, x, y|
|
92
|
-
case (key)
|
93
|
-
when 27
|
94
|
-
exit(0);
|
95
|
-
end
|
96
|
-
}
|
97
|
-
|
98
|
-
GLUT::Init();
|
99
|
-
GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
100
|
-
GLUT::InitWindowSize(500, 500);
|
101
|
-
GLUT::InitWindowPosition(100, 100);
|
102
|
-
GLUT::CreateWindow();
|
103
|
-
init();
|
104
|
-
GLUT::DisplayFunc(display);
|
105
|
-
GLUT::ReshapeFunc(reshape);
|
106
|
-
GLUT::KeyboardFunc(keyboard);
|
107
|
-
GLUT::MainLoop();
|
data/examples/legacy/bezmesh.rb
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#/* Copyright (c) Mark J. Kilgard, 1994. */
|
3
|
-
#
|
4
|
-
#/**
|
5
|
-
# * (c) Copyright 1993, Silicon Graphics, Inc.
|
6
|
-
# * ALL RIGHTS RESERVED
|
7
|
-
# * Permission to use, copy, modify, and distribute this software for
|
8
|
-
# * any purpose and without fee is hereby granted, provided that the above
|
9
|
-
# * copyright notice appear in all copies and that both the copyright notice
|
10
|
-
# * and this permission notice appear in supporting documentation, and that
|
11
|
-
# * the name of Silicon Graphics, Inc. not be used in advertising
|
12
|
-
# * or publicity pertaining to distribution of the software without specific,
|
13
|
-
# * written prior permission.
|
14
|
-
# *
|
15
|
-
# * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
16
|
-
# * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
17
|
-
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
18
|
-
# * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
19
|
-
# * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
20
|
-
# * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
21
|
-
# * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
22
|
-
# * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
23
|
-
# * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
24
|
-
# * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
25
|
-
# * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
26
|
-
# * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
27
|
-
# *
|
28
|
-
# * US Government Users Restricted Rights
|
29
|
-
# * Use, duplication, or disclosure by the Government is subject to
|
30
|
-
# * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
31
|
-
# * (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
32
|
-
# * clause at DFARS 252.227-7013 and/or in similar or successor
|
33
|
-
# * clauses in the FAR or the DOD or NASA FAR Supplement.
|
34
|
-
# * Unpublished-- rights reserved under the copyright laws of the
|
35
|
-
# * United States. Contractor/manufacturer is Silicon Graphics,
|
36
|
-
# * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
37
|
-
# *
|
38
|
-
# * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
39
|
-
# */
|
40
|
-
#/* bezsurf.c
|
41
|
-
# * This program renders a lighted, filled Bezier surface,
|
42
|
-
# * using two-dimensional evaluators.
|
43
|
-
# */
|
44
|
-
|
45
|
-
require "gl_prev"
|
46
|
-
require "glu_prev"
|
47
|
-
require "glut_prev"
|
48
|
-
|
49
|
-
|
50
|
-
$ctrlpoints = [
|
51
|
-
[
|
52
|
-
[-1.5, -1.5, 4.0],
|
53
|
-
[-0.5, -1.5, 2.0],
|
54
|
-
[0.5, -1.5, -1.0],
|
55
|
-
[1.5, -1.5, 2.0]],
|
56
|
-
[
|
57
|
-
[-1.5, -0.5, 1.0],
|
58
|
-
[-0.5, -0.5, 3.0],
|
59
|
-
[0.5, -0.5, 0.0],
|
60
|
-
[1.5, -0.5, -1.0]],
|
61
|
-
[
|
62
|
-
[-1.5, 0.5, 4.0],
|
63
|
-
[-0.5, 0.5, 0.0],
|
64
|
-
[0.5, 0.5, 3.0],
|
65
|
-
[1.5, 0.5, 4.0]],
|
66
|
-
[
|
67
|
-
[-1.5, 1.5, -2.0],
|
68
|
-
[-0.5, 1.5, -2.0],
|
69
|
-
[0.5, 1.5, 0.0],
|
70
|
-
[1.5, 1.5, -1.0]]
|
71
|
-
];
|
72
|
-
|
73
|
-
def initlights
|
74
|
-
ambient = [0.2, 0.2, 0.2, 1.0];
|
75
|
-
position = [0.0, 0.0, 2.0, 1.0];
|
76
|
-
mat_diffuse = [0.6, 0.6, 0.6, 1.0];
|
77
|
-
mat_specular = [1.0, 1.0, 1.0, 1.0];
|
78
|
-
mat_shininess = [50.0];
|
79
|
-
|
80
|
-
GL::Enable(GL::LIGHTING);
|
81
|
-
GL::Enable(GL::LIGHT0);
|
82
|
-
|
83
|
-
GL::Light(GL::LIGHT0, GL::AMBIENT, ambient);
|
84
|
-
GL::Light(GL::LIGHT0, GL::POSITION, position);
|
85
|
-
|
86
|
-
GL::Material(GL::FRONT, GL::DIFFUSE, mat_diffuse);
|
87
|
-
GL::Material(GL::FRONT, GL::SPECULAR, mat_specular);
|
88
|
-
GL::Material(GL::FRONT, GL::SHININESS, mat_shininess);
|
89
|
-
end
|
90
|
-
|
91
|
-
display = proc {
|
92
|
-
GL::Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
|
93
|
-
GL::PushMatrix();
|
94
|
-
GL::Rotate(85.0, 1.0, 1.0, 1.0);
|
95
|
-
GL::EvalMesh2(GL::FILL, 0, 20, 0, 20);
|
96
|
-
GL::PopMatrix();
|
97
|
-
GL::Flush();
|
98
|
-
}
|
99
|
-
|
100
|
-
def myinit
|
101
|
-
GL::ClearColor(0.0, 0.0, 0.0, 1.0);
|
102
|
-
GL::Enable(GL::DEPTH_TEST);
|
103
|
-
GL::Map2d(GL::MAP2_VERTEX_3, 0, 1, 3, 4,
|
104
|
-
0, 1, 12, 4, $ctrlpoints.flatten);
|
105
|
-
GL::Enable(GL::MAP2_VERTEX_3);
|
106
|
-
GL::Enable(GL::AUTO_NORMAL);
|
107
|
-
GL::Enable(GL::NORMALIZE);
|
108
|
-
GL::MapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0);
|
109
|
-
initlights(); # /* for lighted version only */
|
110
|
-
end
|
111
|
-
|
112
|
-
myReshape = proc {|w, h|
|
113
|
-
GL::Viewport(0, 0, w, h);
|
114
|
-
GL::MatrixMode(GL::PROJECTION);
|
115
|
-
GL::LoadIdentity();
|
116
|
-
if (w <= h)
|
117
|
-
GL::Ortho(-4.0, 4.0, -4.0 * h / w, 4.0 * h / w, -4.0, 4.0);
|
118
|
-
else
|
119
|
-
GL::Ortho(-4.0 * w / h, 4.0 * w / h, -4.0, 4.0, -4.0, 4.0);
|
120
|
-
end
|
121
|
-
GL::MatrixMode(GL::MODELVIEW);
|
122
|
-
GL::LoadIdentity();
|
123
|
-
}
|
124
|
-
|
125
|
-
GLUT::Init();
|
126
|
-
GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::DEPTH);
|
127
|
-
GLUT::CreateWindow($0);
|
128
|
-
myinit();
|
129
|
-
GLUT::ReshapeFunc(myReshape);
|
130
|
-
GLUT::DisplayFunc(display);
|
131
|
-
GLUT::MainLoop();
|
data/examples/legacy/checker.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#/* Copyright (c) Mark J. Kilgard, 1994. */
|
3
|
-
#
|
4
|
-
#/*
|
5
|
-
# * (c) Copyright 1993, Silicon Graphics, Inc.
|
6
|
-
# * ALL RIGHTS RESERVED
|
7
|
-
# * Permission to use, copy, modify, and distribute this software for
|
8
|
-
# * any purpose and without fee is hereby granted, provided that the above
|
9
|
-
# * copyright notice appear in all copies and that both the copyright notice
|
10
|
-
# * and this permission notice appear in supporting documentation, and that
|
11
|
-
# * the name of Silicon Graphics, Inc. not be used in advertising
|
12
|
-
# * or publicity pertaining to distribution of the software without specific,
|
13
|
-
# * written prior permission.
|
14
|
-
# *
|
15
|
-
# * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
16
|
-
# * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
17
|
-
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
18
|
-
# * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
19
|
-
# * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
20
|
-
# * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
21
|
-
# * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
22
|
-
# * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
23
|
-
# * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
24
|
-
# * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
25
|
-
# * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
26
|
-
# * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
27
|
-
# *
|
28
|
-
# * US Government Users Restricted Rights
|
29
|
-
# * Use, duplication, or disclosure by the Government is subject to
|
30
|
-
# * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
31
|
-
# * (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
32
|
-
# * clause at DFARS 252.227-7013 and/or in similar or successor
|
33
|
-
# * clauses in the FAR or the DOD or NASA FAR Supplement.
|
34
|
-
# * Unpublished-- rights reserved under the copyright laws of the
|
35
|
-
# * United States. Contractor/manufacturer is Silicon Graphics,
|
36
|
-
# * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
37
|
-
# *
|
38
|
-
# * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
39
|
-
# */
|
40
|
-
#/* checker.c
|
41
|
-
# * This program texture maps a checkerboard image onto
|
42
|
-
# * two rectangles. This program clamps the texture, if
|
43
|
-
# * the texture coordinates fall outside 0.0 and 1.0.
|
44
|
-
# */
|
45
|
-
|
46
|
-
require "gl_prev"
|
47
|
-
require "glu_prev"
|
48
|
-
require "glut_prev"
|
49
|
-
require "mathn"
|
50
|
-
|
51
|
-
#/* Create checkerboard texture */
|
52
|
-
CheckImageWidth=64
|
53
|
-
CheckImageHeight=64
|
54
|
-
$checkImage = []
|
55
|
-
|
56
|
-
def makeCheckImage
|
57
|
-
for i in 0..CheckImageWidth-1
|
58
|
-
for j in 0..CheckImageHeight-1
|
59
|
-
c = if ((i&0x8==0) != (j&0x8==0)) then 255; else 0; end;
|
60
|
-
$checkImage[(i+CheckImageWidth*j)*3+0] = c;
|
61
|
-
$checkImage[(i+CheckImageWidth*j)*3+1] = c;
|
62
|
-
$checkImage[(i+CheckImageWidth*j)*3+2] = c;
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def myinit
|
68
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
69
|
-
GL.Enable(GL::DEPTH_TEST);
|
70
|
-
GL.DepthFunc(GL::LESS);
|
71
|
-
|
72
|
-
makeCheckImage();
|
73
|
-
GL.PixelStore(GL::UNPACK_ALIGNMENT, 1);
|
74
|
-
GL.TexImage2D(GL::TEXTURE_2D, 0, 3, CheckImageWidth,
|
75
|
-
CheckImageHeight, 0, GL::RGB, GL::UNSIGNED_BYTE,
|
76
|
-
$checkImage.pack("C*"));
|
77
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, GL::CLAMP);
|
78
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, GL::CLAMP);
|
79
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::LINEAR);
|
80
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::LINEAR);
|
81
|
-
GL.TexEnv(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, GL::DECAL);
|
82
|
-
GL.Enable(GL::TEXTURE_2D);
|
83
|
-
GL.ShadeModel(GL::FLAT);
|
84
|
-
end
|
85
|
-
|
86
|
-
display = Proc.new {
|
87
|
-
GL.Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
|
88
|
-
GL.Begin(GL::QUADS);
|
89
|
-
GL.TexCoord(0.0, 0.0); GL.Vertex(-2.0, -1.0, 0.0);
|
90
|
-
GL.TexCoord(0.0, 1.0); GL.Vertex(-2.0, 1.0, 0.0);
|
91
|
-
GL.TexCoord(1.0, 1.0); GL.Vertex(0.0, 1.0, 0.0);
|
92
|
-
GL.TexCoord(1.0, 0.0); GL.Vertex(0.0, -1.0, 0.0);
|
93
|
-
|
94
|
-
GL.TexCoord(0.0, 0.0); GL.Vertex(1.0, -1.0, 0.0);
|
95
|
-
GL.TexCoord(0.0, 1.0); GL.Vertex(1.0, 1.0, 0.0);
|
96
|
-
GL.TexCoord(1.0, 1.0); GL.Vertex(2.41421, 1.0, -1.41421);
|
97
|
-
GL.TexCoord(1.0, 0.0); GL.Vertex(2.41421, -1.0, -1.41421);
|
98
|
-
GL.End();
|
99
|
-
GLUT.SwapBuffers();
|
100
|
-
}
|
101
|
-
|
102
|
-
myReshape = Proc.new {|w, h|
|
103
|
-
GL.Viewport(0, 0, w, h);
|
104
|
-
GL.MatrixMode(GL::PROJECTION);
|
105
|
-
GL.LoadIdentity();
|
106
|
-
GLU.Perspective(60.0, 1.0*w/h, 1.0, 30.0);
|
107
|
-
GL.MatrixMode(GL::MODELVIEW);
|
108
|
-
GL.LoadIdentity();
|
109
|
-
GL.Translate(0.0, 0.0, -3.6);
|
110
|
-
}
|
111
|
-
|
112
|
-
#int
|
113
|
-
#main(int argc, char** argv)
|
114
|
-
#{
|
115
|
-
GLUT.Init
|
116
|
-
GLUT.InitDisplayMode(GLUT::DOUBLE | GLUT::RGB | GLUT::DEPTH);
|
117
|
-
GLUT.CreateWindow("checker");
|
118
|
-
myinit();
|
119
|
-
GLUT.ReshapeFunc (myReshape);
|
120
|
-
GLUT.DisplayFunc(display);
|
121
|
-
GLUT.MainLoop();
|
data/examples/legacy/clip.rb
DELETED
@@ -1,104 +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
|
-
# * clip.c
|
40
|
-
# * This program demonstrates arbitrary clipping planes.
|
41
|
-
# */
|
42
|
-
|
43
|
-
require "gl_prev"
|
44
|
-
require "glu_prev"
|
45
|
-
require "glut_prev"
|
46
|
-
require "mathn"
|
47
|
-
|
48
|
-
def init
|
49
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
50
|
-
GL.ShadeModel(GL::FLAT);
|
51
|
-
end
|
52
|
-
|
53
|
-
display = Proc.new {
|
54
|
-
eqn = [0.0, 1.0, 0.0, 0.0];
|
55
|
-
eqn2 = [1.0, 0.0, 0.0, 0.0];
|
56
|
-
|
57
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
58
|
-
|
59
|
-
GL.Color(1.0, 1.0, 1.0);
|
60
|
-
GL.PushMatrix();
|
61
|
-
GL.Translate(0.0, 0.0, -5.0);
|
62
|
-
|
63
|
-
# /* clip lower half -- y < 0 */
|
64
|
-
GL.ClipPlane(GL::CLIP_PLANE0, eqn);
|
65
|
-
GL.Enable(GL::CLIP_PLANE0);
|
66
|
-
# /* clip left half -- x < 0 */
|
67
|
-
GL.ClipPlane(GL::CLIP_PLANE1, eqn2);
|
68
|
-
GL.Enable(GL::CLIP_PLANE1);
|
69
|
-
|
70
|
-
GL.Rotate(90.0, 1.0, 0.0, 0.0);
|
71
|
-
GLUT.WireSphere(1.0, 20, 16);
|
72
|
-
GL.PopMatrix();
|
73
|
-
|
74
|
-
GL.Flush();
|
75
|
-
}
|
76
|
-
|
77
|
-
reshape = Proc.new {|w, h|
|
78
|
-
GL.Viewport(0, 0, w, h);
|
79
|
-
GL.MatrixMode(GL::PROJECTION);
|
80
|
-
GL.LoadIdentity();
|
81
|
-
GLU.Perspective(60.0, w/ h, 1.0, 20.0);
|
82
|
-
GL.MatrixMode(GL::MODELVIEW);
|
83
|
-
}
|
84
|
-
|
85
|
-
# /* ARGSUSED1 */
|
86
|
-
keyboard = Proc.new {|key, x, y|
|
87
|
-
case (key)
|
88
|
-
when 27
|
89
|
-
exit(0);
|
90
|
-
end
|
91
|
-
}
|
92
|
-
|
93
|
-
#int main(int argc, char** argv)
|
94
|
-
#{
|
95
|
-
GLUT.Init
|
96
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
97
|
-
GLUT.InitWindowSize(500, 500);
|
98
|
-
GLUT.InitWindowPosition(100, 100);
|
99
|
-
GLUT.CreateWindow($0);
|
100
|
-
init();
|
101
|
-
GLUT.DisplayFunc(display);
|
102
|
-
GLUT.ReshapeFunc(reshape);
|
103
|
-
GLUT.KeyboardFunc(keyboard);
|
104
|
-
GLUT.MainLoop();
|