ruby-opengl 0.60.1 → 0.61.0
Sign up to get free protection for your applications and to get access to all the features.
- metadata +36 -186
- data/Rakefile +0 -168
- data/doc/build_install.txt +0 -122
- data/doc/extensions.txt +0 -556
- data/doc/extensions.txt.in +0 -348
- data/doc/history.txt +0 -66
- data/doc/requirements_and_design.txt +0 -117
- data/doc/roadmap.txt +0 -28
- data/doc/scientific_use.txt +0 -35
- data/doc/supplies/page_template.html +0 -71
- data/doc/thanks.txt +0 -29
- data/doc/tutorial.txt +0 -469
- data/examples/NeHe/nehe_lesson02.rb +0 -117
- data/examples/NeHe/nehe_lesson03.rb +0 -122
- data/examples/NeHe/nehe_lesson04.rb +0 -133
- data/examples/NeHe/nehe_lesson05.rb +0 -186
- data/examples/NeHe/nehe_lesson36.rb +0 -303
- data/examples/OrangeBook/3Dlabs-License.txt +0 -33
- data/examples/OrangeBook/brick.frag +0 -36
- data/examples/OrangeBook/brick.rb +0 -376
- data/examples/OrangeBook/brick.vert +0 -41
- data/examples/OrangeBook/particle.frag +0 -17
- data/examples/OrangeBook/particle.rb +0 -406
- data/examples/OrangeBook/particle.vert +0 -38
- data/examples/README +0 -16
- data/examples/RedBook/aapoly.rb +0 -142
- data/examples/RedBook/aargb.rb +0 -119
- data/examples/RedBook/accanti.rb +0 -162
- data/examples/RedBook/accpersp.rb +0 -215
- data/examples/RedBook/alpha.rb +0 -123
- data/examples/RedBook/alpha3D.rb +0 -158
- data/examples/RedBook/bezcurve.rb +0 -105
- data/examples/RedBook/bezmesh.rb +0 -137
- data/examples/RedBook/checker.rb +0 -124
- data/examples/RedBook/clip.rb +0 -95
- data/examples/RedBook/colormat.rb +0 -135
- data/examples/RedBook/cube.rb +0 -69
- data/examples/RedBook/depthcue.rb +0 -99
- data/examples/RedBook/dof.rb +0 -205
- data/examples/RedBook/double.rb +0 -105
- data/examples/RedBook/drawf.rb +0 -91
- data/examples/RedBook/feedback.rb +0 -145
- data/examples/RedBook/fog.rb +0 -167
- data/examples/RedBook/font.rb +0 -151
- data/examples/RedBook/hello.rb +0 -79
- data/examples/RedBook/image.rb +0 -137
- data/examples/RedBook/jitter.rb +0 -207
- data/examples/RedBook/lines.rb +0 -128
- data/examples/RedBook/list.rb +0 -111
- data/examples/RedBook/material.rb +0 -275
- data/examples/RedBook/mipmap.rb +0 -156
- data/examples/RedBook/model.rb +0 -113
- data/examples/RedBook/movelight.rb +0 -132
- data/examples/RedBook/pickdepth.rb +0 -179
- data/examples/RedBook/planet.rb +0 -108
- data/examples/RedBook/quadric.rb +0 -158
- data/examples/RedBook/robot.rb +0 -115
- data/examples/RedBook/select.rb +0 -196
- data/examples/RedBook/smooth.rb +0 -95
- data/examples/RedBook/stencil.rb +0 -163
- data/examples/RedBook/stroke.rb +0 -167
- data/examples/RedBook/surface.rb +0 -166
- data/examples/RedBook/teaambient.rb +0 -132
- data/examples/RedBook/teapots.rb +0 -182
- data/examples/RedBook/tess.rb +0 -183
- data/examples/RedBook/texbind.rb +0 -147
- data/examples/RedBook/texgen.rb +0 -169
- data/examples/RedBook/texturesurf.rb +0 -128
- data/examples/RedBook/varray.rb +0 -159
- data/examples/RedBook/wrap.rb +0 -148
- data/examples/misc/OGLBench.rb +0 -337
- data/examples/misc/anisotropic.rb +0 -194
- data/examples/misc/fbo_test.rb +0 -356
- data/examples/misc/font-glut.rb +0 -46
- data/examples/misc/glfwtest.rb +0 -30
- data/examples/misc/plane.rb +0 -161
- data/examples/misc/readpixel.rb +0 -65
- data/examples/misc/sdltest.rb +0 -34
- data/examples/misc/trislam.rb +0 -828
- data/ext/common/common.h +0 -423
- data/ext/common/conv.h +0 -244
- data/ext/common/funcdef.h +0 -280
- data/ext/common/gl-enums.h +0 -10031
- data/ext/common/gl-error.h +0 -23
- data/ext/common/gl-types.h +0 -61
- data/ext/common/glu-enums.h +0 -463
- data/ext/gl/gl-1.0-1.1.c +0 -2817
- data/ext/gl/gl-1.2.c +0 -814
- data/ext/gl/gl-1.3.c +0 -444
- data/ext/gl/gl-1.4.c +0 -349
- data/ext/gl/gl-1.5.c +0 -225
- data/ext/gl/gl-2.0.c +0 -657
- data/ext/gl/gl-2.1.c +0 -57
- data/ext/gl/gl-enums.c +0 -3354
- data/ext/gl/gl-error.c +0 -104
- data/ext/gl/gl-ext-3dfx.c +0 -27
- data/ext/gl/gl-ext-arb.c +0 -866
- data/ext/gl/gl-ext-ati.c +0 -41
- data/ext/gl/gl-ext-ext.c +0 -890
- data/ext/gl/gl-ext-gremedy.c +0 -41
- data/ext/gl/gl-ext-nv.c +0 -679
- data/ext/gl/gl.c +0 -214
- data/ext/gl/mkrf_conf.rb +0 -34
- data/ext/glu/glu-enums.c +0 -164
- data/ext/glu/glu.c +0 -1530
- data/ext/glu/mkrf_conf.rb +0 -35
- data/ext/glut/glut.c +0 -1623
- data/ext/glut/mkrf_conf.rb +0 -37
- data/lib/opengl.rb +0 -84
- data/test/README +0 -10
- data/test/tc_common.rb +0 -98
- data/test/tc_ext_arb.rb +0 -467
- data/test/tc_ext_ati.rb +0 -33
- data/test/tc_ext_ext.rb +0 -551
- data/test/tc_ext_gremedy.rb +0 -36
- data/test/tc_ext_nv.rb +0 -357
- data/test/tc_func_10_11.rb +0 -1281
- data/test/tc_func_12.rb +0 -186
- data/test/tc_func_13.rb +0 -229
- data/test/tc_func_14.rb +0 -197
- data/test/tc_func_15.rb +0 -270
- data/test/tc_func_20.rb +0 -346
- data/test/tc_func_21.rb +0 -541
- data/test/tc_glu.rb +0 -310
- data/test/tc_include_gl.rb +0 -35
- data/test/tc_misc.rb +0 -54
- data/test/tc_require_gl.rb +0 -34
@@ -1,132 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) Mark J. Kilgard, 1994.
|
3
|
-
#
|
4
|
-
# (c) Copyright 1993, Silicon Graphics, Inc.
|
5
|
-
# ALL RIGHTS RESERVED
|
6
|
-
# Permission to use, copy, modify, and distribute this software for
|
7
|
-
# any purpose and without fee is hereby granted, provided that the above
|
8
|
-
# copyright notice appear in all copies and that both the copyright notice
|
9
|
-
# and this permission notice appear in supporting documentation, and that
|
10
|
-
# the name of Silicon Graphics, Inc. not be used in advertising
|
11
|
-
# or publicity pertaining to distribution of the software without specific,
|
12
|
-
# written prior permission.
|
13
|
-
#
|
14
|
-
# THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
15
|
-
# AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
16
|
-
# INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
18
|
-
# GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
19
|
-
# SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
20
|
-
# KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
21
|
-
# LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
22
|
-
# THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
23
|
-
# ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
24
|
-
# ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
25
|
-
# POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
26
|
-
#
|
27
|
-
# US Government Users Restricted Rights
|
28
|
-
# Use, duplication, or disclosure by the Government is subject to
|
29
|
-
# restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
30
|
-
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
31
|
-
# clause at DFARS 252.227-7013 and/or in similar or successor
|
32
|
-
# clauses in the FAR or the DOD or NASA FAR Supplement.
|
33
|
-
# Unpublished-- rights reserved under the copyright laws of the
|
34
|
-
# United States. Contractor/manufacturer is Silicon Graphics,
|
35
|
-
# Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
36
|
-
#
|
37
|
-
# OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
38
|
-
#
|
39
|
-
# teaambient.c
|
40
|
-
# This program renders three lighted, shaded teapots, with
|
41
|
-
# different ambient values.
|
42
|
-
require 'opengl'
|
43
|
-
include Gl,Glu,Glut
|
44
|
-
|
45
|
-
# Initialize light source and lighting model.
|
46
|
-
def myinit
|
47
|
-
light_ambient = [0.0, 0.0, 0.0, 1.0]
|
48
|
-
light_diffuse = [1.0, 1.0, 1.0, 1.0]
|
49
|
-
light_specular = [1.0, 1.0, 1.0, 1.0]
|
50
|
-
# light_position is NOT default value
|
51
|
-
light_position = [1.0, 0.0, 0.0, 0.0]
|
52
|
-
global_ambient = [0.75, 0.75, 0.75, 1.0]
|
53
|
-
|
54
|
-
glLight(GL_LIGHT0, GL_AMBIENT, light_ambient)
|
55
|
-
glLight(GL_LIGHT0, GL_DIFFUSE, light_diffuse)
|
56
|
-
glLight(GL_LIGHT0, GL_SPECULAR, light_specular)
|
57
|
-
glLight(GL_LIGHT0, GL_POSITION, light_position)
|
58
|
-
|
59
|
-
glLightModel(GL_LIGHT_MODEL_AMBIENT, global_ambient)
|
60
|
-
|
61
|
-
glFrontFace(GL_CW)
|
62
|
-
glEnable(GL_LIGHTING)
|
63
|
-
glEnable(GL_LIGHT0)
|
64
|
-
glEnable(GL_AUTO_NORMAL)
|
65
|
-
glEnable(GL_NORMALIZE)
|
66
|
-
glDepthFunc(GL_LESS)
|
67
|
-
glEnable(GL_DEPTH_TEST)
|
68
|
-
end
|
69
|
-
|
70
|
-
display = proc do
|
71
|
-
low_ambient = [0.1, 0.1, 0.1, 1.0]
|
72
|
-
more_ambient = [0.4, 0.4, 0.4, 1.0]
|
73
|
-
most_ambient = [1.0, 1.0, 1.0, 1.0]
|
74
|
-
|
75
|
-
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
76
|
-
|
77
|
-
# material has small ambient reflection
|
78
|
-
glMaterial(GL_FRONT, GL_AMBIENT, low_ambient)
|
79
|
-
glMaterial(GL_FRONT, GL_SHININESS, 40.0)
|
80
|
-
glPushMatrix()
|
81
|
-
glTranslate(0.0, 2.0, 0.0)
|
82
|
-
glutSolidTeapot(1.0)
|
83
|
-
glPopMatrix()
|
84
|
-
|
85
|
-
# material has moderate ambient reflection
|
86
|
-
glMaterial(GL_FRONT, GL_AMBIENT, more_ambient)
|
87
|
-
glPushMatrix()
|
88
|
-
glTranslate(0.0, 0.0, 0.0)
|
89
|
-
glutSolidTeapot(1.0)
|
90
|
-
glPopMatrix()
|
91
|
-
|
92
|
-
# material has large ambient reflection
|
93
|
-
glMaterial(GL_FRONT, GL_AMBIENT, most_ambient)
|
94
|
-
glPushMatrix()
|
95
|
-
glTranslate(0.0, -2.0, 0.0)
|
96
|
-
glutSolidTeapot(1.0)
|
97
|
-
glPopMatrix()
|
98
|
-
glFlush()
|
99
|
-
end
|
100
|
-
|
101
|
-
myReshape = proc do |w, h|
|
102
|
-
glViewport(0, 0, w, h)
|
103
|
-
glMatrixMode(GL_PROJECTION)
|
104
|
-
glLoadIdentity()
|
105
|
-
if (w <= h)
|
106
|
-
glOrtho(-4.0, 4.0, -4.0 * h / w, 4.0 * h / w, -10.0, 10.0)
|
107
|
-
else
|
108
|
-
glOrtho(-4.0 * w / h, 4.0 * w / h, -4.0, 4.0, -10.0, 10.0)
|
109
|
-
end
|
110
|
-
glMatrixMode(GL_MODELVIEW)
|
111
|
-
end
|
112
|
-
|
113
|
-
keyboard = Proc.new do |key, x, y|
|
114
|
-
case (key)
|
115
|
-
when ?\e
|
116
|
-
exit(0);
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
# Main Loop
|
121
|
-
# Open window with initial window size, title bar,
|
122
|
-
# RGBA display mode, and handle input events.
|
123
|
-
glutInit()
|
124
|
-
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH)
|
125
|
-
glutInitWindowSize(500, 500)
|
126
|
-
glutInitWindowPosition(100, 100)
|
127
|
-
glutCreateWindow()
|
128
|
-
myinit()
|
129
|
-
glutReshapeFunc(myReshape)
|
130
|
-
glutDisplayFunc(display)
|
131
|
-
glutKeyboardFunc(keyboard)
|
132
|
-
glutMainLoop()
|
data/examples/RedBook/teapots.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) Mark J. Kilgard, 1994.
|
3
|
-
#
|
4
|
-
# (c) Copyright 1993, Silicon Graphics, Inc.
|
5
|
-
# ALL RIGHTS RESERVED
|
6
|
-
# Permission to use, copy, modify, and distribute this software for
|
7
|
-
# any purpose and without fee is hereby granted, provided that the above
|
8
|
-
# copyright notice appear in all copies and that both the copyright notice
|
9
|
-
# and this permission notice appear in supporting documentation, and that
|
10
|
-
# the name of Silicon Graphics, Inc. not be used in advertising
|
11
|
-
# or publicity pertaining to distribution of the software without specific,
|
12
|
-
# written prior permission.
|
13
|
-
#
|
14
|
-
# THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
15
|
-
# AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
16
|
-
# INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
18
|
-
# GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
19
|
-
# SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
20
|
-
# KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
21
|
-
# LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
22
|
-
# THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
23
|
-
# ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
24
|
-
# ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
25
|
-
# POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
26
|
-
#
|
27
|
-
# US Government Users Restricted Rights
|
28
|
-
# Use, duplication, or disclosure by the Government is subject to
|
29
|
-
# restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
30
|
-
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
31
|
-
# clause at DFARS 252.227-7013 and/or in similar or successor
|
32
|
-
# clauses in the FAR or the DOD or NASA FAR Supplement.
|
33
|
-
# Unpublished-- rights reserved under the copyright laws of the
|
34
|
-
# United States. Contractor/manufacturer is Silicon Graphics,
|
35
|
-
# Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
36
|
-
#
|
37
|
-
# OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
38
|
-
#
|
39
|
-
# teapots.c
|
40
|
-
# This program demonstrates lots of material properties.
|
41
|
-
# A single light source illuminates the objects.
|
42
|
-
require 'opengl'
|
43
|
-
include Gl,Glu,Glut
|
44
|
-
|
45
|
-
# Initialize depth buffer, projection matrix, light source, and lighting
|
46
|
-
# model. Do not specify a material property here.
|
47
|
-
def myinit
|
48
|
-
ambient = [0.0, 0.0, 0.0, 1.0]
|
49
|
-
diffuse = [1.0, 1.0, 1.0, 1.0]
|
50
|
-
position = [0.0, 3.0, 3.0, 0.0]
|
51
|
-
|
52
|
-
lmodel_ambient = [0.2, 0.2, 0.2, 1.0]
|
53
|
-
local_view = [0.0]
|
54
|
-
|
55
|
-
glLight(GL_LIGHT0, GL_AMBIENT, ambient)
|
56
|
-
glLight(GL_LIGHT0, GL_DIFFUSE, diffuse)
|
57
|
-
glLight(GL_LIGHT0, GL_POSITION, position)
|
58
|
-
glLightModel(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient)
|
59
|
-
glLightModel(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view)
|
60
|
-
|
61
|
-
glFrontFace(GL_CW)
|
62
|
-
glEnable(GL_LIGHTING)
|
63
|
-
glEnable(GL_LIGHT0)
|
64
|
-
glEnable(GL_AUTO_NORMAL)
|
65
|
-
glEnable(GL_NORMALIZE)
|
66
|
-
glEnable(GL_DEPTH_TEST)
|
67
|
-
glDepthFunc(GL_LESS)
|
68
|
-
end
|
69
|
-
|
70
|
-
# Move object into position. Use 3rd through 12th parameters to specify the
|
71
|
-
# material property. Draw a teapot.
|
72
|
-
def renderTeapot(x, y, ambr, ambg, ambb, difr, difg, difb, specr, specg, specb, shine)
|
73
|
-
mat = []
|
74
|
-
glPushMatrix()
|
75
|
-
glTranslate(x, y, 0.0)
|
76
|
-
mat[0] = ambr
|
77
|
-
mat[1] = ambg
|
78
|
-
mat[2] = ambb
|
79
|
-
mat[3] = 1.0
|
80
|
-
glMaterial(GL_FRONT, GL_AMBIENT, mat)
|
81
|
-
mat[0] = difr
|
82
|
-
mat[1] = difg
|
83
|
-
mat[2] = difb
|
84
|
-
glMaterial(GL_FRONT, GL_DIFFUSE, mat)
|
85
|
-
mat[0] = specr
|
86
|
-
mat[1] = specg
|
87
|
-
mat[2] = specb
|
88
|
-
glMaterial(GL_FRONT, GL_SPECULAR, mat)
|
89
|
-
glMaterial(GL_FRONT, GL_SHININESS, shine * 128.0)
|
90
|
-
glutSolidTeapot(1.0)
|
91
|
-
glPopMatrix()
|
92
|
-
end
|
93
|
-
|
94
|
-
# First column: emerald, jade, obsidian, pearl, ruby, turquoise
|
95
|
-
# 2nd column: brass, bronze, chrome, copper, gold, silver
|
96
|
-
# 3rd column: black, cyan, green, red, white, yellow plastic
|
97
|
-
# 4th column: black, cyan, green, red, white, yellow rubber
|
98
|
-
display = proc do
|
99
|
-
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
100
|
-
renderTeapot(2.0, 17.0, 0.0215, 0.1745, 0.0215,
|
101
|
-
0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6)
|
102
|
-
renderTeapot(2.0, 14.0, 0.135, 0.2225, 0.1575,
|
103
|
-
0.54, 0.89, 0.63, 0.316228, 0.316228, 0.316228, 0.1)
|
104
|
-
renderTeapot(2.0, 11.0, 0.05375, 0.05, 0.06625,
|
105
|
-
0.18275, 0.17, 0.22525, 0.332741, 0.328634, 0.346435, 0.3)
|
106
|
-
renderTeapot(2.0, 8.0, 0.25, 0.20725, 0.20725,
|
107
|
-
1, 0.829, 0.829, 0.296648, 0.296648, 0.296648, 0.088)
|
108
|
-
renderTeapot(2.0, 5.0, 0.1745, 0.01175, 0.01175,
|
109
|
-
0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 0.6)
|
110
|
-
renderTeapot(2.0, 2.0, 0.1, 0.18725, 0.1745,
|
111
|
-
0.396, 0.74151, 0.69102, 0.297254, 0.30829, 0.306678, 0.1)
|
112
|
-
renderTeapot(6.0, 17.0, 0.329412, 0.223529, 0.027451,
|
113
|
-
0.780392, 0.568627, 0.113725, 0.992157, 0.941176, 0.807843,
|
114
|
-
0.21794872)
|
115
|
-
renderTeapot(6.0, 14.0, 0.2125, 0.1275, 0.054,
|
116
|
-
0.714, 0.4284, 0.18144, 0.393548, 0.271906, 0.166721, 0.2)
|
117
|
-
renderTeapot(6.0, 11.0, 0.25, 0.25, 0.25,
|
118
|
-
0.4, 0.4, 0.4, 0.774597, 0.774597, 0.774597, 0.6)
|
119
|
-
renderTeapot(6.0, 8.0, 0.19125, 0.0735, 0.0225,
|
120
|
-
0.7038, 0.27048, 0.0828, 0.256777, 0.137622, 0.086014, 0.1)
|
121
|
-
renderTeapot(6.0, 5.0, 0.24725, 0.1995, 0.0745,
|
122
|
-
0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4)
|
123
|
-
renderTeapot(6.0, 2.0, 0.19225, 0.19225, 0.19225,
|
124
|
-
0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4)
|
125
|
-
renderTeapot(10.0, 17.0, 0.0, 0.0, 0.0, 0.01, 0.01, 0.01,
|
126
|
-
0.50, 0.50, 0.50, 0.25)
|
127
|
-
renderTeapot(10.0, 14.0, 0.0, 0.1, 0.06, 0.0, 0.50980392, 0.50980392,
|
128
|
-
0.50196078, 0.50196078, 0.50196078, 0.25)
|
129
|
-
renderTeapot(10.0, 11.0, 0.0, 0.0, 0.0,
|
130
|
-
0.1, 0.35, 0.1, 0.45, 0.55, 0.45, 0.25)
|
131
|
-
renderTeapot(10.0, 8.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0,
|
132
|
-
0.7, 0.6, 0.6, 0.25)
|
133
|
-
renderTeapot(10.0, 5.0, 0.0, 0.0, 0.0, 0.55, 0.55, 0.55,
|
134
|
-
0.70, 0.70, 0.70, 0.25)
|
135
|
-
renderTeapot(10.0, 2.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0,
|
136
|
-
0.60, 0.60, 0.50, 0.25)
|
137
|
-
renderTeapot(14.0, 17.0, 0.02, 0.02, 0.02, 0.01, 0.01, 0.01,
|
138
|
-
0.4, 0.4, 0.4, 0.078125)
|
139
|
-
renderTeapot(14.0, 14.0, 0.0, 0.05, 0.05, 0.4, 0.5, 0.5,
|
140
|
-
0.04, 0.7, 0.7, 0.078125)
|
141
|
-
renderTeapot(14.0, 11.0, 0.0, 0.05, 0.0, 0.4, 0.5, 0.4,
|
142
|
-
0.04, 0.7, 0.04, 0.078125)
|
143
|
-
renderTeapot(14.0, 8.0, 0.05, 0.0, 0.0, 0.5, 0.4, 0.4,
|
144
|
-
0.7, 0.04, 0.04, 0.078125)
|
145
|
-
renderTeapot(14.0, 5.0, 0.05, 0.05, 0.05, 0.5, 0.5, 0.5,
|
146
|
-
0.7, 0.7, 0.7, 0.078125)
|
147
|
-
renderTeapot(14.0, 2.0, 0.05, 0.05, 0.0, 0.5, 0.5, 0.4,
|
148
|
-
0.7, 0.7, 0.04, 0.078125)
|
149
|
-
glutSwapBuffers()
|
150
|
-
end
|
151
|
-
|
152
|
-
myReshape = proc do |w, h|
|
153
|
-
glViewport(0, 0, w, h)
|
154
|
-
glMatrixMode(GL_PROJECTION)
|
155
|
-
glLoadIdentity()
|
156
|
-
if (w <= h)
|
157
|
-
glOrtho(0.0, 16.0, 0.0, 16.0 * h.to_f / w, -10.0, 10.0)
|
158
|
-
else
|
159
|
-
glOrtho(0.0, 16.0 * w.to_f / h, 0.0, 16.0,-10.0, 10.0)
|
160
|
-
end
|
161
|
-
glMatrixMode(GL_MODELVIEW)
|
162
|
-
end
|
163
|
-
|
164
|
-
keyboard = Proc.new do |key, x, y|
|
165
|
-
case (key)
|
166
|
-
when ?\e
|
167
|
-
exit(0);
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
# Main Loop Open window with initial window size, title bar, RGBA display
|
172
|
-
# mode, and handle input events.
|
173
|
-
glutInit()
|
174
|
-
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
|
175
|
-
glutInitWindowSize(500, 500)
|
176
|
-
glutInitWindowPosition(100, 100)
|
177
|
-
glutCreateWindow()
|
178
|
-
myinit()
|
179
|
-
glutReshapeFunc(myReshape)
|
180
|
-
glutDisplayFunc(display)
|
181
|
-
glutKeyboardFunc(keyboard)
|
182
|
-
glutMainLoop()
|
data/examples/RedBook/tess.rb
DELETED
@@ -1,183 +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
|
-
# tess.c
|
38
|
-
# This program demonstrates polygon tessellation.
|
39
|
-
# Two tesselated objects are drawn. The first is a
|
40
|
-
# rectangle with a triangular hole. The second is a
|
41
|
-
# smooth shaded, self-intersecting star.
|
42
|
-
#
|
43
|
-
# Note the exterior rectangle is drawn with its vertices
|
44
|
-
# in counter-clockwise order, but its interior clockwise.
|
45
|
-
# Note the combineCallback is needed for the self-intersecting
|
46
|
-
# star. Also note that removing the TessProperty for the
|
47
|
-
# star will make the interior unshaded (WINDING_ODD).
|
48
|
-
require 'opengl'
|
49
|
-
include Gl,Glu,Glut
|
50
|
-
|
51
|
-
$startList = nil
|
52
|
-
|
53
|
-
display = proc do
|
54
|
-
glClear(GL_COLOR_BUFFER_BIT)
|
55
|
-
glColor(1.0, 1.0, 1.0)
|
56
|
-
glCallList($startList)
|
57
|
-
glCallList($startList + 1)
|
58
|
-
glutSwapBuffers()
|
59
|
-
end
|
60
|
-
|
61
|
-
$beginCallback = proc do |which|
|
62
|
-
glBegin(which)
|
63
|
-
end
|
64
|
-
|
65
|
-
$errorCallback = proc do |errorCode|
|
66
|
-
print "Tessellation Error: #{gluErrorString(errorCode)}"
|
67
|
-
exit(0)
|
68
|
-
end
|
69
|
-
|
70
|
-
$endCallback = proc do
|
71
|
-
glEnd()
|
72
|
-
end
|
73
|
-
|
74
|
-
$vertexCallback = proc do |vertex|
|
75
|
-
glColor(vertex[3], vertex[4], vertex[5])
|
76
|
-
glVertex(vertex[0], vertex[1], vertex[2])
|
77
|
-
end
|
78
|
-
|
79
|
-
# combineCallback is used to create a new vertex when edges
|
80
|
-
# intersect. coordinate location is trivial to calculate,
|
81
|
-
# but weight[4] may be used to average color, normal, or texture
|
82
|
-
# coordinate data. In this program, color is weighted.
|
83
|
-
$combineCallback = proc do |coords, vertex_data, weight|
|
84
|
-
vertex = []
|
85
|
-
vertex[0] = coords[0]
|
86
|
-
vertex[1] = coords[1]
|
87
|
-
vertex[2] = coords[2]
|
88
|
-
for i in 3...6
|
89
|
-
vertex[i] = weight[0] * vertex_data[0][i] + weight[1] * vertex_data[1][i] + weight[2] * vertex_data[2][i] + weight[3] * vertex_data[3][i]
|
90
|
-
end
|
91
|
-
vertex
|
92
|
-
end
|
93
|
-
|
94
|
-
def init
|
95
|
-
rect = [[50.0, 50.0, 0.0],
|
96
|
-
[200.0, 50.0, 0.0],
|
97
|
-
[200.0, 200.0, 0.0],
|
98
|
-
[50.0, 200.0, 0.0]]
|
99
|
-
tri = [[75.0, 75.0, 0.0],
|
100
|
-
[125.0, 175.0, 0.0],
|
101
|
-
[175.0, 75.0, 0.0]]
|
102
|
-
star= [[250.0, 50.0, 0.0, 1.0, 0.0, 1.0],
|
103
|
-
[325.0, 200.0, 0.0, 1.0, 1.0, 0.0],
|
104
|
-
[400.0, 50.0, 0.0, 0.0, 1.0, 1.0],
|
105
|
-
[250.0, 150.0, 0.0, 1.0, 0.0, 0.0],
|
106
|
-
[400.0, 150.0, 0.0, 0.0, 1.0, 0.0]]
|
107
|
-
|
108
|
-
glClearColor(0.0, 0.0, 0.0, 0.0)
|
109
|
-
|
110
|
-
$startList = glGenLists(2)
|
111
|
-
|
112
|
-
tobj = gluNewTess()
|
113
|
-
gluTessCallback(tobj, GLU_TESS_VERTEX, proc do |v| glVertex(v) end )
|
114
|
-
gluTessCallback(tobj, GLU_TESS_BEGIN, $beginCallback)
|
115
|
-
gluTessCallback(tobj, GLU_TESS_END, $endCallback)
|
116
|
-
gluTessCallback(tobj, GLU_TESS_ERROR, $errorCallback)
|
117
|
-
|
118
|
-
# rectangle with triangular hole inside
|
119
|
-
glNewList($startList, GL_COMPILE)
|
120
|
-
glShadeModel(GL_FLAT)
|
121
|
-
gluTessBeginPolygon(tobj, nil)
|
122
|
-
gluTessBeginContour(tobj)
|
123
|
-
gluTessVertex(tobj, rect[0], rect[0])
|
124
|
-
gluTessVertex(tobj, rect[1], rect[1])
|
125
|
-
gluTessVertex(tobj, rect[2], rect[2])
|
126
|
-
gluTessVertex(tobj, rect[3], rect[3])
|
127
|
-
gluTessEndContour(tobj)
|
128
|
-
gluTessBeginContour(tobj)
|
129
|
-
gluTessVertex(tobj, tri[0], tri[0])
|
130
|
-
gluTessVertex(tobj, tri[1], tri[1])
|
131
|
-
gluTessVertex(tobj, tri[2], tri[2])
|
132
|
-
gluTessEndContour(tobj)
|
133
|
-
gluTessEndPolygon(tobj)
|
134
|
-
glEndList()
|
135
|
-
|
136
|
-
gluTessCallback(tobj, GLU_TESS_VERTEX, $vertexCallback)
|
137
|
-
gluTessCallback(tobj, GLU_TESS_BEGIN, $beginCallback)
|
138
|
-
gluTessCallback(tobj, GLU_TESS_END, $endCallback)
|
139
|
-
gluTessCallback(tobj, GLU_TESS_ERROR, $errorCallback)
|
140
|
-
gluTessCallback(tobj, GLU_TESS_COMBINE, $combineCallback)
|
141
|
-
|
142
|
-
|
143
|
-
# smooth shaded, self-intersecting star
|
144
|
-
glNewList($startList + 1, GL_COMPILE)
|
145
|
-
glShadeModel(GL_SMOOTH)
|
146
|
-
gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE)
|
147
|
-
gluTessBeginPolygon(tobj, nil)
|
148
|
-
gluTessBeginContour(tobj)
|
149
|
-
gluTessVertex(tobj, star[0], star[0])
|
150
|
-
gluTessVertex(tobj, star[1], star[1])
|
151
|
-
gluTessVertex(tobj, star[2], star[2])
|
152
|
-
gluTessVertex(tobj, star[3], star[3])
|
153
|
-
gluTessVertex(tobj, star[4], star[4])
|
154
|
-
gluTessEndContour(tobj)
|
155
|
-
gluTessEndPolygon(tobj)
|
156
|
-
glEndList()
|
157
|
-
gluDeleteTess(tobj)
|
158
|
-
end
|
159
|
-
|
160
|
-
reshape = proc do |w, h|
|
161
|
-
glViewport(0, 0, w, h)
|
162
|
-
glMatrixMode(GL_PROJECTION)
|
163
|
-
glLoadIdentity()
|
164
|
-
gluOrtho2D(0.0, w, 0.0, h)
|
165
|
-
end
|
166
|
-
|
167
|
-
keyboard = proc do |key, x, y|
|
168
|
-
case (key)
|
169
|
-
when ?\e
|
170
|
-
exit(0)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
glutInit()
|
175
|
-
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
|
176
|
-
glutInitWindowSize(500, 500)
|
177
|
-
glutInitWindowPosition(100, 100)
|
178
|
-
glutCreateWindow()
|
179
|
-
init()
|
180
|
-
glutDisplayFunc(display)
|
181
|
-
glutReshapeFunc(reshape)
|
182
|
-
glutKeyboardFunc(keyboard)
|
183
|
-
glutMainLoop()
|