ruby-opengl 0.40.1 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/varray.rb
DELETED
@@ -1,167 +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
|
-
# * varray.c
|
40
|
-
# * This program demonstrates vertex arrays.
|
41
|
-
# */
|
42
|
-
|
43
|
-
require "gl_prev"
|
44
|
-
require "glu_prev"
|
45
|
-
require "glut_prev"
|
46
|
-
|
47
|
-
POINTER=1
|
48
|
-
INTERLEAVED=2
|
49
|
-
|
50
|
-
DRAWARRAY=1
|
51
|
-
ARRAYELEMENT=2
|
52
|
-
DRAWELEMENTS=3
|
53
|
-
|
54
|
-
$setupMethod = POINTER;
|
55
|
-
$derefMethod = DRAWARRAY;
|
56
|
-
|
57
|
-
def setupPointers
|
58
|
-
$vertices = [25, 25,
|
59
|
-
100, 325,
|
60
|
-
175, 25,
|
61
|
-
175, 325,
|
62
|
-
250, 25,
|
63
|
-
325, 325].pack("i*");
|
64
|
-
$colors = [1.0, 0.2, 0.2,
|
65
|
-
0.2, 0.2, 1.0,
|
66
|
-
0.8, 1.0, 0.2,
|
67
|
-
0.75, 0.75, 0.75,
|
68
|
-
0.35, 0.35, 0.35,
|
69
|
-
0.5, 0.5, 0.5].pack("f*");
|
70
|
-
|
71
|
-
GL.EnableClientState(GL::VERTEX_ARRAY);
|
72
|
-
GL.EnableClientState(GL::COLOR_ARRAY);
|
73
|
-
|
74
|
-
GL.VertexPointer(2, GL::INT, 0, $vertices);
|
75
|
-
GL.ColorPointer(3, GL::FLOAT, 0, $colors);
|
76
|
-
end
|
77
|
-
|
78
|
-
def setupInterleave
|
79
|
-
$intertwined =
|
80
|
-
[1.0, 0.2, 1.0, 100.0, 100.0, 0.0,
|
81
|
-
1.0, 0.2, 0.2, 0.0, 200.0, 0.0,
|
82
|
-
1.0, 1.0, 0.2, 100.0, 300.0, 0.0,
|
83
|
-
0.2, 1.0, 0.2, 200.0, 300.0, 0.0,
|
84
|
-
0.2, 1.0, 1.0, 300.0, 200.0, 0.0,
|
85
|
-
0.2, 0.2, 1.0, 200.0, 100.0, 0.0].pack("f*");
|
86
|
-
|
87
|
-
GL.InterleavedArrays(GL::C3F_V3F, 0, $intertwined);
|
88
|
-
end
|
89
|
-
|
90
|
-
def init
|
91
|
-
GL.ClearColor(0.0, 0.0, 0.0, 0.0);
|
92
|
-
GL.ShadeModel(GL::SMOOTH);
|
93
|
-
setupPointers();
|
94
|
-
end
|
95
|
-
|
96
|
-
display = proc {
|
97
|
-
GL.Clear(GL::COLOR_BUFFER_BIT);
|
98
|
-
|
99
|
-
if ($derefMethod == DRAWARRAY)
|
100
|
-
GL.DrawArrays(GL::TRIANGLES, 0, 6);
|
101
|
-
elsif ($derefMethod == ARRAYELEMENT)
|
102
|
-
GL.Begin(GL::TRIANGLES);
|
103
|
-
GL.ArrayElement(2);
|
104
|
-
GL.ArrayElement(3);
|
105
|
-
GL.ArrayElement(5);
|
106
|
-
GL.End();
|
107
|
-
elsif ($derefMethod == DRAWELEMENTS)
|
108
|
-
$indices = [0, 1, 3, 4].pack("I*")
|
109
|
-
GL.DrawElements(GL::POLYGON, 4, GL::UNSIGNED_INT, $indices);
|
110
|
-
end
|
111
|
-
GL.Flush();
|
112
|
-
}
|
113
|
-
|
114
|
-
reshape = proc {|w, h|
|
115
|
-
GL.Viewport(0, 0, w, h);
|
116
|
-
GL.MatrixMode(GL::PROJECTION);
|
117
|
-
GL.LoadIdentity();
|
118
|
-
GLU.Ortho2D(0.0, w, 0.0, h);
|
119
|
-
}
|
120
|
-
|
121
|
-
#/* ARGSUSED2 */
|
122
|
-
mouse = proc {|button, state, x, y|
|
123
|
-
case (button)
|
124
|
-
when GLUT::LEFT_BUTTON
|
125
|
-
if (state == GLUT::DOWN)
|
126
|
-
if ($setupMethod == POINTER)
|
127
|
-
$setupMethod = INTERLEAVED;
|
128
|
-
setupInterleave();
|
129
|
-
elsif ($setupMethod == INTERLEAVED)
|
130
|
-
$setupMethod = POINTER;
|
131
|
-
setupPointers();
|
132
|
-
end
|
133
|
-
GLUT.PostRedisplay();
|
134
|
-
end
|
135
|
-
when GLUT::MIDDLE_BUTTON,GLUT::RIGHT_BUTTON
|
136
|
-
if (state == GLUT::DOWN)
|
137
|
-
if ($derefMethod == DRAWARRAY)
|
138
|
-
$derefMethod = ARRAYELEMENT;
|
139
|
-
elsif ($derefMethod == ARRAYELEMENT)
|
140
|
-
$derefMethod = DRAWELEMENTS;
|
141
|
-
elsif ($derefMethod == DRAWELEMENTS)
|
142
|
-
$derefMethod = DRAWARRAY;
|
143
|
-
end
|
144
|
-
GLUT.PostRedisplay();
|
145
|
-
end
|
146
|
-
end
|
147
|
-
}
|
148
|
-
|
149
|
-
#/* ARGSUSED1 */
|
150
|
-
keyboard = proc {|key, x, y|
|
151
|
-
case (key)
|
152
|
-
when 27
|
153
|
-
exit(0);
|
154
|
-
end
|
155
|
-
}
|
156
|
-
|
157
|
-
GLUT.Init();
|
158
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
|
159
|
-
GLUT.InitWindowSize(350, 350);
|
160
|
-
GLUT.InitWindowPosition(100, 100);
|
161
|
-
GLUT.CreateWindow()
|
162
|
-
init();
|
163
|
-
GLUT.DisplayFunc(display);
|
164
|
-
GLUT.ReshapeFunc(reshape);
|
165
|
-
GLUT.MouseFunc(mouse);
|
166
|
-
GLUT.KeyboardFunc(keyboard);
|
167
|
-
GLUT.MainLoop();
|
data/examples/legacy/wrap.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
|
-
#/* wrap.c
|
39
|
-
# * This program texture maps a checkerboard image onto
|
40
|
-
# * two rectangles. This program demonstrates the wrapping
|
41
|
-
# * modes, if the texture coordinates fall outside 0.0 and 1.0.
|
42
|
-
# * Interaction: Pressing the 's' and 'S' keys switch the
|
43
|
-
# * wrapping between clamping and repeating for the s parameter.
|
44
|
-
# * The 't' and 'T' keys control the wrapping for the t parameter.
|
45
|
-
# *
|
46
|
-
# * If running this program on OpenGL 1.0, texture objects are
|
47
|
-
# * not used.
|
48
|
-
# */
|
49
|
-
|
50
|
-
require "gl_prev"
|
51
|
-
require "glu_prev"
|
52
|
-
require "glut_prev"
|
53
|
-
require "mathn"
|
54
|
-
|
55
|
-
#/* Create checkerboard texture */
|
56
|
-
CheckImageWidth=64
|
57
|
-
CheckImageHeight=64
|
58
|
-
$checkImage = []
|
59
|
-
|
60
|
-
$texName = 0;
|
61
|
-
|
62
|
-
def makeCheckImage
|
63
|
-
for i in 0..CheckImageHeight-1
|
64
|
-
for j in 0..CheckImageWidth-1
|
65
|
-
c = if (((i&0x8)==0)!=((j&0x8)==0)) then 255; else 0; end;
|
66
|
-
$checkImage[(i*CheckImageWidth+j)*4+0] = c;
|
67
|
-
$checkImage[(i*CheckImageWidth+j)*4+1] = c;
|
68
|
-
$checkImage[(i*CheckImageWidth+j)*4+2] = c;
|
69
|
-
$checkImage[(i*CheckImageWidth+j)*4+3] = 255;
|
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
|
-
GL.Enable(GL::DEPTH_TEST);
|
78
|
-
|
79
|
-
makeCheckImage();
|
80
|
-
GL.PixelStore(GL::UNPACK_ALIGNMENT, 1);
|
81
|
-
|
82
|
-
$texName = GL.GenTextures(1);
|
83
|
-
GL.BindTexture(GL::TEXTURE_2D, $texName[0]);
|
84
|
-
|
85
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, GL::REPEAT);
|
86
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, GL::REPEAT);
|
87
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::NEAREST);
|
88
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::NEAREST);
|
89
|
-
GL.TexImage2D(GL::TEXTURE_2D, 0, GL::RGBA, CheckImageWidth,
|
90
|
-
CheckImageHeight,
|
91
|
-
0, GL::RGBA, GL::UNSIGNED_BYTE, $checkImage.pack("C*"));
|
92
|
-
end
|
93
|
-
|
94
|
-
display = Proc.new {
|
95
|
-
GL.Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
|
96
|
-
GL.Enable(GL::TEXTURE_2D);
|
97
|
-
GL.TexEnvf(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, GL::DECAL);
|
98
|
-
GL.BindTexture(GL::TEXTURE_2D, $texName[0]);
|
99
|
-
|
100
|
-
GL.Begin(GL::QUADS);
|
101
|
-
GL.TexCoord(0.0, 0.0); GL.Vertex(-2.0, -1.0, 0.0);
|
102
|
-
GL.TexCoord(0.0, 3.0); GL.Vertex(-2.0, 1.0, 0.0);
|
103
|
-
GL.TexCoord(3.0, 3.0); GL.Vertex(0.0, 1.0, 0.0);
|
104
|
-
GL.TexCoord(3.0, 0.0); GL.Vertex(0.0, -1.0, 0.0);
|
105
|
-
|
106
|
-
GL.TexCoord(0.0, 0.0); GL.Vertex(1.0, -1.0, 0.0);
|
107
|
-
GL.TexCoord(0.0, 3.0); GL.Vertex(1.0, 1.0, 0.0);
|
108
|
-
GL.TexCoord(3.0, 3.0); GL.Vertex(2.41421, 1.0, -1.41421);
|
109
|
-
GL.TexCoord(3.0, 0.0); GL.Vertex(2.41421, -1.0, -1.41421);
|
110
|
-
GL.End();
|
111
|
-
GL.Flush();
|
112
|
-
GL.Disable(GL::TEXTURE_2D);
|
113
|
-
}
|
114
|
-
|
115
|
-
reshape = Proc.new {|w, h|
|
116
|
-
GL.Viewport(0, 0, w, h);
|
117
|
-
GL.MatrixMode(GL::PROJECTION);
|
118
|
-
GL.LoadIdentity();
|
119
|
-
GLU.Perspective(60.0, w/h, 1.0, 30.0);
|
120
|
-
GL.MatrixMode(GL::MODELVIEW);
|
121
|
-
GL.LoadIdentity();
|
122
|
-
GL.Translate(0.0, 0.0, -3.6);
|
123
|
-
}
|
124
|
-
|
125
|
-
#/* ARGSUSED1 */
|
126
|
-
keyboard = Proc.new {|key, x, y|
|
127
|
-
case (key)
|
128
|
-
when 's'[0]
|
129
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, GL::CLAMP);
|
130
|
-
GLUT.PostRedisplay();
|
131
|
-
when 'S'[0]
|
132
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, GL::REPEAT);
|
133
|
-
GLUT.PostRedisplay();
|
134
|
-
when 't'[0]
|
135
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, GL::CLAMP);
|
136
|
-
GLUT.PostRedisplay();
|
137
|
-
when 'T'[0]
|
138
|
-
GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, GL::REPEAT);
|
139
|
-
GLUT.PostRedisplay();
|
140
|
-
when 27
|
141
|
-
exit(0);
|
142
|
-
end
|
143
|
-
}
|
144
|
-
|
145
|
-
#int main(int argc, char** argv)
|
146
|
-
#{
|
147
|
-
GLUT.Init
|
148
|
-
GLUT.InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::DEPTH);
|
149
|
-
GLUT.InitWindowSize(250, 250);
|
150
|
-
GLUT.InitWindowPosition(100, 100);
|
151
|
-
GLUT.CreateWindow($0);
|
152
|
-
init();
|
153
|
-
GLUT.DisplayFunc(display);
|
154
|
-
GLUT.ReshapeFunc(reshape);
|
155
|
-
GLUT.KeyboardFunc(keyboard);
|
156
|
-
GLUT.MainLoop();
|
157
|
-
# return 0;
|
158
|
-
#}
|
data/lib/gl_prev.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
|
2
|
-
#
|
3
|
-
# This program is distributed under the terms of the MIT license.
|
4
|
-
# See the included MIT-LICENSE file for the terms of this license.
|
5
|
-
#
|
6
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
7
|
-
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
9
|
-
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
10
|
-
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
11
|
-
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
12
|
-
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
13
|
-
|
14
|
-
|
15
|
-
# This module provides access to the GL methods and constants
|
16
|
-
# in the way that they were available in previous versions of ruby-opengl.
|
17
|
-
#
|
18
|
-
# Thanks to Ilmari Heikkinen for a previous "reversed" version of this code,
|
19
|
-
# and to Bill Kelly for a version before that one.
|
20
|
-
|
21
|
-
require 'gl'
|
22
|
-
|
23
|
-
module GL
|
24
|
-
extend self
|
25
|
-
include Gl
|
26
|
-
|
27
|
-
Gl.constants.each do |cn|
|
28
|
-
n = cn.to_s.sub(/^GL_/,'')
|
29
|
-
next if n =~ /^[0-9]/
|
30
|
-
begin
|
31
|
-
const_set( n, Gl.const_get( cn ) )
|
32
|
-
rescue
|
33
|
-
puts "=== #{__FILE__} FAILED on Constant: #{cn} --> #{n}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
Gl.methods( false ).each do |mn|
|
38
|
-
n = mn.to_s.sub(/^gl/,'')
|
39
|
-
begin
|
40
|
-
alias_method( n, mn )
|
41
|
-
public( n )
|
42
|
-
rescue
|
43
|
-
puts "=== #{__FILE__} FAILED on Method: #{mn} --> #{n}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/glu_prev.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
|
2
|
-
#
|
3
|
-
# This program is distributed under the terms of the MIT license.
|
4
|
-
# See the included MIT-LICENSE file for the terms of this license.
|
5
|
-
#
|
6
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
7
|
-
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
9
|
-
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
10
|
-
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
11
|
-
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
12
|
-
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
13
|
-
|
14
|
-
|
15
|
-
# This module provides access to the GLU methods and constants
|
16
|
-
# in the way that they were available in previous versions of ruby-opengl.
|
17
|
-
#
|
18
|
-
# Thanks to Ilmari Heikkinen for a previous "reversed" version of this code,
|
19
|
-
# and to Bill Kelly for a version before that one.
|
20
|
-
|
21
|
-
require 'gl'
|
22
|
-
require 'glu'
|
23
|
-
|
24
|
-
module GLU
|
25
|
-
extend self
|
26
|
-
include Glu
|
27
|
-
|
28
|
-
Glu.constants.each do |cn|
|
29
|
-
n = cn.to_s.sub(/^GLU_/,'')
|
30
|
-
begin
|
31
|
-
const_set( n, Glu.const_get( cn ) )
|
32
|
-
rescue
|
33
|
-
puts "=== #{__FILE__} FAILED on Constant: #{cn} --> #{n}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
Glu.methods( false ).each do |mn|
|
38
|
-
n = mn.to_s.sub(/^glu/,'')
|
39
|
-
begin
|
40
|
-
alias_method( n, mn )
|
41
|
-
public( n )
|
42
|
-
rescue
|
43
|
-
puts "=== #{__FILE__} FAILED on Method: #{mn} --> #{n}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/glut_prev.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
|
2
|
-
#
|
3
|
-
# This program is distributed under the terms of the MIT license.
|
4
|
-
# See the included MIT-LICENSE file for the terms of this license.
|
5
|
-
#
|
6
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
7
|
-
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
8
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
9
|
-
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
10
|
-
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
11
|
-
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
12
|
-
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
13
|
-
|
14
|
-
|
15
|
-
# This module provides access to the GLUT methods and constants
|
16
|
-
# in the way that they were available in previous versions of ruby-opengl.
|
17
|
-
#
|
18
|
-
# Thanks to Ilmari Heikkinen for a previous "reversed" version of this code,
|
19
|
-
# and to Bill Kelly for a version before that one.
|
20
|
-
|
21
|
-
require 'glut'
|
22
|
-
|
23
|
-
module GLUT
|
24
|
-
extend self
|
25
|
-
include Glut
|
26
|
-
|
27
|
-
Glut.constants.each do |cn|
|
28
|
-
n = cn.to_s.sub(/^GLUT_/,'')
|
29
|
-
begin
|
30
|
-
const_set( n, Glut.const_get( cn ) )
|
31
|
-
rescue
|
32
|
-
puts "=== #{__FILE__} FAILED on Constant: #{cn} --> #{n}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
Glut.methods( false ).each do |mn|
|
37
|
-
n = mn.to_s.sub(/^glut/,'')
|
38
|
-
begin
|
39
|
-
alias_method( n, mn )
|
40
|
-
public( n )
|
41
|
-
rescue
|
42
|
-
puts "=== #{__FILE__} FAILED on Method: #{mn} --> #{n}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|