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.
Files changed (154) hide show
  1. data/Rakefile +2 -2
  2. data/doc/build_install.txt +48 -28
  3. data/doc/extensions.txt +361 -0
  4. data/doc/history.txt +8 -2
  5. data/doc/requirements_and_design.txt +0 -13
  6. data/doc/roadmap.txt +11 -13
  7. data/doc/supplies/page_template.html +11 -5
  8. data/doc/thanks.txt +2 -4
  9. data/doc/tutorial.txt +1 -4
  10. data/examples/{nehe_lesson02.rb → NeHe/nehe_lesson02.rb} +0 -0
  11. data/examples/{nehe_lesson03.rb → NeHe/nehe_lesson03.rb} +0 -0
  12. data/examples/{nehe_lesson04.rb → NeHe/nehe_lesson04.rb} +0 -0
  13. data/examples/{nehe_lesson05.rb → NeHe/nehe_lesson05.rb} +0 -0
  14. data/examples/NeHe/nehe_lesson36.rb +303 -0
  15. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  16. data/examples/OrangeBook/brick.frag +36 -0
  17. data/examples/OrangeBook/brick.rb +388 -0
  18. data/examples/OrangeBook/brick.vert +41 -0
  19. data/examples/OrangeBook/particle.frag +17 -0
  20. data/examples/OrangeBook/particle.rb +424 -0
  21. data/examples/OrangeBook/particle.vert +38 -0
  22. data/examples/README +13 -83
  23. data/examples/RedBook/aaindex.rb +97 -0
  24. data/examples/RedBook/aapoly.rb +142 -0
  25. data/examples/RedBook/aargb.rb +119 -0
  26. data/examples/RedBook/accanti.rb +162 -0
  27. data/examples/RedBook/accpersp.rb +215 -0
  28. data/examples/RedBook/alpha.rb +123 -0
  29. data/examples/RedBook/alpha3D.rb +158 -0
  30. data/examples/RedBook/bezcurve.rb +105 -0
  31. data/examples/RedBook/bezmesh.rb +137 -0
  32. data/examples/RedBook/checker.rb +124 -0
  33. data/examples/RedBook/clip.rb +95 -0
  34. data/examples/RedBook/colormat.rb +135 -0
  35. data/examples/RedBook/cube.rb +69 -0
  36. data/examples/RedBook/depthcue.rb +99 -0
  37. data/examples/RedBook/dof.rb +205 -0
  38. data/examples/{legacy → RedBook}/double.rb +59 -58
  39. data/examples/{legacy → RedBook}/drawf.rb +47 -54
  40. data/examples/RedBook/feedback.rb +145 -0
  41. data/examples/RedBook/fog.rb +167 -0
  42. data/examples/RedBook/font.rb +151 -0
  43. data/examples/RedBook/hello.rb +79 -0
  44. data/examples/RedBook/image.rb +137 -0
  45. data/examples/{legacy → RedBook}/jitter.rb +60 -62
  46. data/examples/RedBook/lines.rb +128 -0
  47. data/examples/RedBook/list.rb +111 -0
  48. data/examples/RedBook/material.rb +275 -0
  49. data/examples/RedBook/mipmap.rb +156 -0
  50. data/examples/{legacy → RedBook}/model.rb +66 -72
  51. data/examples/{legacy → RedBook}/movelight.rb +67 -75
  52. data/examples/RedBook/pickdepth.rb +179 -0
  53. data/examples/{legacy → RedBook}/planet.rb +62 -66
  54. data/examples/RedBook/quadric.rb +158 -0
  55. data/examples/RedBook/robot.rb +115 -0
  56. data/examples/RedBook/select.rb +196 -0
  57. data/examples/RedBook/smooth.rb +95 -0
  58. data/examples/RedBook/stencil.rb +163 -0
  59. data/examples/RedBook/stroke.rb +167 -0
  60. data/examples/RedBook/surface.rb +166 -0
  61. data/examples/RedBook/teaambient.rb +132 -0
  62. data/examples/RedBook/teapots.rb +182 -0
  63. data/examples/RedBook/tess.rb +183 -0
  64. data/examples/RedBook/texbind.rb +147 -0
  65. data/examples/RedBook/texgen.rb +169 -0
  66. data/examples/RedBook/texturesurf.rb +128 -0
  67. data/examples/RedBook/varray.rb +159 -0
  68. data/examples/RedBook/wrap.rb +148 -0
  69. data/examples/misc/anisotropic.rb +194 -0
  70. data/examples/misc/font-glut.rb +46 -0
  71. data/examples/{plane.rb → misc/plane.rb} +0 -0
  72. data/examples/misc/readpixel.rb +65 -0
  73. data/examples/{smooth.rb → misc/smooth.rb} +0 -0
  74. data/examples/{test.rb → misc/test.rb} +0 -0
  75. data/ext/common/common.h +252 -70
  76. data/ext/common/gl-enums.h +6102 -7334
  77. data/ext/common/gl-types.h +47 -0
  78. data/ext/common/glu-enums.h +469 -0
  79. data/ext/gl/gl-1.0-1.1.c +842 -2464
  80. data/ext/gl/gl-1.2.c +217 -281
  81. data/ext/gl/gl-1.3.c +113 -133
  82. data/ext/gl/gl-1.4.c +98 -334
  83. data/ext/gl/gl-1.5.c +28 -34
  84. data/ext/gl/gl-2.0.c +26 -235
  85. data/ext/gl/gl-2.1.c +31 -124
  86. data/ext/gl/gl-enums.c +786 -631
  87. data/ext/gl/gl-ext-arb.c +66 -0
  88. data/ext/gl/gl-ext-ext.c +218 -0
  89. data/ext/gl/gl.c +138 -31
  90. data/ext/gl/mkrf_conf.rb +1 -0
  91. data/ext/glu/glu-enums.c +163 -0
  92. data/ext/glu/glu.c +1003 -1205
  93. data/ext/glu/mkrf_conf.rb +1 -0
  94. data/ext/glut/glut.c +1056 -1175
  95. data/lib/opengl.rb +90 -3
  96. data/test/tc_common.rb +26 -13
  97. data/test/tc_ext_arb.rb +73 -0
  98. data/test/tc_ext_ext.rb +74 -0
  99. data/test/tc_func_12.rb +8 -8
  100. data/test/tc_func_13.rb +17 -11
  101. data/test/tc_func_14.rb +8 -8
  102. data/test/tc_func_15.rb +190 -2
  103. data/test/tc_func_20.rb +36 -10
  104. data/test/tc_func_21.rb +445 -2
  105. data/test/tc_glu.rb +305 -0
  106. data/test/tc_misc.rb +1 -0
  107. metadata +84 -68
  108. data/doc/screenshots.txt +0 -23
  109. data/examples/legacy/COPYRIGHT +0 -8
  110. data/examples/legacy/aaindex.rb +0 -98
  111. data/examples/legacy/aapoly.rb +0 -153
  112. data/examples/legacy/aargb.rb +0 -139
  113. data/examples/legacy/accanti.rb +0 -159
  114. data/examples/legacy/accpersp.rb +0 -216
  115. data/examples/legacy/alpha.rb +0 -133
  116. data/examples/legacy/alpha3D.rb +0 -165
  117. data/examples/legacy/bezcurve.rb +0 -107
  118. data/examples/legacy/bezmesh.rb +0 -131
  119. data/examples/legacy/checker.rb +0 -121
  120. data/examples/legacy/clip.rb +0 -104
  121. data/examples/legacy/colormat.rb +0 -145
  122. data/examples/legacy/cube.rb +0 -73
  123. data/examples/legacy/depthcue.rb +0 -101
  124. data/examples/legacy/dof.rb +0 -212
  125. data/examples/legacy/feedback.rb +0 -152
  126. data/examples/legacy/fog.rb +0 -172
  127. data/examples/legacy/font-glut.rb +0 -41
  128. data/examples/legacy/font.rb +0 -158
  129. data/examples/legacy/hello.rb +0 -75
  130. data/examples/legacy/image.rb +0 -145
  131. data/examples/legacy/lines.rb +0 -135
  132. data/examples/legacy/list.rb +0 -120
  133. data/examples/legacy/material.rb +0 -290
  134. data/examples/legacy/mipmap.rb +0 -159
  135. data/examples/legacy/pickdepth.rb +0 -180
  136. data/examples/legacy/quadric.rb +0 -180
  137. data/examples/legacy/readpixel.rb +0 -59
  138. data/examples/legacy/robot.rb +0 -120
  139. data/examples/legacy/select.rb +0 -207
  140. data/examples/legacy/smooth.rb +0 -41
  141. data/examples/legacy/stencil.rb +0 -154
  142. data/examples/legacy/stroke.rb +0 -170
  143. data/examples/legacy/surface.rb +0 -170
  144. data/examples/legacy/teaambient.rb +0 -132
  145. data/examples/legacy/teapots.rb +0 -188
  146. data/examples/legacy/tess.rb +0 -222
  147. data/examples/legacy/texbind.rb +0 -157
  148. data/examples/legacy/texgen.rb +0 -171
  149. data/examples/legacy/texturesurf.rb +0 -128
  150. data/examples/legacy/varray.rb +0 -167
  151. data/examples/legacy/wrap.rb +0 -158
  152. data/lib/gl_prev.rb +0 -46
  153. data/lib/glu_prev.rb +0 -46
  154. data/lib/glut_prev.rb +0 -45
@@ -1,132 +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
- # * teaambient.c
42
- # * This program renders three lighted, shaded teapots, with
43
- # * different ambient values.
44
- # */
45
-
46
- require "gl_prev"
47
- require "glu_prev"
48
- require "glut_prev"
49
-
50
- #/* Initialize light source and lighting model.
51
- # */
52
- def myinit
53
- light_ambient = [0.0, 0.0, 0.0, 1.0];
54
- light_diffuse = [1.0, 1.0, 1.0, 1.0];
55
- light_specular = [1.0, 1.0, 1.0, 1.0];
56
- #/* light_position is NOT default value */
57
- light_position = [1.0, 0.0, 0.0, 0.0];
58
- global_ambient = [0.75, 0.75, 0.75, 1.0];
59
-
60
- GL::Light(GL::LIGHT0, GL::AMBIENT, light_ambient);
61
- GL::Light(GL::LIGHT0, GL::DIFFUSE, light_diffuse);
62
- GL::Light(GL::LIGHT0, GL::SPECULAR, light_specular);
63
- GL::Light(GL::LIGHT0, GL::POSITION, light_position);
64
-
65
- GL::LightModel(GL::LIGHT_MODEL_AMBIENT, global_ambient);
66
-
67
- GL::FrontFace(GL::CW);
68
- GL::Enable(GL::LIGHTING);
69
- GL::Enable(GL::LIGHT0);
70
- GL::Enable(GL::AUTO_NORMAL);
71
- GL::Enable(GL::NORMALIZE);
72
- GL::DepthFunc(GL::LESS);
73
- GL::Enable(GL::DEPTH_TEST);
74
- end
75
-
76
- display = proc {
77
- low_ambient = [0.1, 0.1, 0.1, 1.0];
78
- more_ambient = [0.4, 0.4, 0.4, 1.0];
79
- most_ambient = [1.0, 1.0, 1.0, 1.0];
80
-
81
- GL::Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
82
-
83
- # /* material has small ambient reflection */
84
- GL::Material(GL::FRONT, GL::AMBIENT, low_ambient);
85
- GL::Material(GL::FRONT, GL::SHININESS, 40.0);
86
- GL::PushMatrix();
87
- GL::Translate(0.0, 2.0, 0.0);
88
- GLUT::SolidTeapot(1.0);
89
- GL::PopMatrix();
90
-
91
- # /* material has moderate ambient reflection */
92
- GL::Material(GL::FRONT, GL::AMBIENT, more_ambient);
93
- GL::PushMatrix();
94
- GL::Translate(0.0, 0.0, 0.0);
95
- GLUT::SolidTeapot(1.0);
96
- GL::PopMatrix();
97
-
98
- # /* material has large ambient reflection */
99
- GL::Material(GL::FRONT, GL::AMBIENT, most_ambient);
100
- GL::PushMatrix();
101
- GL::Translate(0.0, -2.0, 0.0);
102
- GLUT::SolidTeapot(1.0);
103
- GL::PopMatrix();
104
- GL::Flush();
105
- }
106
-
107
- myReshape = proc {|w, h|
108
- GL::Viewport(0, 0, w, h);
109
- GL::MatrixMode(GL::PROJECTION);
110
- GL::LoadIdentity();
111
- if (w <= h)
112
- GL::Ortho(-4.0, 4.0, -4.0 * h / w,
113
- 4.0 * h / w, -10.0, 10.0);
114
- else
115
- GL::Ortho(-4.0 * w / h,
116
- 4.0 * w / h, -4.0, 4.0, -10.0, 10.0);
117
- end
118
- GL::MatrixMode(GL::MODELVIEW);
119
- }
120
-
121
- #/* Main Loop
122
- # * Open window with initial window size, title bar,
123
- # * RGBA display mode, and handle input events.
124
- # */
125
- GLUT::Init();
126
- GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::DEPTH);
127
- GLUT::InitWindowSize(500, 500);
128
- GLUT::CreateWindow();
129
- myinit();
130
- GLUT::ReshapeFunc(myReshape);
131
- GLUT::DisplayFunc(display);
132
- GLUT::MainLoop();
@@ -1,188 +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
- # * teapots.c
42
- # * This program demonstrates lots of material properties.
43
- # * A single light source illuminates the objects.
44
- # */
45
- require "gl_prev"
46
- require "glu_prev"
47
- require "glut_prev"
48
-
49
- #/*
50
- # * Initialize depth buffer, projection matrix, light source, and lighting
51
- # * model. Do not specify a material property here.
52
- # */
53
- def myinit
54
- ambient = [0.0, 0.0, 0.0, 1.0];
55
- diffuse = [1.0, 1.0, 1.0, 1.0];
56
- position = [0.0, 3.0, 3.0, 0.0];
57
-
58
- lmodel_ambient = [0.2, 0.2, 0.2, 1.0];
59
- local_view = [0.0];
60
-
61
- GL::Light(GL::LIGHT0, GL::AMBIENT, ambient);
62
- GL::Light(GL::LIGHT0, GL::DIFFUSE, diffuse);
63
- GL::Light(GL::LIGHT0, GL::POSITION, position);
64
- GL::LightModel(GL::LIGHT_MODEL_AMBIENT, lmodel_ambient);
65
- GL::LightModel(GL::LIGHT_MODEL_LOCAL_VIEWER, local_view);
66
-
67
- GL::FrontFace(GL::CW);
68
- GL::Enable(GL::LIGHTING);
69
- GL::Enable(GL::LIGHT0);
70
- GL::Enable(GL::AUTO_NORMAL);
71
- GL::Enable(GL::NORMALIZE);
72
- GL::Enable(GL::DEPTH_TEST);
73
- GL::DepthFunc(GL::LESS);
74
- end
75
-
76
- #/*
77
- # * Move object into position. Use 3rd through 12th parameters to specify the
78
- # * material property. Draw a teapot.
79
- # */
80
- def renderTeapot(x, y, ambr, ambg, ambb, difr, difg, difb, specr, specg, specb, shine)
81
- mat = [];
82
-
83
- GL::PushMatrix();
84
- GL::Translate(x, y, 0.0);
85
- mat[0] = ambr;
86
- mat[1] = ambg;
87
- mat[2] = ambb;
88
- mat[3] = 1.0;
89
- GL::Material(GL::FRONT, GL::AMBIENT, mat);
90
- mat[0] = difr;
91
- mat[1] = difg;
92
- mat[2] = difb;
93
- GL::Material(GL::FRONT, GL::DIFFUSE, mat);
94
- mat[0] = specr;
95
- mat[1] = specg;
96
- mat[2] = specb;
97
- GL::Material(GL::FRONT, GL::SPECULAR, mat);
98
- GL::Material(GL::FRONT, GL::SHININESS, shine * 128.0);
99
- GLUT::SolidTeapot(1.0);
100
- GL::PopMatrix();
101
- end
102
-
103
- #/**
104
- # * First column: emerald, jade, obsidian, pearl, ruby, turquoise
105
- # * 2nd column: brass, bronze, chrome, copper, gold, silver
106
- # * 3rd column: black, cyan, green, red, white, yellow plastic
107
- # * 4th column: black, cyan, green, red, white, yellow rubber
108
- # */
109
- display = proc {
110
- GL::Clear(GL::COLOR_BUFFER_BIT | GL::DEPTH_BUFFER_BIT);
111
- renderTeapot(2.0, 17.0, 0.0215, 0.1745, 0.0215,
112
- 0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6);
113
- renderTeapot(2.0, 14.0, 0.135, 0.2225, 0.1575,
114
- 0.54, 0.89, 0.63, 0.316228, 0.316228, 0.316228, 0.1);
115
- renderTeapot(2.0, 11.0, 0.05375, 0.05, 0.06625,
116
- 0.18275, 0.17, 0.22525, 0.332741, 0.328634, 0.346435, 0.3);
117
- renderTeapot(2.0, 8.0, 0.25, 0.20725, 0.20725,
118
- 1, 0.829, 0.829, 0.296648, 0.296648, 0.296648, 0.088);
119
- renderTeapot(2.0, 5.0, 0.1745, 0.01175, 0.01175,
120
- 0.61424, 0.04136, 0.04136, 0.727811, 0.626959, 0.626959, 0.6);
121
- renderTeapot(2.0, 2.0, 0.1, 0.18725, 0.1745,
122
- 0.396, 0.74151, 0.69102, 0.297254, 0.30829, 0.306678, 0.1);
123
- renderTeapot(6.0, 17.0, 0.329412, 0.223529, 0.027451,
124
- 0.780392, 0.568627, 0.113725, 0.992157, 0.941176, 0.807843,
125
- 0.21794872);
126
- renderTeapot(6.0, 14.0, 0.2125, 0.1275, 0.054,
127
- 0.714, 0.4284, 0.18144, 0.393548, 0.271906, 0.166721, 0.2);
128
- renderTeapot(6.0, 11.0, 0.25, 0.25, 0.25,
129
- 0.4, 0.4, 0.4, 0.774597, 0.774597, 0.774597, 0.6);
130
- renderTeapot(6.0, 8.0, 0.19125, 0.0735, 0.0225,
131
- 0.7038, 0.27048, 0.0828, 0.256777, 0.137622, 0.086014, 0.1);
132
- renderTeapot(6.0, 5.0, 0.24725, 0.1995, 0.0745,
133
- 0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4);
134
- renderTeapot(6.0, 2.0, 0.19225, 0.19225, 0.19225,
135
- 0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4);
136
- renderTeapot(10.0, 17.0, 0.0, 0.0, 0.0, 0.01, 0.01, 0.01,
137
- 0.50, 0.50, 0.50, 0.25);
138
- renderTeapot(10.0, 14.0, 0.0, 0.1, 0.06, 0.0, 0.50980392, 0.50980392,
139
- 0.50196078, 0.50196078, 0.50196078, 0.25);
140
- renderTeapot(10.0, 11.0, 0.0, 0.0, 0.0,
141
- 0.1, 0.35, 0.1, 0.45, 0.55, 0.45, 0.25);
142
- renderTeapot(10.0, 8.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0,
143
- 0.7, 0.6, 0.6, 0.25);
144
- renderTeapot(10.0, 5.0, 0.0, 0.0, 0.0, 0.55, 0.55, 0.55,
145
- 0.70, 0.70, 0.70, 0.25);
146
- renderTeapot(10.0, 2.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0,
147
- 0.60, 0.60, 0.50, 0.25);
148
- renderTeapot(14.0, 17.0, 0.02, 0.02, 0.02, 0.01, 0.01, 0.01,
149
- 0.4, 0.4, 0.4, 0.078125);
150
- renderTeapot(14.0, 14.0, 0.0, 0.05, 0.05, 0.4, 0.5, 0.5,
151
- 0.04, 0.7, 0.7, 0.078125);
152
- renderTeapot(14.0, 11.0, 0.0, 0.05, 0.0, 0.4, 0.5, 0.4,
153
- 0.04, 0.7, 0.04, 0.078125);
154
- renderTeapot(14.0, 8.0, 0.05, 0.0, 0.0, 0.5, 0.4, 0.4,
155
- 0.7, 0.04, 0.04, 0.078125);
156
- renderTeapot(14.0, 5.0, 0.05, 0.05, 0.05, 0.5, 0.5, 0.5,
157
- 0.7, 0.7, 0.7, 0.078125);
158
- renderTeapot(14.0, 2.0, 0.05, 0.05, 0.0, 0.5, 0.5, 0.4,
159
- 0.7, 0.7, 0.04, 0.078125);
160
- GL::Flush();
161
- }
162
-
163
- myReshape = proc {|w, h|
164
- GL::Viewport(0, 0, w, h);
165
- GL::MatrixMode(GL::PROJECTION);
166
- GL::LoadIdentity();
167
- if (w <= h)
168
- GL::Ortho(0.0, 16.0, 0.0, 16.0 * h.to_f / w,
169
- -10.0, 10.0);
170
- else
171
- GL::Ortho(0.0, 16.0 * w.to_f / h, 0.0, 16.0,
172
- -10.0, 10.0);
173
- end
174
- GL::MatrixMode(GL::MODELVIEW);
175
- }
176
-
177
- #/*
178
- # * Main Loop Open window with initial window size, title bar, RGBA display
179
- # * mode, and handle input events.
180
- # */
181
- GLUT::Init()
182
- GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB | GLUT::DEPTH);
183
- GLUT::CreateWindow()
184
- myinit();
185
- GLUT::ReshapeFunc(myReshape);
186
- GLUT::DisplayFunc(display);
187
- GLUT::MainLoop();
188
-
@@ -1,222 +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
- # * tess.c
40
- # * This program demonstrates polygon tessellation.
41
- # * Two tesselated objects are drawn. The first is a
42
- # * rectangle with a triangular hole. The second is a
43
- # * smooth shaded, self-intersecting star.
44
- # *
45
- # * Note the exterior rectangle is drawn with its vertices
46
- # * in counter-clockwise order, but its interior clockwise.
47
- # * Note the combineCallback is needed for the self-intersecting
48
- # * star. Also note that removing the TessProperty for the
49
- # * star will make the interior unshaded (WINDING_ODD).
50
- # */
51
-
52
- require "gl_prev"
53
- require "glu_prev"
54
- require "glut_prev"
55
-
56
- $startList = nil;
57
-
58
- display = proc {
59
- GL::Clear(GL::COLOR_BUFFER_BIT);
60
- GL::Color(1.0, 1.0, 1.0);
61
- GL::CallList($startList);
62
- GL::CallList($startList + 1);
63
- GL::Flush();
64
- }
65
-
66
- $beginCallback = proc {|which|
67
- GL::Begin(which);
68
- }
69
-
70
- $errorCallback = proc {|errorCode|
71
- print "Tessellation Error: #{GLU::ErrorString(errorCode)}";
72
- exit(0);
73
- }
74
-
75
- $endCallback = proc {
76
- GL::End();
77
- }
78
-
79
- $vertexCallback = proc {|vertex|
80
- GL::Color(vertex[3], vertex[4], vertex[5]);
81
- GL::Vertex(vertex[0], vertex[1], vertex[2]);
82
- }
83
-
84
- #/* combineCallback is used to create a new vertex when edges
85
- # * intersect. coordinate location is trivial to calculate,
86
- # * but weight[4] may be used to average color, normal, or texture
87
- # * coordinate data. In this program, color is weighted.
88
- # */
89
- $combineCallback = proc {|coords, vertex_data, weight|
90
- vertex = []
91
- vertex[0] = coords[0];
92
- vertex[1] = coords[1];
93
- vertex[2] = coords[2];
94
- for i in 3...6
95
- 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];
96
- end
97
- vertex
98
- }
99
-
100
- def init
101
- rect = [[50.0, 50.0, 0.0],
102
- [200.0, 50.0, 0.0],
103
- [200.0, 200.0, 0.0],
104
- [50.0, 200.0, 0.0]];
105
- tri = [[75.0, 75.0, 0.0],
106
- [125.0, 175.0, 0.0],
107
- [175.0, 75.0, 0.0]];
108
- star= [[250.0, 50.0, 0.0, 1.0, 0.0, 1.0],
109
- [325.0, 200.0, 0.0, 1.0, 1.0, 0.0],
110
- [400.0, 50.0, 0.0, 0.0, 1.0, 1.0],
111
- [250.0, 150.0, 0.0, 1.0, 0.0, 0.0],
112
- [400.0, 150.0, 0.0, 0.0, 1.0, 0.0]];
113
-
114
- GL::ClearColor(0.0, 0.0, 0.0, 0.0);
115
-
116
- $startList = GL::GenLists(2);
117
-
118
- tobj = GLU::NewTess();
119
- p "1"
120
- GLU::TessCallback(tobj, GLU::TESS_VERTEX,
121
- proc {|v| GL::Vertex(v)})
122
- p "2"
123
- GLU::TessCallback(tobj, GLU::TESS_BEGIN,
124
- $beginCallback);
125
- p "3"
126
- GLU::TessCallback(tobj, GLU::TESS_END,
127
- $endCallback);
128
- p "4"
129
- GLU::TessCallback(tobj, GLU::TESS_ERROR,
130
- $errorCallback);
131
-
132
- # /* rectangle with triangular hole inside */
133
- p "5"
134
- GL::NewList($startList, GL::COMPILE);
135
- GL::ShadeModel(GL::FLAT);
136
- GLU::TessBeginPolygon(tobj, nil);
137
- p "5.1"
138
- GLU::TessBeginContour(tobj);
139
- GLU::TessVertex(tobj, rect[0], rect[0]);
140
- GLU::TessVertex(tobj, rect[1], rect[1]);
141
- GLU::TessVertex(tobj, rect[2], rect[2]);
142
- GLU::TessVertex(tobj, rect[3], rect[3]);
143
- GLU::TessEndContour(tobj);
144
- GLU::TessEndPolygon(tobj);
145
- p "5.2"
146
- GLU::TessBeginPolygon(tobj, nil);
147
- GLU::TessBeginContour(tobj);
148
- GLU::TessVertex(tobj, tri[0], tri[0]);
149
- GLU::TessVertex(tobj, tri[1], tri[1]);
150
- GLU::TessVertex(tobj, tri[2], tri[2]);
151
- GLU::TessEndContour(tobj);
152
- p "5.3"
153
- GLU::TessEndPolygon(tobj);
154
- p "5.4"
155
- GL::EndList();
156
- p "6"
157
-
158
- GLU::TessCallback(tobj, GLU::TESS_VERTEX,
159
- $vertexCallback);
160
- p "7"
161
- GLU::TessCallback(tobj, GLU::TESS_BEGIN,
162
- $beginCallback);
163
- p "8"
164
- GLU::TessCallback(tobj, GLU::TESS_END,
165
- $endCallback);
166
- p "9"
167
- GLU::TessCallback(tobj, GLU::TESS_ERROR,
168
- $errorCallback);
169
- p "10"
170
- GLU::TessCallback(tobj, GLU::TESS_COMBINE,
171
- $combineCallback);
172
- p "11"
173
-
174
- # /* smooth shaded, self-intersecting star */
175
- GL::NewList($startList + 1, GL::COMPILE);
176
- GL::ShadeModel(GL::SMOOTH);
177
- p "12"
178
- GLU::TessProperty(tobj, GLU::TESS_WINDING_RULE,
179
- GLU::TESS_WINDING_POSITIVE);
180
- p "13"
181
- GLU::TessBeginPolygon(tobj, nil);
182
- p "13.1"
183
- GLU::TessBeginContour(tobj);
184
- GLU::TessVertex(tobj, star[0], star[0]);
185
- GLU::TessVertex(tobj, star[1], star[1]);
186
- GLU::TessVertex(tobj, star[2], star[2]);
187
- GLU::TessVertex(tobj, star[3], star[3]);
188
- GLU::TessVertex(tobj, star[4], star[4]);
189
- GLU::TessEndContour(tobj);
190
- p "13.2"
191
- #GLU::TessEndPolygon(tobj);
192
- p "14"
193
- GL::EndList();
194
- p "15"
195
- GLU::DeleteTess(tobj);
196
- p "16"
197
- end
198
-
199
- reshape = proc {|w, h|
200
- GL::Viewport(0, 0, w, h);
201
- GL::MatrixMode(GL::PROJECTION);
202
- GL::LoadIdentity();
203
- GLU::Ortho2D(0.0, w, 0.0, h);
204
- }
205
-
206
- #/* ARGSUSED1 */
207
- keyboard = proc {|key, x, y|
208
- case (key)
209
- when 27
210
- exit(0);
211
- end
212
- }
213
-
214
- GLUT::Init();
215
- GLUT::InitDisplayMode(GLUT::SINGLE | GLUT::RGB);
216
- GLUT::InitWindowSize(500, 500);
217
- GLUT::CreateWindow();
218
- init();
219
- GLUT::DisplayFunc(display);
220
- GLUT::ReshapeFunc(reshape);
221
- GLUT::KeyboardFunc(keyboard);
222
- GLUT::MainLoop();