ruby-opengl 0.60.1 → 0.61.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 (127) hide show
  1. metadata +36 -186
  2. data/Rakefile +0 -168
  3. data/doc/build_install.txt +0 -122
  4. data/doc/extensions.txt +0 -556
  5. data/doc/extensions.txt.in +0 -348
  6. data/doc/history.txt +0 -66
  7. data/doc/requirements_and_design.txt +0 -117
  8. data/doc/roadmap.txt +0 -28
  9. data/doc/scientific_use.txt +0 -35
  10. data/doc/supplies/page_template.html +0 -71
  11. data/doc/thanks.txt +0 -29
  12. data/doc/tutorial.txt +0 -469
  13. data/examples/NeHe/nehe_lesson02.rb +0 -117
  14. data/examples/NeHe/nehe_lesson03.rb +0 -122
  15. data/examples/NeHe/nehe_lesson04.rb +0 -133
  16. data/examples/NeHe/nehe_lesson05.rb +0 -186
  17. data/examples/NeHe/nehe_lesson36.rb +0 -303
  18. data/examples/OrangeBook/3Dlabs-License.txt +0 -33
  19. data/examples/OrangeBook/brick.frag +0 -36
  20. data/examples/OrangeBook/brick.rb +0 -376
  21. data/examples/OrangeBook/brick.vert +0 -41
  22. data/examples/OrangeBook/particle.frag +0 -17
  23. data/examples/OrangeBook/particle.rb +0 -406
  24. data/examples/OrangeBook/particle.vert +0 -38
  25. data/examples/README +0 -16
  26. data/examples/RedBook/aapoly.rb +0 -142
  27. data/examples/RedBook/aargb.rb +0 -119
  28. data/examples/RedBook/accanti.rb +0 -162
  29. data/examples/RedBook/accpersp.rb +0 -215
  30. data/examples/RedBook/alpha.rb +0 -123
  31. data/examples/RedBook/alpha3D.rb +0 -158
  32. data/examples/RedBook/bezcurve.rb +0 -105
  33. data/examples/RedBook/bezmesh.rb +0 -137
  34. data/examples/RedBook/checker.rb +0 -124
  35. data/examples/RedBook/clip.rb +0 -95
  36. data/examples/RedBook/colormat.rb +0 -135
  37. data/examples/RedBook/cube.rb +0 -69
  38. data/examples/RedBook/depthcue.rb +0 -99
  39. data/examples/RedBook/dof.rb +0 -205
  40. data/examples/RedBook/double.rb +0 -105
  41. data/examples/RedBook/drawf.rb +0 -91
  42. data/examples/RedBook/feedback.rb +0 -145
  43. data/examples/RedBook/fog.rb +0 -167
  44. data/examples/RedBook/font.rb +0 -151
  45. data/examples/RedBook/hello.rb +0 -79
  46. data/examples/RedBook/image.rb +0 -137
  47. data/examples/RedBook/jitter.rb +0 -207
  48. data/examples/RedBook/lines.rb +0 -128
  49. data/examples/RedBook/list.rb +0 -111
  50. data/examples/RedBook/material.rb +0 -275
  51. data/examples/RedBook/mipmap.rb +0 -156
  52. data/examples/RedBook/model.rb +0 -113
  53. data/examples/RedBook/movelight.rb +0 -132
  54. data/examples/RedBook/pickdepth.rb +0 -179
  55. data/examples/RedBook/planet.rb +0 -108
  56. data/examples/RedBook/quadric.rb +0 -158
  57. data/examples/RedBook/robot.rb +0 -115
  58. data/examples/RedBook/select.rb +0 -196
  59. data/examples/RedBook/smooth.rb +0 -95
  60. data/examples/RedBook/stencil.rb +0 -163
  61. data/examples/RedBook/stroke.rb +0 -167
  62. data/examples/RedBook/surface.rb +0 -166
  63. data/examples/RedBook/teaambient.rb +0 -132
  64. data/examples/RedBook/teapots.rb +0 -182
  65. data/examples/RedBook/tess.rb +0 -183
  66. data/examples/RedBook/texbind.rb +0 -147
  67. data/examples/RedBook/texgen.rb +0 -169
  68. data/examples/RedBook/texturesurf.rb +0 -128
  69. data/examples/RedBook/varray.rb +0 -159
  70. data/examples/RedBook/wrap.rb +0 -148
  71. data/examples/misc/OGLBench.rb +0 -337
  72. data/examples/misc/anisotropic.rb +0 -194
  73. data/examples/misc/fbo_test.rb +0 -356
  74. data/examples/misc/font-glut.rb +0 -46
  75. data/examples/misc/glfwtest.rb +0 -30
  76. data/examples/misc/plane.rb +0 -161
  77. data/examples/misc/readpixel.rb +0 -65
  78. data/examples/misc/sdltest.rb +0 -34
  79. data/examples/misc/trislam.rb +0 -828
  80. data/ext/common/common.h +0 -423
  81. data/ext/common/conv.h +0 -244
  82. data/ext/common/funcdef.h +0 -280
  83. data/ext/common/gl-enums.h +0 -10031
  84. data/ext/common/gl-error.h +0 -23
  85. data/ext/common/gl-types.h +0 -61
  86. data/ext/common/glu-enums.h +0 -463
  87. data/ext/gl/gl-1.0-1.1.c +0 -2817
  88. data/ext/gl/gl-1.2.c +0 -814
  89. data/ext/gl/gl-1.3.c +0 -444
  90. data/ext/gl/gl-1.4.c +0 -349
  91. data/ext/gl/gl-1.5.c +0 -225
  92. data/ext/gl/gl-2.0.c +0 -657
  93. data/ext/gl/gl-2.1.c +0 -57
  94. data/ext/gl/gl-enums.c +0 -3354
  95. data/ext/gl/gl-error.c +0 -104
  96. data/ext/gl/gl-ext-3dfx.c +0 -27
  97. data/ext/gl/gl-ext-arb.c +0 -866
  98. data/ext/gl/gl-ext-ati.c +0 -41
  99. data/ext/gl/gl-ext-ext.c +0 -890
  100. data/ext/gl/gl-ext-gremedy.c +0 -41
  101. data/ext/gl/gl-ext-nv.c +0 -679
  102. data/ext/gl/gl.c +0 -214
  103. data/ext/gl/mkrf_conf.rb +0 -34
  104. data/ext/glu/glu-enums.c +0 -164
  105. data/ext/glu/glu.c +0 -1530
  106. data/ext/glu/mkrf_conf.rb +0 -35
  107. data/ext/glut/glut.c +0 -1623
  108. data/ext/glut/mkrf_conf.rb +0 -37
  109. data/lib/opengl.rb +0 -84
  110. data/test/README +0 -10
  111. data/test/tc_common.rb +0 -98
  112. data/test/tc_ext_arb.rb +0 -467
  113. data/test/tc_ext_ati.rb +0 -33
  114. data/test/tc_ext_ext.rb +0 -551
  115. data/test/tc_ext_gremedy.rb +0 -36
  116. data/test/tc_ext_nv.rb +0 -357
  117. data/test/tc_func_10_11.rb +0 -1281
  118. data/test/tc_func_12.rb +0 -186
  119. data/test/tc_func_13.rb +0 -229
  120. data/test/tc_func_14.rb +0 -197
  121. data/test/tc_func_15.rb +0 -270
  122. data/test/tc_func_20.rb +0 -346
  123. data/test/tc_func_21.rb +0 -541
  124. data/test/tc_glu.rb +0 -310
  125. data/test/tc_include_gl.rb +0 -35
  126. data/test/tc_misc.rb +0 -54
  127. data/test/tc_require_gl.rb +0 -34
@@ -1,147 +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
- # texbind.c
39
- # This program demonstrates using glBindTexture() by
40
- # creating and managing two textures.
41
- require 'opengl'
42
- require 'mathn'
43
- include Gl,Glu,Glut
44
-
45
- CheckImageWidth = 64
46
- CheckImageHeight = 64
47
- $checkImage = []
48
- $otherImage = []
49
-
50
- $texName = []
51
-
52
- def makeCheckImages
53
- for i in (0..CheckImageHeight-1)
54
- for j in (0..CheckImageWidth-1)
55
- if ((i&0x8==0)!=(j&0x8==0)) then tmp = 1 else tmp=0 end
56
- #c = ((((i&0x8)==0)^((j&0x8))==0))*255
57
- c = tmp * 255
58
- $checkImage[i*CheckImageWidth*4+j*4+0] = c
59
- $checkImage[i*CheckImageWidth*4+j*4+1] = c
60
- $checkImage[i*CheckImageWidth*4+j*4+2] = c
61
- $checkImage[i*CheckImageWidth*4+j*4+3] = 255
62
- #c = ((((i&0x10)==0)^((j&0x10))==0))*255
63
- if ((i&0x10==0)!=(j&0x10==0)) then tmp = 1 else tmp=0 end
64
- c = tmp * 255
65
- $otherImage[i*CheckImageWidth*4+j*4+0] = c
66
- $otherImage[i*CheckImageWidth*4+j*4+1] = 0
67
- $otherImage[i*CheckImageWidth*4+j*4+2] = 0
68
- $otherImage[i*CheckImageWidth*4+j*4+3] = 255
69
- end
70
- end
71
- end
72
-
73
- def init
74
- glClearColor(0.0, 0.0, 0.0, 0.0)
75
- glShadeModel(GL_FLAT)
76
- glEnable(GL_DEPTH_TEST)
77
-
78
- makeCheckImages()
79
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
80
-
81
- $texName = glGenTextures(2)
82
- glBindTexture(GL_TEXTURE_2D, $texName[0])
83
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
84
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
85
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST)
86
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST)
87
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CheckImageWidth,
88
- CheckImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, $checkImage.pack("C*"))
89
-
90
- glBindTexture(GL_TEXTURE_2D, $texName[1])
91
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
92
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
93
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
94
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
95
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
96
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CheckImageWidth, CheckImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
97
- $otherImage.pack("C*"))
98
- glEnable(GL_TEXTURE_2D)
99
- end
100
-
101
- display = Proc.new do
102
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
103
- glBindTexture(GL_TEXTURE_2D, $texName[0])
104
- glBegin(GL_QUADS)
105
- glTexCoord(0.0, 0.0); glVertex(-2.0, -1.0, 0.0)
106
- glTexCoord(0.0, 1.0); glVertex(-2.0, 1.0, 0.0)
107
- glTexCoord(1.0, 1.0); glVertex(0.0, 1.0, 0.0)
108
- glTexCoord(1.0, 0.0); glVertex(0.0, -1.0, 0.0)
109
- glEnd()
110
- glBindTexture(GL_TEXTURE_2D, $texName[1])
111
- glBegin(GL_QUADS)
112
- glTexCoord(0.0, 0.0); glVertex(1.0, -1.0, 0.0)
113
- glTexCoord(0.0, 1.0); glVertex(1.0, 1.0, 0.0)
114
- glTexCoord(1.0, 1.0); glVertex(2.41421, 1.0, -1.41421)
115
- glTexCoord(1.0, 0.0); glVertex(2.41421, -1.0, -1.41421)
116
- glEnd()
117
- glutSwapBuffers()
118
- end
119
-
120
- reshape = Proc.new do |w, h|
121
- glViewport(0, 0, w, h)
122
- glMatrixMode(GL_PROJECTION)
123
- glLoadIdentity()
124
- gluPerspective(60.0, w/h, 1.0, 30.0)
125
- glMatrixMode(GL_MODELVIEW)
126
- glLoadIdentity()
127
- glTranslate(0.0, 0.0, -3.6)
128
- end
129
-
130
- keyboard = Proc.new do |key, x, y|
131
- case (key)
132
- when ?\e
133
- exit(0)
134
- end
135
- end
136
-
137
- # main
138
- glutInit
139
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
140
- glutInitWindowSize(500, 500)
141
- glutInitWindowPosition(100, 100)
142
- glutCreateWindow($0)
143
- init()
144
- glutReshapeFunc(reshape)
145
- glutDisplayFunc(display)
146
- glutKeyboardFunc(keyboard)
147
- glutMainLoop()
@@ -1,169 +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
- # texgen.c
38
- # This program draws a texture mapped teapot with
39
- # automatically generated texture coordinates. The
40
- # texture is rendered as stripes on the teapot.
41
- # Initially, the object is drawn with texture coordinates
42
- # based upon the object coordinates of the vertex
43
- # and distance from the plane x = 0. Pressing the 'e'
44
- # key changes the coordinate generation to eye coordinates
45
- # of the vertex. Pressing the 'o' key switches it back
46
- # to the object coordinates. Pressing the 's' key
47
- # changes the plane to a slanted one (x + y + z = 0).
48
- # Pressing the 'x' key switches it back to x = 0.
49
-
50
- require 'opengl'
51
- require 'mathn'
52
- include Gl,Glu,Glut
53
-
54
- StripeImageWidth = 32
55
- $stripeImage = []
56
-
57
- $texName
58
-
59
- def makeStripeImage
60
- for j in (0..StripeImageWidth-1)
61
- $stripeImage[4*j] = if (j<=4) then 255 else 0 end
62
- $stripeImage[4*j+1] = if (j>4) then 255 else 0 end
63
- $stripeImage[4*j+2] = 0
64
- $stripeImage[4*j+3] = 255
65
- end
66
- end
67
-
68
- # planes for texture coordinate generation
69
- $xequalzero = [1.0, 0.0, 0.0, 0.0]
70
- $slanted = [1.0, 1.0, 1.0, 0.0]
71
- $currentCoeff = nil
72
- $currentPlane = nil
73
- $currentGenMode = nil
74
-
75
- def init
76
- glClearColor(0.0, 0.0, 0.0, 0.0)
77
- glEnable(GL_DEPTH_TEST)
78
- glShadeModel(GL_SMOOTH)
79
-
80
- makeStripeImage()
81
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
82
-
83
- $texName = glGenTextures(1)
84
- glBindTexture(GL_TEXTURE_2D, $texName[0])
85
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
86
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
87
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
88
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, StripeImageWidth, 1, 0,
89
- GL_RGBA, GL_UNSIGNED_BYTE, $stripeImage.pack("C*"))
90
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
91
- $currentCoeff = $xequalzero
92
- $currentGenMode = GL_OBJECT_LINEAR
93
- $currentPlane = GL_OBJECT_PLANE
94
- glTexGen(GL_S, GL_TEXTURE_GEN_MODE, $currentGenMode)
95
- glTexGen(GL_S, $currentPlane, $currentCoeff)
96
-
97
- glEnable(GL_TEXTURE_GEN_S)
98
- glEnable(GL_TEXTURE_2D)
99
- glEnable(GL_CULL_FACE)
100
- glEnable(GL_LIGHTING)
101
- glEnable(GL_LIGHT0)
102
- glEnable(GL_AUTO_NORMAL)
103
- glEnable(GL_NORMALIZE)
104
- glFrontFace(GL_CW)
105
- glCullFace(GL_BACK)
106
- glMaterial(GL_FRONT, GL_SHININESS, 64.0)
107
- end
108
-
109
- display = Proc.new do
110
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
111
- glPushMatrix()
112
- glRotate(45.0, 0.0, 0.0, 1.0)
113
- glBindTexture(GL_TEXTURE_2D, $texName[0])
114
- glutSolidTeapot(2.0)
115
- glPopMatrix()
116
- glutSwapBuffers()
117
- end
118
-
119
- reshape = Proc.new do |w, h|
120
- glViewport(0, 0, w, h)
121
- glMatrixMode(GL_PROJECTION)
122
- glLoadIdentity()
123
- if (w <= h)
124
- glOrtho(-3.5, 3.5, -3.5*h/w,3.5*h/w, -3.5, 3.5)
125
- else
126
- glOrtho(-3.5*w/h, 3.5*w/h, -3.5, 3.5, -3.5, 3.5)
127
- end
128
- glMatrixMode(GL_MODELVIEW)
129
- glLoadIdentity()
130
- end
131
-
132
- keyboard = Proc.new do |key, x, y|
133
- case (key)
134
- when ?e,?E
135
- $currentGenMode = GL_EYE_LINEAR
136
- $currentPlane = GL_EYE_PLANE
137
- glTexGen(GL_S, GL_TEXTURE_GEN_MODE, $currentGenMode)
138
- glTexGen(GL_S, $currentPlane, $currentCoeff)
139
- glutPostRedisplay()
140
- when ?o, ?O
141
- $currentGenMode = GL_OBJECT_LINEAR
142
- $currentPlane = GL_OBJECT_PLANE
143
- glTexGen(GL_S, GL_TEXTURE_GEN_MODE, $currentGenMode)
144
- glTexGen(GL_S, $currentPlane, $currentCoeff)
145
- glutPostRedisplay()
146
- when ?s,?S
147
- $currentCoeff = $slanted
148
- glTexGen(GL_S, $currentPlane, $currentCoeff)
149
- glutPostRedisplay()
150
- when ?x,?X
151
- $currentCoeff = $xequalzero
152
- glTexGen(GL_S, $currentPlane, $currentCoeff)
153
- glutPostRedisplay()
154
- when ?\e
155
- exit(0)
156
- end
157
- end
158
-
159
- # main
160
- glutInit
161
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
162
- glutInitWindowSize(500, 500)
163
- glutInitWindowPosition(100, 100)
164
- glutCreateWindow($0)
165
- init()
166
- glutDisplayFunc(display)
167
- glutReshapeFunc(reshape)
168
- glutKeyboardFunc(keyboard)
169
- glutMainLoop()
@@ -1,128 +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
- # texturesurf.c
40
- # This program uses evaluators to generate a curved
41
- # surface and automatically generated texture coordinates.
42
- require 'opengl'
43
- include Gl,Glu,Glut
44
-
45
- $ctrlpoints = [
46
- [[ -1.5, -1.5, 4.0], [ -0.5, -1.5, 2.0], [0.5, -1.5, -1.0], [1.5, -1.5, 2.0]],
47
- [[ -1.5, -0.5, 1.0], [ -0.5, -0.5, 3.0], [0.5, -0.5, 0.0], [1.5, -0.5, -1.0]],
48
- [[ -1.5, 0.5, 4.0], [ -0.5, 0.5, 0.0], [0.5, 0.5, 3.0], [1.5, 0.5, 4.0]],
49
- [[ -1.5, 1.5, -2.0], [ -0.5, 1.5, -2.0], [0.5, 1.5, 0.0], [1.5, 1.5, -1.0]]
50
- ].flatten
51
-
52
- $texpts = [[[0.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [1.0, 1.0]]].flatten
53
-
54
- display = proc do
55
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
56
- glColor(1.0, 1.0, 1.0)
57
- glEvalMesh2(GL_FILL, 0, 20, 0, 20)
58
- glutSwapBuffers()
59
- end
60
-
61
- ImageWidth=64
62
- ImageHeight=64
63
- $image = []
64
-
65
- def makeImage
66
- for i in 0...ImageWidth
67
- ti = 2.0*Math::PI*i/ImageWidth.to_f
68
- for j in 0...ImageHeight
69
- tj = 2.0*Math::PI*j/ImageHeight.to_f
70
-
71
- $image[3*(ImageHeight*i+j)] = 127*(1.0+Math::sin(ti))
72
- $image[3*(ImageHeight*i+j)+1] = 127*(1.0+Math::cos(2*tj))
73
- $image[3*(ImageHeight*i+j)+2] = 127*(1.0+Math::cos(ti+tj))
74
- end
75
- end
76
- end
77
-
78
- def myinit
79
- glMap2d(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, $ctrlpoints)
80
- glMap2d(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, $texpts)
81
- glEnable(GL_MAP2_TEXTURE_COORD_2)
82
- glEnable(GL_MAP2_VERTEX_3)
83
- glMapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0)
84
- makeImage()
85
- glTexEnv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
86
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
87
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
88
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
89
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
90
- glTexImage2D(GL_TEXTURE_2D, 0, 3, ImageWidth, ImageHeight, 0,
91
- GL_RGB, GL_UNSIGNED_BYTE, $image.pack("C*"))
92
- glEnable(GL_TEXTURE_2D)
93
- glEnable(GL_DEPTH_TEST)
94
- glEnable(GL_NORMALIZE)
95
- glShadeModel(GL_FLAT)
96
- end
97
-
98
- myReshape = proc do|w, h|
99
- glViewport(0, 0, w, h)
100
- glMatrixMode(GL_PROJECTION)
101
- glLoadIdentity()
102
- if (w <= h)
103
- glOrtho(-4.0, 4.0, -4.0*h.to_f/w, 4.0*h.to_f/w, -4.0, 4.0)
104
- else
105
- glOrtho(-4.0*w.to_f/h, 4.0*w.to_f/h, -4.0, 4.0, -4.0, 4.0)
106
- end
107
- glMatrixMode(GL_MODELVIEW)
108
- glLoadIdentity()
109
- glRotate(85.0, 1.0, 1.0, 1.0)
110
- end
111
-
112
- keyboard = Proc.new do |key, x, y|
113
- case (key)
114
- when ?\e
115
- exit(0);
116
- end
117
- end
118
-
119
- glutInit()
120
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
121
- glutInitWindowSize(500, 500)
122
- glutInitWindowPosition(100, 100)
123
- glutCreateWindow()
124
- myinit()
125
- glutReshapeFunc(myReshape)
126
- glutDisplayFunc(display)
127
- glutKeyboardFunc(keyboard)
128
- glutMainLoop()
@@ -1,159 +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
- # varray.c
38
- # This program demonstrates vertex arrays.
39
- require 'opengl'
40
- include Gl,Glu,Glut
41
-
42
- POINTER=1
43
- INTERLEAVED=2
44
-
45
- DRAWARRAY=1
46
- ARRAYELEMENT=2
47
- DRAWELEMENTS=3
48
-
49
- $setupMethod = POINTER
50
- $derefMethod = DRAWARRAY
51
-
52
- def setupPointers
53
- $vertices = [25, 25,
54
- 100, 325,
55
- 175, 25,
56
- 175, 325,
57
- 250, 25,
58
- 325, 325].pack("i*")
59
- $colors = [1.0, 0.2, 0.2,
60
- 0.2, 0.2, 1.0,
61
- 0.8, 1.0, 0.2,
62
- 0.75, 0.75, 0.75,
63
- 0.35, 0.35, 0.35,
64
- 0.5, 0.5, 0.5].pack("f*")
65
-
66
- glEnableClientState(GL_VERTEX_ARRAY)
67
- glEnableClientState(GL_COLOR_ARRAY)
68
-
69
- glVertexPointer(2, GL_INT, 0, $vertices)
70
- glColorPointer(3, GL_FLOAT, 0, $colors)
71
- end
72
-
73
- def setupInterleave
74
- $intertwined =
75
- [1.0, 0.2, 1.0, 100.0, 100.0, 0.0,
76
- 1.0, 0.2, 0.2, 0.0, 200.0, 0.0,
77
- 1.0, 1.0, 0.2, 100.0, 300.0, 0.0,
78
- 0.2, 1.0, 0.2, 200.0, 300.0, 0.0,
79
- 0.2, 1.0, 1.0, 300.0, 200.0, 0.0,
80
- 0.2, 0.2, 1.0, 200.0, 100.0, 0.0].pack("f*")
81
-
82
- glInterleavedArrays(GL_C3F_V3F, 0, $intertwined)
83
- end
84
-
85
- def init
86
- glClearColor(0.0, 0.0, 0.0, 0.0)
87
- glShadeModel(GL_SMOOTH)
88
- setupPointers()
89
- end
90
-
91
- display = proc do
92
- glClear(GL_COLOR_BUFFER_BIT)
93
- if ($derefMethod == DRAWARRAY)
94
- glDrawArrays(GL_TRIANGLES, 0, 6)
95
- elsif ($derefMethod == ARRAYELEMENT)
96
- glBegin(GL_TRIANGLES)
97
- glArrayElement(2)
98
- glArrayElement(3)
99
- glArrayElement(5)
100
- glEnd()
101
- elsif ($derefMethod == DRAWELEMENTS)
102
- $indices = [0, 1, 3, 4].pack("I*")
103
- glDrawElements(GL_POLYGON, 4, GL_UNSIGNED_INT, $indices)
104
- end
105
- glutSwapBuffers()
106
- end
107
-
108
- reshape = proc do|w, h|
109
- glViewport(0, 0, w, h)
110
- glMatrixMode(GL_PROJECTION)
111
- glLoadIdentity()
112
- gluOrtho2D(0.0, w, 0.0, h)
113
- end
114
-
115
- mouse = proc do |button, state, x, y|
116
- case (button)
117
- when GLUT_LEFT_BUTTON
118
- if (state == GLUT_DOWN)
119
- if ($setupMethod == POINTER)
120
- $setupMethod = INTERLEAVED
121
- setupInterleave()
122
- elsif ($setupMethod == INTERLEAVED)
123
- $setupMethod = POINTER
124
- setupPointers()
125
- end
126
- glutPostRedisplay()
127
- end
128
- when GLUT_MIDDLE_BUTTON,GLUT_RIGHT_BUTTON
129
- if (state == GLUT_DOWN)
130
- if ($derefMethod == DRAWARRAY)
131
- $derefMethod = ARRAYELEMENT
132
- elsif ($derefMethod == ARRAYELEMENT)
133
- $derefMethod = DRAWELEMENTS
134
- elsif ($derefMethod == DRAWELEMENTS)
135
- $derefMethod = DRAWARRAY
136
- end
137
- glutPostRedisplay()
138
- end
139
- end
140
- end
141
-
142
- keyboard = proc do |key, x, y|
143
- case (key)
144
- when ?\e
145
- exit(0)
146
- end
147
- end
148
-
149
- glutInit()
150
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
151
- glutInitWindowSize(350, 350)
152
- glutInitWindowPosition(100, 100)
153
- glutCreateWindow()
154
- init()
155
- glutDisplayFunc(display)
156
- glutReshapeFunc(reshape)
157
- glutMouseFunc(mouse)
158
- glutKeyboardFunc(keyboard)
159
- glutMainLoop()