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/doc/screenshots.txt
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
ruby-opengl screenshots
|
2
|
-
=======================
|
3
|
-
|
4
|
-
Currently the screenshots are a little barren but here are some
|
5
|
-
renders from the interactive test suite in ruby-opengl
|
6
|
-
|
7
|
-
interactive test screenshots
|
8
|
-
============================
|
9
|
-
|
10
|
-
<img src="images/GLtest_1_vertex_color.png" />
|
11
|
-
<br />
|
12
|
-
<img src="images/GLtest_2_rasterpos_bitmap.png" />
|
13
|
-
<br />
|
14
|
-
<img src="images/GLtest_3_displaylists_matrixops.png" />
|
15
|
-
<br />
|
16
|
-
<img src="images/GLtest_4_textureops.png" />
|
17
|
-
<br />
|
18
|
-
<img src="images/GLtest_5_polygonops.png" />
|
19
|
-
<br />
|
20
|
-
<img src="images/GLtest_6_textureops_2.png" />
|
21
|
-
<br />
|
22
|
-
<img src="images/GLtest_7_light_material.png" />
|
23
|
-
<br />
|
data/examples/legacy/COPYRIGHT
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
Copyright (c) 2004 yoshi@giganet.net
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
-
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
8
|
-
|
data/examples/legacy/aaindex.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -rubygems
|
2
|
-
#require "gl"
|
3
|
-
#require "glut"
|
4
|
-
require "rational"
|
5
|
-
|
6
|
-
require "gl_prev"
|
7
|
-
require "glut_prev"
|
8
|
-
|
9
|
-
RAMPSIZE=16
|
10
|
-
RAMP1START=32
|
11
|
-
RAMP2START=48
|
12
|
-
|
13
|
-
STDOUT.sync = TRUE
|
14
|
-
$rotAngle = 0
|
15
|
-
|
16
|
-
# Initialize antialiasing for color index mode,
|
17
|
-
# including loading a green color ramp starting
|
18
|
-
# at RAMP1START, and a blue color ramp starting
|
19
|
-
# at RAMP2START. The ramps must be a multiple of 16.
|
20
|
-
def myinit
|
21
|
-
for i in (0..RAMPSIZE)
|
22
|
-
shade = i.to_f/RAMPSIZE.to_f;
|
23
|
-
GLUT.SetColor(RAMP1START+i, 0, shade, 0.0);
|
24
|
-
GLUT.SetColor(RAMP2START+i, 0, 0, shade);
|
25
|
-
end
|
26
|
-
|
27
|
-
GL.Enable(GL::LINE_SMOOTH);
|
28
|
-
GL.Hint(GL::LINE_SMOOTH_HINT, GL::DONT_CARE);
|
29
|
-
GL.LineWidth(1.5);
|
30
|
-
|
31
|
-
GL.ClearIndex(RAMP1START);
|
32
|
-
end
|
33
|
-
|
34
|
-
display = Proc.new {
|
35
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
36
|
-
|
37
|
-
GL.Indexi(RAMP1START);
|
38
|
-
GL.PushMatrix();
|
39
|
-
GL.Rotate(-$rotAngle, 0.0, 0.0, 0.1);
|
40
|
-
GL.Begin(GL::LINES);
|
41
|
-
GL.Vertex(-0.5, 0.5);
|
42
|
-
GL.Vertex(0.5, -0.5);
|
43
|
-
GL.End
|
44
|
-
GL.PopMatrix();
|
45
|
-
|
46
|
-
# GL.Indexi(RAMP2START);
|
47
|
-
GL.PushMatrix();
|
48
|
-
GL.Rotate($rotAngle, 0.0, 0.0, 0.1);
|
49
|
-
GL.Begin(GL::LINES);
|
50
|
-
GL.Vertex(0.5, 0.5);
|
51
|
-
GL.Vertex(-0.5, -0.5);
|
52
|
-
GL.End
|
53
|
-
GL.PopMatrix();
|
54
|
-
|
55
|
-
GL.Flush();
|
56
|
-
}
|
57
|
-
|
58
|
-
reshape = Proc.new {|w, h|
|
59
|
-
GL.Viewport(0, 0, w, h);
|
60
|
-
GL.MatrixMode(GL::PROJECTION);
|
61
|
-
GL.LoadIdentity();
|
62
|
-
if (w <= h)
|
63
|
-
GLU.Ortho2D(-1.0, 1.0, -h.to_f/w.to_f, h.to_f/w.to_f);
|
64
|
-
else
|
65
|
-
GLU.Ortho2D(w.to_f/h.to_f, w.to_f/h.to_f, -1.0, 1.0);
|
66
|
-
end
|
67
|
-
GL.MatrixMode(GL::MODELVIEW);
|
68
|
-
GL.LoadIdentity();
|
69
|
-
}
|
70
|
-
|
71
|
-
keyboard = Proc.new {|key, x, y|
|
72
|
-
case (key)
|
73
|
-
when 'r'[0]
|
74
|
-
$rotAngle += 20
|
75
|
-
$rotAngle = 0 if ($rotAngle >= 360)
|
76
|
-
GLUT.PostRedisplay();
|
77
|
-
when 'R'[0]
|
78
|
-
$rotAngle -= 20
|
79
|
-
$rotAngle = 360 if ($rotAngle <= 0)
|
80
|
-
GLUT.PostRedisplay();
|
81
|
-
when 27
|
82
|
-
exit(0);
|
83
|
-
end
|
84
|
-
}
|
85
|
-
|
86
|
-
# Main Loop
|
87
|
-
# Open window with initial window size, title bar,
|
88
|
-
# color index display mode, and handle input events.
|
89
|
-
#
|
90
|
-
GLUT.Init
|
91
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::INDEX);
|
92
|
-
GLUT.InitWindowSize(200, 200);
|
93
|
-
GLUT.CreateWindow($0);
|
94
|
-
myinit
|
95
|
-
GLUT.ReshapeFunc(reshape);
|
96
|
-
GLUT.KeyboardFunc(keyboard);
|
97
|
-
GLUT.DisplayFunc(display);
|
98
|
-
GLUT.MainLoop
|
data/examples/legacy/aapoly.rb
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -rubygems
|
2
|
-
#/*
|
3
|
-
# * Copyright (c) 1993-1997, Silicon Graphics, Inc.
|
4
|
-
# * ALL RIGHTS RESERVED
|
5
|
-
# * Permission to use, copy, modify, and distribute this software for
|
6
|
-
# * any purpose and without fee is hereby granted, provided that the above
|
7
|
-
# * copyright notice appear in all copies and that both the copyright notice
|
8
|
-
# * and this permission notice appear in supporting documentation, and that
|
9
|
-
# * the name of Silicon Graphics, Inc. not be used in advertising
|
10
|
-
# * or publicity pertaining to distribution of the software without specific,
|
11
|
-
# * written prior permission.
|
12
|
-
# *
|
13
|
-
# * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
14
|
-
# * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
15
|
-
# * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
16
|
-
# * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
17
|
-
# * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
18
|
-
# * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
19
|
-
# * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
20
|
-
# * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
21
|
-
# * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
22
|
-
# * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
23
|
-
# * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
24
|
-
# * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
25
|
-
# *
|
26
|
-
# * US Government Users Restricted Rights
|
27
|
-
# * Use, duplication, or disclosure by the Government is subject to
|
28
|
-
# * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
29
|
-
# * (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
30
|
-
# * clause at DFARS 252.227-7013 and/or in similar or successor
|
31
|
-
# * clauses in the FAR or the DOD or NASA FAR Supplement.
|
32
|
-
# * Unpublished-- rights reserved under the copyright laws of the
|
33
|
-
# * United States. Contractor/manufacturer is Silicon Graphics,
|
34
|
-
# * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
35
|
-
# *
|
36
|
-
# * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
|
37
|
-
# */
|
38
|
-
#
|
39
|
-
#/*
|
40
|
-
# * aapoly.c
|
41
|
-
# * This program draws filled polygons with antialiased
|
42
|
-
# * edges. The special GL_SRC_ALPHA_SATURATE blending
|
43
|
-
# * function is used.
|
44
|
-
# * Pressing the 't' key turns the antialiasing on and off.
|
45
|
-
# */
|
46
|
-
|
47
|
-
require "gl_prev"
|
48
|
-
require "glu_prev"
|
49
|
-
require "glut_prev"
|
50
|
-
|
51
|
-
$polySmooth = true
|
52
|
-
|
53
|
-
def init
|
54
|
-
GL::CullFace(GL::BACK);
|
55
|
-
GL::Enable(GL::CULL_FACE);
|
56
|
-
GL::BlendFunc(GL::SRC_ALPHA_SATURATE, GL::ONE);
|
57
|
-
GL::ClearColor(0.0, 0.0, 0.0, 0.0);
|
58
|
-
end
|
59
|
-
|
60
|
-
NFACE=6
|
61
|
-
NVERT=8
|
62
|
-
$indices = [
|
63
|
-
[4, 5, 6, 7], [2, 3, 7, 6], [0, 4, 7, 3],
|
64
|
-
[0, 1, 5, 4], [1, 5, 6, 2], [0, 3, 2, 1]
|
65
|
-
]
|
66
|
-
|
67
|
-
def drawCube(x0, x1, y0, y1, z0, z1)
|
68
|
-
v = [[],[],[],[],[],[],[],[]]
|
69
|
-
c = [
|
70
|
-
[0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0],
|
71
|
-
[0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 1.0],
|
72
|
-
[0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0],
|
73
|
-
[0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]
|
74
|
-
];
|
75
|
-
|
76
|
-
#/* indices of front, top, left, bottom, right, back faces */
|
77
|
-
|
78
|
-
v[0][0] = v[3][0] = v[4][0] = v[7][0] = x0;
|
79
|
-
v[1][0] = v[2][0] = v[5][0] = v[6][0] = x1;
|
80
|
-
v[0][1] = v[1][1] = v[4][1] = v[5][1] = y0;
|
81
|
-
v[2][1] = v[3][1] = v[6][1] = v[7][1] = y1;
|
82
|
-
v[0][2] = v[1][2] = v[2][2] = v[3][2] = z0;
|
83
|
-
v[4][2] = v[5][2] = v[6][2] = v[7][2] = z1;
|
84
|
-
|
85
|
-
GL::EnableClientState(GL::VERTEX_ARRAY);
|
86
|
-
GL::EnableClientState(GL::COLOR_ARRAY);
|
87
|
-
GL::VertexPointer(3, GL::FLOAT, 0, v.flatten!.pack("f*"));
|
88
|
-
GL::ColorPointer(4, GL::FLOAT, 0, c.flatten!.pack("f*"));
|
89
|
-
GL::DrawElements(GL::QUADS, NFACE*4, GL::UNSIGNED_BYTE, $indices.flatten.pack("C*"));
|
90
|
-
GL::DisableClientState(GL::VERTEX_ARRAY);
|
91
|
-
GL::DisableClientState(GL::COLOR_ARRAY);
|
92
|
-
end
|
93
|
-
|
94
|
-
#/* Note: polygons must be drawn from front to back
|
95
|
-
# * for proper blending.
|
96
|
-
# */
|
97
|
-
display = proc {
|
98
|
-
if ($polySmooth)
|
99
|
-
GL::Clear(GL::COLOR_BUFFER_BIT);
|
100
|
-
GL::Enable(GL::BLEND);
|
101
|
-
GL::Enable(GL::POLYGON_SMOOTH);
|
102
|
-
GL::Disable(GL::DEPTH_TEST);
|
103
|
-
else
|
104
|
-
GL::Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
|
105
|
-
GL::Disable(GL::BLEND);
|
106
|
-
GL::Disable(GL::POLYGON_SMOOTH);
|
107
|
-
GL::Enable(GL::DEPTH_TEST);
|
108
|
-
end
|
109
|
-
|
110
|
-
GL::PushMatrix();
|
111
|
-
GL::Translate(0.0, 0.0, -8.0);
|
112
|
-
GL::Rotate(30.0, 1.0, 0.0, 0.0);
|
113
|
-
GL::Rotate(60.0, 0.0, 1.0, 0.0);
|
114
|
-
drawCube(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);
|
115
|
-
GL::PopMatrix();
|
116
|
-
|
117
|
-
GL::Flush();
|
118
|
-
}
|
119
|
-
|
120
|
-
reshape = proc {|w, h|
|
121
|
-
GL::Viewport(0, 0, w, h);
|
122
|
-
GL::MatrixMode(GL::PROJECTION);
|
123
|
-
GL::LoadIdentity();
|
124
|
-
GLU::Perspective(30.0, w.to_f/ h.to_f, 1.0, 20.0);
|
125
|
-
GL::MatrixMode(GL::MODELVIEW);
|
126
|
-
GL::LoadIdentity();
|
127
|
-
}
|
128
|
-
|
129
|
-
# /* ARGSUSED1 */
|
130
|
-
keyboard = proc {|key, x, y|
|
131
|
-
case (key)
|
132
|
-
when ?t ,?T
|
133
|
-
$polySmooth = !$polySmooth;
|
134
|
-
GLUT::PostRedisplay();
|
135
|
-
when 27
|
136
|
-
exit(0); #/* Escape key */
|
137
|
-
end
|
138
|
-
}
|
139
|
-
|
140
|
-
#/* Main Loop
|
141
|
-
# */
|
142
|
-
#int main(int argc, char** argv)
|
143
|
-
#{
|
144
|
-
GLUT.Init
|
145
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::ALPHA | GLUT::DEPTH);
|
146
|
-
GLUT.InitWindowSize(200, 200);
|
147
|
-
GLUT.CreateWindow($0)
|
148
|
-
init();
|
149
|
-
GLUT.ReshapeFunc(reshape);
|
150
|
-
GLUT.KeyboardFunc(keyboard);
|
151
|
-
GLUT.DisplayFunc(display);
|
152
|
-
GLUT.MainLoop();
|
153
|
-
|
data/examples/legacy/aargb.rb
DELETED
@@ -1,139 +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
|
-
# * aargb.c
|
40
|
-
# * This program draws shows how to draw anti-aliased lines. It draws
|
41
|
-
# * two diagonal lines to form an X; when 'r' is typed in the window,
|
42
|
-
# * the lines are rotated in opposite directions.
|
43
|
-
# */
|
44
|
-
|
45
|
-
require "gl_prev"
|
46
|
-
require "glu_prev"
|
47
|
-
require "glut_prev"
|
48
|
-
require "mathn"
|
49
|
-
|
50
|
-
$rotAngle = 0.0;
|
51
|
-
|
52
|
-
#/* Initialize antialiasing for RGBA mode, including alpha
|
53
|
-
# * blending, hint, and line width. Print out implementation
|
54
|
-
# * specific info on line width granularity and width.
|
55
|
-
# */
|
56
|
-
def init
|
57
|
-
# GLfloat values[2];
|
58
|
-
# glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values);
|
59
|
-
# printf ("GL_LINE_WIDTH_GRANULARITY value is %3.1f\n", values[0]);
|
60
|
-
|
61
|
-
# glGetFloatv (GL_LINE_WIDTH_RANGE, values);
|
62
|
-
# printf ("GL_LINE_WIDTH_RANGE values are %3.1f %3.1f\n",
|
63
|
-
# values[0], values[1]);
|
64
|
-
|
65
|
-
GL.Enable(GL::LINE_SMOOTH);
|
66
|
-
GL.Enable(GL::BLEND);
|
67
|
-
GL.BlendFunc(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA);
|
68
|
-
GL.Hint(GL::LINE_SMOOTH_HINT, GL::DONT_CARE);
|
69
|
-
GL.LineWidth(1.5);
|
70
|
-
|
71
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
72
|
-
end
|
73
|
-
|
74
|
-
#/* Draw 2 diagonal lines to form an X
|
75
|
-
# */
|
76
|
-
display = Proc.new {
|
77
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
78
|
-
|
79
|
-
GL.Color(0.0, 1.0, 0.0);
|
80
|
-
GL.PushMatrix();
|
81
|
-
GL.Rotate(-$rotAngle, 0.0, 0.0, 0.1);
|
82
|
-
GL.Begin(GL::LINES);
|
83
|
-
GL.Vertex(-0.5, 0.5);
|
84
|
-
GL.Vertex(0.5, -0.5);
|
85
|
-
GL.End();
|
86
|
-
GL.PopMatrix();
|
87
|
-
|
88
|
-
GL.Color(0.0, 0.0, 1.0);
|
89
|
-
GL.PushMatrix();
|
90
|
-
GL.Rotate($rotAngle, 0.0, 0.0, 0.1);
|
91
|
-
GL.Begin(GL::LINES);
|
92
|
-
GL.Vertex(0.5, 0.5);
|
93
|
-
GL.Vertex(-0.5, -0.5);
|
94
|
-
GL.End();
|
95
|
-
GL.PopMatrix();
|
96
|
-
|
97
|
-
GL.Flush();
|
98
|
-
}
|
99
|
-
|
100
|
-
reshape = Proc.new {|w, h|
|
101
|
-
GL.Viewport(0, 0, w, h);
|
102
|
-
GL.MatrixMode(GL::PROJECTION);
|
103
|
-
GL.LoadIdentity();
|
104
|
-
if (w <= h)
|
105
|
-
GLU.Ortho2D(-1.0, 1.0, -1.0*h/w, 1.0*h/w);
|
106
|
-
else
|
107
|
-
GLU.Ortho2D(-1.0*w/h, 1.0*w/h, -1.0, 1.0);
|
108
|
-
end
|
109
|
-
GL.MatrixMode(GL::MODELVIEW);
|
110
|
-
GL.LoadIdentity();
|
111
|
-
}
|
112
|
-
|
113
|
-
# /* ARGSUSED1 */
|
114
|
-
keyboard = Proc.new {|key, x, y|
|
115
|
-
case (key)
|
116
|
-
when 'r'[0],'R'[0]
|
117
|
-
$rotAngle = $rotAngle + 20.0;
|
118
|
-
$rotAngle = 0.0 if ($rotAngle >= 360.0)
|
119
|
-
GLUT.PostRedisplay();
|
120
|
-
when 27 #/* Escape Key */
|
121
|
-
exit(0);
|
122
|
-
end
|
123
|
-
}
|
124
|
-
|
125
|
-
#/* Main Loop
|
126
|
-
# * Open window with initial window size, title bar,
|
127
|
-
# * RGBA display mode, and handle input events.
|
128
|
-
# */
|
129
|
-
#int main(int argc, char** argv)
|
130
|
-
#{
|
131
|
-
GLUT.Init
|
132
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
133
|
-
GLUT.InitWindowSize(200, 200);
|
134
|
-
GLUT.CreateWindow($0);
|
135
|
-
init();
|
136
|
-
GLUT.ReshapeFunc(reshape);
|
137
|
-
GLUT.KeyboardFunc(keyboard);
|
138
|
-
GLUT.DisplayFunc(display);
|
139
|
-
GLUT.MainLoop();
|
data/examples/legacy/accanti.rb
DELETED
@@ -1,159 +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
|
-
#/* accanti.c
|
41
|
-
# */
|
42
|
-
require "gl_prev"
|
43
|
-
require "glu_prev"
|
44
|
-
require "glut_prev"
|
45
|
-
|
46
|
-
$LOAD_PATH.push(File.dirname($0)) # Find jitter in script directory
|
47
|
-
|
48
|
-
#/* Initialize lighting and other values.
|
49
|
-
# */
|
50
|
-
def myinit
|
51
|
-
mat_ambient = [ 1.0, 1.0, 1.0, 1.0 ];
|
52
|
-
mat_specular = [ 1.0, 1.0, 1.0, 1.0 ];
|
53
|
-
light_position = [ 0.0, 0.0, 10.0, 1.0 ];
|
54
|
-
lm_ambient = [ 0.2, 0.2, 0.2, 1.0 ];
|
55
|
-
|
56
|
-
GL::Material(GL::FRONT, GL::AMBIENT, mat_ambient);
|
57
|
-
GL::Material(GL::FRONT, GL::SPECULAR, mat_specular);
|
58
|
-
GL::Material(GL::FRONT, GL::SHININESS, 50.0);
|
59
|
-
GL::Light(GL::LIGHT0, GL::POSITION, light_position);
|
60
|
-
GL::LightModel(GL::LIGHT_MODEL_AMBIENT, lm_ambient);
|
61
|
-
|
62
|
-
GL::Enable(GL::LIGHTING);
|
63
|
-
GL::Enable(GL::LIGHT0);
|
64
|
-
GL::DepthFunc(GL::LESS);
|
65
|
-
GL::Enable(GL::DEPTH_TEST);
|
66
|
-
GL::ShadeModel(GL::FLAT);
|
67
|
-
|
68
|
-
GL::ClearColor(0.0, 0.0, 0.0, 0.0);
|
69
|
-
GL::ClearAccum(0.0, 0.0, 0.0, 0.0);
|
70
|
-
end
|
71
|
-
|
72
|
-
def displayObjects
|
73
|
-
torus_diffuse = [ 0.7, 0.7, 0.0, 1.0 ];
|
74
|
-
cube_diffuse = [ 0.0, 0.7, 0.7, 1.0 ];
|
75
|
-
sphere_diffuse = [ 0.7, 0.0, 0.7, 1.0 ];
|
76
|
-
octa_diffuse = [ 0.7, 0.4, 0.4, 1.0 ];
|
77
|
-
|
78
|
-
GL::PushMatrix();
|
79
|
-
GL::Rotate(30.0, 1.0, 0.0, 0.0);
|
80
|
-
|
81
|
-
GL::PushMatrix();
|
82
|
-
GL::Translate(-0.80, 0.35, 0.0);
|
83
|
-
GL::Rotate(100.0, 1.0, 0.0, 0.0);
|
84
|
-
GL::Material(GL::FRONT, GL::DIFFUSE, torus_diffuse);
|
85
|
-
GLUT::SolidTorus(0.275, 0.85, 16, 16);
|
86
|
-
GL::PopMatrix();
|
87
|
-
|
88
|
-
GL::PushMatrix();
|
89
|
-
GL::Translate(-0.75, -0.50, 0.0);
|
90
|
-
GL::Rotate(45.0, 0.0, 0.0, 1.0);
|
91
|
-
GL::Rotate(45.0, 1.0, 0.0, 0.0);
|
92
|
-
GL::Material(GL::FRONT, GL::DIFFUSE, cube_diffuse);
|
93
|
-
GLUT::SolidCube(1.5);
|
94
|
-
GL::PopMatrix();
|
95
|
-
|
96
|
-
GL::PushMatrix();
|
97
|
-
GL::Translate(0.75, 0.60, 0.0);
|
98
|
-
GL::Rotate(30.0, 1.0, 0.0, 0.0);
|
99
|
-
GL::Material(GL::FRONT, GL::DIFFUSE, sphere_diffuse);
|
100
|
-
GLUT::SolidSphere(1.0, 16, 16);
|
101
|
-
GL::PopMatrix();
|
102
|
-
|
103
|
-
GL::PushMatrix();
|
104
|
-
GL::Translate(0.70, -0.90, 0.25);
|
105
|
-
GL::Material(GL::FRONT, GL::DIFFUSE, octa_diffuse);
|
106
|
-
GLUT::SolidOctahedron();
|
107
|
-
GL::PopMatrix();
|
108
|
-
|
109
|
-
GL::PopMatrix();
|
110
|
-
end
|
111
|
-
|
112
|
-
ACSIZE=8
|
113
|
-
|
114
|
-
display = proc {
|
115
|
-
viewport = GL::GetDoublev(GL::VIEWPORT);
|
116
|
-
|
117
|
-
GL::Clear(GL::ACCUM_BUFFER_BIT);
|
118
|
-
for jitter in 0...ACSIZE
|
119
|
-
GL::Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
|
120
|
-
GL::PushMatrix();
|
121
|
-
#/* Note that 4.5 is the distance in world space between
|
122
|
-
# * left and right and bottom and top.
|
123
|
-
# * This formula converts fractional pixel movement to
|
124
|
-
# * world coordinates.
|
125
|
-
# */
|
126
|
-
GL::Translate($j8[jitter][0]*4.5/viewport[2],
|
127
|
-
$j8[jitter][1]*4.5/viewport[3], 0.0);
|
128
|
-
displayObjects();
|
129
|
-
GL::PopMatrix();
|
130
|
-
GL::Accum(GL::ACCUM, 1.0/ACSIZE);
|
131
|
-
end
|
132
|
-
GL::Accum(GL::RETURN, 1.0);
|
133
|
-
GL::Flush();
|
134
|
-
}
|
135
|
-
|
136
|
-
myReshape = proc {|w, h|
|
137
|
-
GL::Viewport(0, 0, w, h);
|
138
|
-
GL::MatrixMode(GL::PROJECTION);
|
139
|
-
GL::LoadIdentity();
|
140
|
-
if (w <= h)
|
141
|
-
GL::Ortho(-2.25, 2.25, -2.25*h/w, 2.25*h/w, -10.0, 10.0);
|
142
|
-
else
|
143
|
-
GL::Ortho(-2.25*w/h, 2.25*w/h, -2.25, 2.25, -10.0, 10.0);
|
144
|
-
end
|
145
|
-
GL::MatrixMode(GL::MODELVIEW);
|
146
|
-
}
|
147
|
-
|
148
|
-
# /* Main Loop
|
149
|
-
# * Open window with initial window size, title bar,
|
150
|
-
# * RGBA display mode, and handle input events.
|
151
|
-
# */
|
152
|
-
GLUT.Init
|
153
|
-
GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::ACCUM | GLUT::DEPTH);
|
154
|
-
GLUT::InitWindowSize(250, 250);
|
155
|
-
GLUT::CreateWindow($0)
|
156
|
-
myinit();
|
157
|
-
GLUT::ReshapeFunc(myReshape);
|
158
|
-
GLUT::DisplayFunc(display);
|
159
|
-
GLUT::MainLoop();
|