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/feedback.rb
DELETED
@@ -1,152 +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
|
-
# * feedback.c
|
40
|
-
# * This program demonstrates use of OpenGL feedback. First,
|
41
|
-
# * a lighting environment is set up and a few lines are drawn.
|
42
|
-
# * Then feedback mode is entered, and the same lines are
|
43
|
-
# * drawn. The results in the feedback buffer are printed.
|
44
|
-
# */
|
45
|
-
require "gl_prev"
|
46
|
-
require "glu_prev"
|
47
|
-
require "glut_prev"
|
48
|
-
|
49
|
-
|
50
|
-
#/* Initialize lighting.
|
51
|
-
# */
|
52
|
-
def init
|
53
|
-
GL::Enable(GL::LIGHTING);
|
54
|
-
GL::Enable(GL::LIGHT0);
|
55
|
-
end
|
56
|
-
|
57
|
-
#/* Draw a few lines and two points, one of which will
|
58
|
-
# * be clipped. If in feedback mode, a passthrough token
|
59
|
-
# * is issued between the each primitive.
|
60
|
-
# */
|
61
|
-
def drawGeometry(mode)
|
62
|
-
GL::Begin(GL::LINE_STRIP);
|
63
|
-
GL::Normal(0.0, 0.0, 1.0);
|
64
|
-
GL::Vertex(30.0, 30.0, 0.0);
|
65
|
-
GL::Vertex(50.0, 60.0, 0.0);
|
66
|
-
GL::Vertex(70.0, 40.0, 0.0);
|
67
|
-
GL::End();
|
68
|
-
if (mode == GL::FEEDBACK)
|
69
|
-
GL::PassThrough(1.0);
|
70
|
-
end
|
71
|
-
GL::Begin(GL::POINTS);
|
72
|
-
GL::Vertex(-100.0, -100.0, -100.0); # /* will be clipped */
|
73
|
-
GL::End();
|
74
|
-
if (mode == GL::FEEDBACK)
|
75
|
-
GL::PassThrough(2.0);
|
76
|
-
end
|
77
|
-
GL::Begin(GL::POINTS);
|
78
|
-
GL::Normal(0.0, 0.0, 1.0);
|
79
|
-
GL::Vertex(50.0, 50.0, 0.0);
|
80
|
-
GL::End();
|
81
|
-
end
|
82
|
-
|
83
|
-
# /* Write contents of one vertex to stdout. */
|
84
|
-
def print3DcolorVertex(size, count, buffer)
|
85
|
-
printf(" ");
|
86
|
-
for i in 0...7
|
87
|
-
printf("%4.2f ", buffer[size-count]);
|
88
|
-
count = count - 1;
|
89
|
-
end
|
90
|
-
printf("\n");
|
91
|
-
return count
|
92
|
-
end
|
93
|
-
|
94
|
-
#/* Write contents of entire buffer. (Parse tokens!) */
|
95
|
-
def printBuffer(size, buffer)
|
96
|
-
|
97
|
-
count = size;
|
98
|
-
while (count!=0)
|
99
|
-
token = buffer[size-count]; count-=1;
|
100
|
-
if (token == GL::PASS_THROUGH_TOKEN)
|
101
|
-
printf("GL::PASS_THROUGH_TOKEN\n");
|
102
|
-
printf(" %4.2f\n", buffer[size-count]);
|
103
|
-
count-=1;
|
104
|
-
elsif (token == GL::POINT_TOKEN)
|
105
|
-
printf("GL::POINT_TOKEN\n");
|
106
|
-
count = print3DcolorVertex(size, count, buffer);
|
107
|
-
elsif (token == GL::LINE_TOKEN)
|
108
|
-
printf("GL::LINE_TOKEN\n");
|
109
|
-
count = print3DcolorVertex(size, count, buffer);
|
110
|
-
count = print3DcolorVertex(size, count, buffer);
|
111
|
-
elsif (token == GL::LINE_RESET_TOKEN)
|
112
|
-
printf("GL::LINE_RESET_TOKEN\n");
|
113
|
-
count = print3DcolorVertex(size, count, buffer);
|
114
|
-
count = print3DcolorVertex(size, count, buffer);
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
display = proc {
|
120
|
-
GL::MatrixMode(GL::PROJECTION);
|
121
|
-
GL::LoadIdentity();
|
122
|
-
GL::Ortho(0.0, 100.0, 0.0, 100.0, 0.0, 1.0);
|
123
|
-
|
124
|
-
GL::ClearColor(0.0, 0.0, 0.0, 0.0);
|
125
|
-
GL::Clear(GL::COLOR_BUFFER_BIT);
|
126
|
-
drawGeometry(GL::RENDER);
|
127
|
-
|
128
|
-
feedBuffer = GL::FeedbackBuffer(1024, GL::GL_3D_COLOR);
|
129
|
-
GL::RenderMode(GL::FEEDBACK);
|
130
|
-
drawGeometry(GL::FEEDBACK);
|
131
|
-
|
132
|
-
size = GL::RenderMode(GL::RENDER);
|
133
|
-
printBuffer(size, feedBuffer.unpack("f#{size}"));
|
134
|
-
}
|
135
|
-
|
136
|
-
#/* ARGSUSED1 */
|
137
|
-
keyboard = proc {|key, x, y|
|
138
|
-
case (key)
|
139
|
-
when 27
|
140
|
-
exit(0);
|
141
|
-
end
|
142
|
-
}
|
143
|
-
|
144
|
-
GLUT::Init()
|
145
|
-
GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
146
|
-
GLUT::InitWindowSize(100, 100);
|
147
|
-
GLUT::InitWindowPosition(100, 100);
|
148
|
-
GLUT::CreateWindow()
|
149
|
-
init();
|
150
|
-
GLUT::DisplayFunc(display);
|
151
|
-
GLUT::KeyboardFunc(keyboard);
|
152
|
-
GLUT::MainLoop();
|
data/examples/legacy/fog.rb
DELETED
@@ -1,172 +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
|
-
#/*
|
41
|
-
# * fog.c
|
42
|
-
# * This program draws 5 red teapots, each at a different
|
43
|
-
# * z distance from the eye, in different types of fog.
|
44
|
-
# * Pressing the left mouse button chooses between 3 types of
|
45
|
-
# * fog: exponential, exponential squared, and linear.
|
46
|
-
# * In this program, there is a fixed density value, as well
|
47
|
-
# * as fixed start and end values for the linear fog.
|
48
|
-
# */
|
49
|
-
|
50
|
-
require "gl_prev"
|
51
|
-
require "glu_prev"
|
52
|
-
require "glut_prev"
|
53
|
-
require "mathn"
|
54
|
-
|
55
|
-
$fogMode = 0;
|
56
|
-
|
57
|
-
selectFog = Proc.new {|mode|
|
58
|
-
if (mode == GL::LINEAR)
|
59
|
-
GL.Fog(GL::FOG_START, 1.0);
|
60
|
-
GL.Fog(GL::FOG_END, 5.0);
|
61
|
-
#/* falls through */
|
62
|
-
GL.Fog(GL::FOG_MODE, mode);
|
63
|
-
GLUT.PostRedisplay();
|
64
|
-
end
|
65
|
-
if (mode == GL::EXP2 || mode == GL::EXP)
|
66
|
-
GL.Fog(GL::FOG_MODE, mode);
|
67
|
-
GLUT.PostRedisplay();
|
68
|
-
end
|
69
|
-
exit(0) if (mode == 0)
|
70
|
-
}
|
71
|
-
|
72
|
-
#/* Initialize z-buffer, projection matrix, light source,
|
73
|
-
# * and lighting model. Do not specify a material property here.
|
74
|
-
# */
|
75
|
-
def myinit
|
76
|
-
position = [0.0, 3.0, 3.0, 0.0];
|
77
|
-
local_view = [0.0];
|
78
|
-
|
79
|
-
GL.Enable(GL::DEPTH_TEST);
|
80
|
-
GL.DepthFunc(GL::LESS);
|
81
|
-
|
82
|
-
GL.Light(GL::LIGHT0, GL::POSITION, position);
|
83
|
-
GL.LightModel(GL::LIGHT_MODEL_LOCAL_VIEWER, local_view);
|
84
|
-
|
85
|
-
GL.FrontFace(GL::CW);
|
86
|
-
GL.Enable(GL::LIGHTING);
|
87
|
-
GL.Enable(GL::LIGHT0);
|
88
|
-
GL.Enable(GL::AUTO_NORMAL);
|
89
|
-
GL.Enable(GL::NORMALIZE);
|
90
|
-
GL.Enable(GL::FOG);
|
91
|
-
fogColor = [0.5, 0.5, 0.5, 1.0];
|
92
|
-
|
93
|
-
fogMode = GL::EXP;
|
94
|
-
GL.Fog(GL::FOG_MODE, fogMode);
|
95
|
-
GL.Fog(GL::FOG_COLOR, fogColor);
|
96
|
-
GL.Fog(GL::FOG_DENSITY, 0.35);
|
97
|
-
GL.Hint(GL::FOG_HINT, GL::DONT_CARE);
|
98
|
-
GL.ClearColor(0.5, 0.5, 0.5, 1.0);
|
99
|
-
end
|
100
|
-
|
101
|
-
def renderRedTeapot(x, y, z)
|
102
|
-
mat = []
|
103
|
-
GL.PushMatrix();
|
104
|
-
GL.Translate(x, y, z);
|
105
|
-
mat[0] = 0.1745;
|
106
|
-
mat[1] = 0.01175;
|
107
|
-
mat[2] = 0.01175;
|
108
|
-
mat[3] = 1.0;
|
109
|
-
GL.Material(GL::FRONT, GL::AMBIENT, mat);
|
110
|
-
mat[0] = 0.61424;
|
111
|
-
mat[1] = 0.04136;
|
112
|
-
mat[2] = 0.04136;
|
113
|
-
GL.Material(GL::FRONT, GL::DIFFUSE, mat);
|
114
|
-
mat[0] = 0.727811;
|
115
|
-
mat[1] = 0.626959;
|
116
|
-
mat[2] = 0.626959;
|
117
|
-
GL.Material(GL::FRONT, GL::SPECULAR, mat);
|
118
|
-
GL.Material(GL::FRONT, GL::SHININESS, 0.6 * 128.0);
|
119
|
-
GLUT.SolidTeapot(1.0);
|
120
|
-
GL.PopMatrix();
|
121
|
-
end
|
122
|
-
|
123
|
-
#/* display() draws 5 teapots at different z positions.
|
124
|
-
# */
|
125
|
-
display = Proc.new {
|
126
|
-
GL.Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
|
127
|
-
renderRedTeapot(-4.0, -0.5, -1.0);
|
128
|
-
renderRedTeapot(-2.0, -0.5, -2.0);
|
129
|
-
renderRedTeapot(0.0, -0.5, -3.0);
|
130
|
-
renderRedTeapot(2.0, -0.5, -4.0);
|
131
|
-
renderRedTeapot(4.0, -0.5, -5.0);
|
132
|
-
GL.Flush();
|
133
|
-
}
|
134
|
-
|
135
|
-
myReshape = Proc.new {|w, h|
|
136
|
-
GL.Viewport(0, 0, w, h);
|
137
|
-
GL.MatrixMode(GL::PROJECTION);
|
138
|
-
GL.LoadIdentity();
|
139
|
-
if (w <= (h * 3))
|
140
|
-
GL.Ortho(-6.0, 6.0, -2.0 * h * 3 / w,
|
141
|
-
2.0 * h * 3 / w, 0.0, 10.0);
|
142
|
-
elsif
|
143
|
-
GL.Ortho(-6.0 * w / h * 3,
|
144
|
-
6.0 * w / h * 3, -2.0, 2.0, 0.0, 10.0);
|
145
|
-
end
|
146
|
-
GL.MatrixMode(GL::MODELVIEW);
|
147
|
-
GL.LoadIdentity();
|
148
|
-
}
|
149
|
-
|
150
|
-
#/* Main Loop
|
151
|
-
# * Open window with initial window size, title bar,
|
152
|
-
# * RGBA display mode, depth buffer, and handle input events.
|
153
|
-
# */
|
154
|
-
#int
|
155
|
-
#main(int argc, char **argv)
|
156
|
-
#{
|
157
|
-
GLUT.Init
|
158
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::DEPTH);
|
159
|
-
GLUT.InitWindowSize(450, 150);
|
160
|
-
GLUT.CreateWindow($0);
|
161
|
-
myinit();
|
162
|
-
GLUT.ReshapeFunc(myReshape);
|
163
|
-
GLUT.DisplayFunc(display);
|
164
|
-
GLUT.CreateMenu(selectFog);
|
165
|
-
GLUT.AddMenuEntry("Fog EXP", GL::EXP);
|
166
|
-
GLUT.AddMenuEntry("Fog EXP2", GL::EXP2);
|
167
|
-
GLUT.AddMenuEntry("Fog LINEAR", GL::LINEAR);
|
168
|
-
GLUT.AddMenuEntry("Quit", 0);
|
169
|
-
GLUT.AttachMenu(GLUT::RIGHT_BUTTON);
|
170
|
-
GLUT.MainLoop();
|
171
|
-
# return 0; /* ANSI C requires main to return int. */
|
172
|
-
#}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require "gl_prev"
|
2
|
-
require "glu_prev"
|
3
|
-
require "glut_prev"
|
4
|
-
|
5
|
-
|
6
|
-
display = Proc.new {
|
7
|
-
GL::Clear(GL::COLOR_BUFFER_BIT);
|
8
|
-
GL.LoadIdentity
|
9
|
-
|
10
|
-
GL::RasterPos2d(20,20)
|
11
|
-
"Hello Bitmap".each_byte { |x| GLUT.BitmapCharacter(GLUT::BITMAP_9_BY_15, x) }
|
12
|
-
|
13
|
-
GL.Translate(0, 50, 0)
|
14
|
-
GL.Scale(0.25, 0.25, 1)
|
15
|
-
"Hello Stroke".each_byte { |x| GLUT.StrokeCharacter(GLUT::STROKE_ROMAN, x) }
|
16
|
-
|
17
|
-
GL.Flush();
|
18
|
-
}
|
19
|
-
|
20
|
-
reshape = Proc.new {|w, h|
|
21
|
-
GL::Viewport(0, 0, w, h);
|
22
|
-
GL::MatrixMode(GL::PROJECTION);
|
23
|
-
GL::LoadIdentity();
|
24
|
-
GL::Ortho(0.0, w, 0.0, h, -1.0, 1.0);
|
25
|
-
GL::MatrixMode(GL::MODELVIEW);
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
# Main Loop
|
30
|
-
# Open window with initial window size, title bar,
|
31
|
-
# color index display mode, and handle input events.
|
32
|
-
#
|
33
|
-
GLUT.Init
|
34
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
35
|
-
GLUT.InitWindowSize(200, 200);
|
36
|
-
GLUT.CreateWindow($0);
|
37
|
-
|
38
|
-
GLUT.ReshapeFunc(reshape);
|
39
|
-
GLUT.DisplayFunc(display);
|
40
|
-
GLUT.MainLoop
|
41
|
-
|
data/examples/legacy/font.rb
DELETED
@@ -1,158 +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
|
-
# * font.c
|
40
|
-
# *
|
41
|
-
# * Draws some text in a bitmapped font. Uses glBitmap()
|
42
|
-
# * and other pixel routines. Also demonstrates use of
|
43
|
-
# * display lists.
|
44
|
-
# */
|
45
|
-
require "gl_prev"
|
46
|
-
require "glu_prev"
|
47
|
-
require "glut_prev"
|
48
|
-
|
49
|
-
|
50
|
-
$space = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,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x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3],
|
78
|
-
[0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff]
|
79
|
-
];
|
80
|
-
|
81
|
-
$fontOffset = 0;
|
82
|
-
|
83
|
-
def makeRasterFont
|
84
|
-
GL::PixelStorei(GL::UNPACK_ALIGNMENT, 1);
|
85
|
-
|
86
|
-
$fontOffset = GL::GenLists(128);
|
87
|
-
i = 0; j = ?A;
|
88
|
-
for i in 0...26
|
89
|
-
GL::NewList($fontOffset + j, GL::COMPILE);
|
90
|
-
GL::Bitmap(8, 13, 0.0, 2.0, 10.0, 0.0, $letters[i].pack("C*"));
|
91
|
-
GL::EndList();
|
92
|
-
j+=1
|
93
|
-
end
|
94
|
-
GL::NewList($fontOffset + ' '[0], GL::COMPILE);
|
95
|
-
GL::Bitmap(8, 13, 0.0, 2.0, 10.0, 0.0, $space.pack("C*"));
|
96
|
-
GL::EndList();
|
97
|
-
end
|
98
|
-
|
99
|
-
def init
|
100
|
-
GL::ShadeModel(GL::FLAT);
|
101
|
-
makeRasterFont();
|
102
|
-
end
|
103
|
-
|
104
|
-
def printString(s)
|
105
|
-
GL::PushAttrib(GL::LIST_BIT);
|
106
|
-
GL::ListBase($fontOffset);
|
107
|
-
GL::CallLists(s);
|
108
|
-
GL::PopAttrib();
|
109
|
-
end
|
110
|
-
|
111
|
-
#/* Everything above this line could be in a library
|
112
|
-
# * that defines a font. To make it work, you've got
|
113
|
-
# * to call makeRasterFont() before you start making
|
114
|
-
# * calls to printString().
|
115
|
-
# */
|
116
|
-
display = proc {
|
117
|
-
white = [ 1.0, 1.0, 1.0 ];
|
118
|
-
|
119
|
-
GL::Clear(GL::COLOR_BUFFER_BIT);
|
120
|
-
GL::Color(white);
|
121
|
-
|
122
|
-
GL::RasterPos(20, 60);
|
123
|
-
printString("THE QUICK BROWN FOX JUMPS");
|
124
|
-
GL::RasterPos(20, 40);
|
125
|
-
printString("OVER A LAZY DOG");
|
126
|
-
GL::Flush();
|
127
|
-
}
|
128
|
-
|
129
|
-
reshape = proc {|w, h|
|
130
|
-
GL::Viewport(0, 0, w, h);
|
131
|
-
GL::MatrixMode(GL::PROJECTION);
|
132
|
-
GL::LoadIdentity();
|
133
|
-
GL::Ortho(0.0, w, 0.0, h, -1.0, 1.0);
|
134
|
-
GL::MatrixMode(GL::MODELVIEW);
|
135
|
-
}
|
136
|
-
|
137
|
-
# /* ARGSUSED1 */
|
138
|
-
keyboard = proc {|key, x, y|
|
139
|
-
case (key)
|
140
|
-
when 27
|
141
|
-
exit(0);
|
142
|
-
end
|
143
|
-
}
|
144
|
-
|
145
|
-
#/* Main Loop
|
146
|
-
# * Open window with initial window size, title bar,
|
147
|
-
# * RGBA display mode, and handle input events.
|
148
|
-
# */
|
149
|
-
GLUT::Init();
|
150
|
-
GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
151
|
-
GLUT::InitWindowSize(300, 100);
|
152
|
-
GLUT::InitWindowPosition(100, 100);
|
153
|
-
GLUT::CreateWindow();
|
154
|
-
init();
|
155
|
-
GLUT::ReshapeFunc(reshape);
|
156
|
-
GLUT::KeyboardFunc(keyboard);
|
157
|
-
GLUT::DisplayFunc(display);
|
158
|
-
GLUT::MainLoop();
|