opengl 0.8.0-x86-mingw32 → 0.9.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +2 -0
  4. data/.gitignore +2 -1
  5. data/.travis.yml +19 -0
  6. data/History.rdoc +26 -0
  7. data/Manifest.txt +3 -23
  8. data/README.rdoc +43 -37
  9. data/Rakefile +6 -62
  10. data/examples/NeHe/nehe_lesson02.rb +3 -2
  11. data/examples/NeHe/nehe_lesson03.rb +3 -2
  12. data/examples/NeHe/nehe_lesson04.rb +3 -1
  13. data/examples/NeHe/nehe_lesson05.rb +4 -1
  14. data/examples/NeHe/nehe_lesson06.rb +9 -6
  15. data/examples/NeHe/nehe_lesson07.rb +9 -6
  16. data/examples/NeHe/nehe_lesson08.rb +9 -6
  17. data/examples/NeHe/nehe_lesson09.rb +10 -6
  18. data/examples/NeHe/nehe_lesson11.rb +9 -6
  19. data/examples/NeHe/nehe_lesson12.rb +9 -6
  20. data/examples/NeHe/nehe_lesson16.rb +50 -47
  21. data/examples/NeHe/nehe_lesson19.rb +10 -7
  22. data/examples/NeHe/nehe_lesson36.rb +234 -229
  23. data/examples/OrangeBook/brick.rb +227 -225
  24. data/examples/OrangeBook/particle.rb +233 -231
  25. data/examples/RedBook/aapoly.rb +71 -70
  26. data/examples/RedBook/aargb.rb +54 -52
  27. data/examples/RedBook/accanti.rb +96 -94
  28. data/examples/RedBook/accpersp.rb +106 -104
  29. data/examples/RedBook/alpha.rb +54 -52
  30. data/examples/RedBook/alpha3D.rb +90 -88
  31. data/examples/RedBook/bezcurve.rb +48 -46
  32. data/examples/RedBook/bezmesh.rb +71 -69
  33. data/examples/RedBook/checker.rb +57 -55
  34. data/examples/RedBook/clip.rb +41 -39
  35. data/examples/RedBook/colormat.rb +72 -70
  36. data/examples/RedBook/cube.rb +39 -37
  37. data/examples/RedBook/depthcue.rb +37 -35
  38. data/examples/RedBook/dof.rb +110 -109
  39. data/examples/RedBook/double.rb +40 -38
  40. data/examples/RedBook/drawf.rb +30 -28
  41. data/examples/RedBook/feedback.rb +79 -77
  42. data/examples/RedBook/fog.rb +90 -89
  43. data/examples/RedBook/font.rb +78 -76
  44. data/examples/RedBook/hello.rb +29 -27
  45. data/examples/RedBook/image.rb +57 -55
  46. data/examples/RedBook/jitter.rb +131 -131
  47. data/examples/RedBook/light.rb +2 -1
  48. data/examples/RedBook/lines.rb +70 -68
  49. data/examples/RedBook/list.rb +48 -46
  50. data/examples/RedBook/material.rb +200 -199
  51. data/examples/RedBook/mipmap.rb +84 -82
  52. data/examples/RedBook/model.rb +55 -53
  53. data/examples/RedBook/movelight.rb +52 -50
  54. data/examples/RedBook/pickdepth.rb +103 -101
  55. data/examples/RedBook/planet.rb +46 -44
  56. data/examples/RedBook/quadric.rb +97 -95
  57. data/examples/RedBook/robot.rb +55 -53
  58. data/examples/RedBook/select.rb +118 -116
  59. data/examples/RedBook/smooth.rb +35 -33
  60. data/examples/RedBook/stencil.rb +96 -94
  61. data/examples/RedBook/stroke.rb +75 -73
  62. data/examples/RedBook/surface.rb +93 -91
  63. data/examples/RedBook/teaambient.rb +71 -69
  64. data/examples/RedBook/teapots.rb +105 -103
  65. data/examples/RedBook/tess.rb +96 -94
  66. data/examples/RedBook/texbind.rb +79 -77
  67. data/examples/RedBook/texgen.rb +88 -86
  68. data/examples/RedBook/texturesurf.rb +57 -55
  69. data/examples/RedBook/varray.rb +85 -83
  70. data/examples/RedBook/wrap.rb +76 -74
  71. data/examples/misc/OGLBench.rb +114 -113
  72. data/examples/misc/anisotropic.rb +154 -152
  73. data/examples/misc/fbo_test.rb +37 -36
  74. data/examples/misc/font-glut.rb +47 -46
  75. data/examples/misc/glfwtest.rb +16 -16
  76. data/examples/misc/plane.rb +13 -13
  77. data/examples/misc/readpixel.rb +66 -65
  78. data/examples/misc/sdltest.rb +21 -19
  79. data/examples/misc/trislam.rb +548 -547
  80. data/ext/opengl/common.h +16 -38
  81. data/ext/opengl/conv.h +39 -41
  82. data/ext/opengl/extconf.rb +4 -31
  83. data/ext/opengl/funcdef.h +126 -124
  84. data/ext/opengl/gl-1.0-1.1.c +1917 -1917
  85. data/ext/opengl/gl-1.2.c +4 -667
  86. data/ext/opengl/gl-1.3.c +9 -9
  87. data/ext/opengl/gl-1.4.c +8 -8
  88. data/ext/opengl/gl-1.5.c +1 -1
  89. data/ext/opengl/gl-2.0.c +392 -388
  90. data/ext/opengl/gl-3.0.c +493 -0
  91. data/ext/opengl/gl-enums.c +1523 -5
  92. data/ext/opengl/gl-enums.h +4679 -122
  93. data/ext/opengl/gl-error.c +7 -7
  94. data/ext/opengl/gl-error.h +4 -4
  95. data/ext/opengl/gl-ext-arb.c +468 -464
  96. data/ext/opengl/gl-ext-ext.c +18 -18
  97. data/ext/opengl/gl-ext-nv.c +15 -15
  98. data/ext/opengl/gl.c +2 -0
  99. data/ext/opengl/gl_buffer.c +92 -92
  100. data/ext/opengl/opengl.c +1 -7
  101. data/lib/opengl.rb +23 -59
  102. data/lib/opengl/1.9/opengl.so +0 -0
  103. data/lib/opengl/2.0/opengl.so +0 -0
  104. data/lib/opengl/2.1/opengl.so +0 -0
  105. data/lib/opengl/test_case.rb +1 -2
  106. data/test/dummy.xorg.conf +140 -0
  107. data/test/test_gl.rb +18 -22
  108. data/test/test_gl_10_11.rb +220 -220
  109. data/test/test_gl_12.rb +11 -122
  110. data/test/test_gl_13.rb +202 -210
  111. data/test/test_gl_14.rb +16 -19
  112. data/test/test_gl_15.rb +2 -4
  113. data/test/test_gl_20.rb +45 -58
  114. data/test/test_gl_21.rb +46 -163
  115. data/test/test_gl_ext_arb.rb +54 -72
  116. data/test/test_gl_ext_ati.rb +0 -2
  117. data/test/test_gl_ext_ext.rb +66 -66
  118. data/test/test_gl_ext_gremedy.rb +8 -15
  119. data/test/test_gl_ext_nv.rb +109 -112
  120. data/test/test_opengl_buffer.rb +8 -25
  121. data/utils/README +0 -5
  122. data/utils/enumgen.rb +72 -76
  123. data/utils/extlistgen.rb +55 -55
  124. metadata +90 -67
  125. metadata.gz.sig +0 -0
  126. data/Rakefile.cross +0 -107
  127. data/docs/build_install.txt +0 -119
  128. data/docs/extensions.txt.in +0 -348
  129. data/docs/history.txt +0 -66
  130. data/docs/requirements_and_design.txt +0 -117
  131. data/docs/roadmap.txt +0 -28
  132. data/docs/scientific_use.txt +0 -35
  133. data/docs/supplies/page_template.html +0 -71
  134. data/docs/thanks.txt +0 -29
  135. data/docs/tutorial.txt +0 -469
  136. data/ext/opengl/glu-enums.c +0 -164
  137. data/ext/opengl/glu-enums.h +0 -463
  138. data/ext/opengl/glu.c +0 -1534
  139. data/ext/opengl/glut.c +0 -1145
  140. data/ext/opengl/glut_callbacks.c +0 -845
  141. data/lib/glu.rb +0 -1
  142. data/lib/glut.rb +0 -1
  143. data/lib/opengl/opengl.so +0 -0
  144. data/test/test_glu.rb +0 -309
  145. data/utils/mkdn2html.rb +0 -59
  146. data/utils/post-mkdn2html.rb +0 -91
  147. data/website/images/ogl.jpg +0 -0
  148. data/website/images/tab_bottom.gif +0 -0
  149. data/website/style.css +0 -198
@@ -2,14 +2,14 @@
2
2
  # Copyright (c) Mark J. Kilgard, 1994.
3
3
  #
4
4
  # (c) Copyright 1993, Silicon Graphics, Inc.
5
- # ALL RIGHTS RESERVED
6
- # Permission to use, copy, modify, and distribute this software for
5
+ # ALL RIGHTS RESERVED
6
+ # Permission to use, copy, modify, and distribute this software for
7
7
  # any purpose and without fee is hereby granted, provided that the above
8
8
  # copyright notice appear in all copies and that both the copyright notice
9
- # and this permission notice appear in supporting documentation, and that
9
+ # and this permission notice appear in supporting documentation, and that
10
10
  # the name of Silicon Graphics, Inc. not be used in advertising
11
11
  # or publicity pertaining to distribution of the software without specific,
12
- # written prior permission.
12
+ # written prior permission.
13
13
  #
14
14
  # THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
15
15
  # AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -23,8 +23,8 @@
23
23
  # ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
24
24
  # ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
25
25
  # POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
26
- #
27
- # US Government Users Restricted Rights
26
+ #
27
+ # US Government Users Restricted Rights
28
28
  # Use, duplication, or disclosure by the Government is subject to
29
29
  # restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
30
30
  # (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -37,12 +37,14 @@
37
37
  # OpenGL(TM) is a trademark of Silicon Graphics, Inc.
38
38
  #
39
39
  # stencil.c
40
- # This program draws two rotated tori in a window.
41
- # A diamond in the center of the window masks out part
42
- # of the scene. Within this mask, a different model
40
+ # This program draws two rotated tori in a window.
41
+ # A diamond in the center of the window masks out part
42
+ # of the scene. Within this mask, a different model
43
43
  # (a sphere) is drawn in a different color.
44
44
  #
45
45
  require 'opengl'
46
+ require 'glu'
47
+ require 'glut'
46
48
  require 'rational'
47
49
  include Gl,Glu,Glut
48
50
 
@@ -50,106 +52,106 @@ YELLOWMAT=1
50
52
  BLUEMAT=2
51
53
 
52
54
  def myinit
53
- yellow_diffuse = [ 0.7, 0.7, 0.0, 1.0 ]
54
- yellow_specular = [ 1.0, 1.0, 1.0, 1.0 ]
55
-
56
- blue_diffuse = [ 0.1, 0.1, 0.7, 1.0 ]
57
- blue_specular = [ 0.1, 1.0, 1.0, 1.0 ]
58
-
59
- position_one = [ 1.0, 1.0, 1.0, 0.0 ]
60
-
61
- glNewList(YELLOWMAT, GL_COMPILE)
62
- glMaterial(GL_FRONT, GL_DIFFUSE, yellow_diffuse)
63
- glMaterial(GL_FRONT, GL_SPECULAR, yellow_specular)
64
- glMaterial(GL_FRONT, GL_SHININESS, 64.0)
65
- glEndList()
66
-
67
- glNewList(BLUEMAT, GL_COMPILE)
68
- glMaterial(GL_FRONT, GL_DIFFUSE, blue_diffuse)
69
- glMaterial(GL_FRONT, GL_SPECULAR, blue_specular)
70
- glMaterial(GL_FRONT, GL_SHININESS, 45.0)
71
- glEndList()
72
-
73
- glLight(GL_LIGHT0, GL_POSITION, position_one)
74
-
75
- glEnable(GL_LIGHT0)
76
- glEnable(GL_LIGHTING)
77
- glEnable(GL_DEPTH_TEST)
78
-
79
- glClearStencil(0x0)
80
- glEnable(GL_STENCIL_TEST)
55
+ yellow_diffuse = [ 0.7, 0.7, 0.0, 1.0 ]
56
+ yellow_specular = [ 1.0, 1.0, 1.0, 1.0 ]
57
+
58
+ blue_diffuse = [ 0.1, 0.1, 0.7, 1.0 ]
59
+ blue_specular = [ 0.1, 1.0, 1.0, 1.0 ]
60
+
61
+ position_one = [ 1.0, 1.0, 1.0, 0.0 ]
62
+
63
+ glNewList(YELLOWMAT, GL_COMPILE)
64
+ glMaterial(GL_FRONT, GL_DIFFUSE, yellow_diffuse)
65
+ glMaterial(GL_FRONT, GL_SPECULAR, yellow_specular)
66
+ glMaterial(GL_FRONT, GL_SHININESS, 64.0)
67
+ glEndList()
68
+
69
+ glNewList(BLUEMAT, GL_COMPILE)
70
+ glMaterial(GL_FRONT, GL_DIFFUSE, blue_diffuse)
71
+ glMaterial(GL_FRONT, GL_SPECULAR, blue_specular)
72
+ glMaterial(GL_FRONT, GL_SHININESS, 45.0)
73
+ glEndList()
74
+
75
+ glLight(GL_LIGHT0, GL_POSITION, position_one)
76
+
77
+ glEnable(GL_LIGHT0)
78
+ glEnable(GL_LIGHTING)
79
+ glEnable(GL_DEPTH_TEST)
80
+
81
+ glClearStencil(0x0)
82
+ glEnable(GL_STENCIL_TEST)
81
83
  end
82
84
 
83
85
  # Draw a sphere in a diamond-shaped section in the
84
86
  # middle of a window with 2 tori.
85
87
  display = Proc.new do
86
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
87
-
88
- # draw blue sphere where the stencil is 1
89
- glStencilFunc(GL_EQUAL, 0x1, 0x1)
90
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)
91
- glCallList(BLUEMAT)
92
- glutSolidSphere(0.5, 15, 15)
93
-
94
- # draw the tori where the stencil is not 1
95
- glStencilFunc(GL_NOTEQUAL, 0x1, 0x1)
96
- glPushMatrix()
97
- glRotate(45.0, 0.0, 0.0, 1.0)
98
- glRotate(45.0, 0.0, 1.0, 0.0)
99
- glCallList(YELLOWMAT)
100
- glutSolidTorus(0.275, 0.85, 15, 15)
101
- glPushMatrix()
102
- glRotate(90.0, 1.0, 0.0, 0.0)
103
- glutSolidTorus(0.275, 0.85, 15, 15)
104
- glPopMatrix()
105
- glPopMatrix()
106
-
107
- glutSwapBuffers()
88
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
89
+
90
+ # draw blue sphere where the stencil is 1
91
+ glStencilFunc(GL_EQUAL, 0x1, 0x1)
92
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)
93
+ glCallList(BLUEMAT)
94
+ glutSolidSphere(0.5, 15, 15)
95
+
96
+ # draw the tori where the stencil is not 1
97
+ glStencilFunc(GL_NOTEQUAL, 0x1, 0x1)
98
+ glPushMatrix()
99
+ glRotate(45.0, 0.0, 0.0, 1.0)
100
+ glRotate(45.0, 0.0, 1.0, 0.0)
101
+ glCallList(YELLOWMAT)
102
+ glutSolidTorus(0.275, 0.85, 15, 15)
103
+ glPushMatrix()
104
+ glRotate(90.0, 1.0, 0.0, 0.0)
105
+ glutSolidTorus(0.275, 0.85, 15, 15)
106
+ glPopMatrix()
107
+ glPopMatrix()
108
+
109
+ glutSwapBuffers()
108
110
  end
109
111
 
110
- # Whenever the window is reshaped, redefine the
112
+ # Whenever the window is reshaped, redefine the
111
113
  # coordinate system and redraw the stencil area.
112
114
  myReshape = Proc.new do |w, h|
113
- glViewport(0, 0, w, h)
114
-
115
- # create a diamond shaped stencil area
116
- glMatrixMode(GL_PROJECTION)
117
- glLoadIdentity()
118
- if w<=h
119
- gluOrtho2D(-3.0, 3.0, -3.0*h/w, 3*h/w)
120
- else
121
- gluOrtho2D(-3.0*w/h, 3.0*w/h, -3.0, 3)
122
- end
123
- glMatrixMode(GL_MODELVIEW)
124
- glLoadIdentity()
125
-
126
- glClear(GL_STENCIL_BUFFER_BIT)
127
- glStencilFunc(GL_ALWAYS, 0x1, 0x1)
128
- glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE)
129
- glBegin(GL_QUADS)
130
- glVertex2f(-1.0, 0.0)
131
- glVertex2f(0.0, 1.0)
132
- glVertex2f(1.0, 0.0)
133
- glVertex2f(0.0, -1.0)
134
- glEnd()
135
-
136
- glMatrixMode(GL_PROJECTION)
137
- glLoadIdentity()
138
- GLU.Perspective(45.0, w.to_f/h.to_f, 3.0, 7.0)
139
- glMatrixMode(GL_MODELVIEW)
140
- glLoadIdentity()
141
- glTranslate(0.0, 0.0, -5.0)
115
+ glViewport(0, 0, w, h)
116
+
117
+ # create a diamond shaped stencil area
118
+ glMatrixMode(GL_PROJECTION)
119
+ glLoadIdentity()
120
+ if w<=h
121
+ gluOrtho2D(-3.0, 3.0, -3.0*h/w, 3*h/w)
122
+ else
123
+ gluOrtho2D(-3.0*w/h, 3.0*w/h, -3.0, 3)
124
+ end
125
+ glMatrixMode(GL_MODELVIEW)
126
+ glLoadIdentity()
127
+
128
+ glClear(GL_STENCIL_BUFFER_BIT)
129
+ glStencilFunc(GL_ALWAYS, 0x1, 0x1)
130
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE)
131
+ glBegin(GL_QUADS)
132
+ glVertex2f(-1.0, 0.0)
133
+ glVertex2f(0.0, 1.0)
134
+ glVertex2f(1.0, 0.0)
135
+ glVertex2f(0.0, -1.0)
136
+ glEnd()
137
+
138
+ glMatrixMode(GL_PROJECTION)
139
+ glLoadIdentity()
140
+ GLU.Perspective(45.0, w.to_f/h.to_f, 3.0, 7.0)
141
+ glMatrixMode(GL_MODELVIEW)
142
+ glLoadIdentity()
143
+ glTranslate(0.0, 0.0, -5.0)
142
144
  end
143
145
 
144
146
  keyboard = Proc.new do |key, x, y|
145
- case (key)
146
- when ?\e
147
- exit(0);
148
- end
147
+ case (key)
148
+ when ?\e
149
+ exit(0);
150
+ end
149
151
  end
150
152
 
151
153
  # Main Loop
152
- # Open window with initial window size, title bar,
154
+ # Open window with initial window size, title bar,
153
155
  # RGB display mode, and handle input events.
154
156
  glutInit()
155
157
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL)
@@ -2,14 +2,14 @@
2
2
  # Copyright (c) Mark J. Kilgard, 1994.
3
3
  #
4
4
  # (c) Copyright 1993, Silicon Graphics, Inc.
5
- # ALL RIGHTS RESERVED
6
- # Permission to use, copy, modify, and distribute this software for
5
+ # ALL RIGHTS RESERVED
6
+ # Permission to use, copy, modify, and distribute this software for
7
7
  # any purpose and without fee is hereby granted, provided that the above
8
8
  # copyright notice appear in all copies and that both the copyright notice
9
- # and this permission notice appear in supporting documentation, and that
9
+ # and this permission notice appear in supporting documentation, and that
10
10
  # the name of Silicon Graphics, Inc. not be used in advertising
11
11
  # or publicity pertaining to distribution of the software without specific,
12
- # written prior permission.
12
+ # written prior permission.
13
13
  #
14
14
  # THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
15
15
  # AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -23,8 +23,8 @@
23
23
  # ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
24
24
  # ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
25
25
  # POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
26
- #
27
- # US Government Users Restricted Rights
26
+ #
27
+ # US Government Users Restricted Rights
28
28
  # Use, duplication, or disclosure by the Government is subject to
29
29
  # restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
30
30
  # (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -36,13 +36,15 @@
36
36
  #
37
37
  # OpenGL(TM) is a trademark of Silicon Graphics, Inc.
38
38
  #
39
- # stroke.c
40
- # This program demonstrates some characters of a
39
+ # stroke.c
40
+ # This program demonstrates some characters of a
41
41
  # stroke (vector) font. The characters are represented
42
- # by display lists, which are given numbers which
42
+ # by display lists, which are given numbers which
43
43
  # correspond to the ASCII values of the characters.
44
44
  # Use of glCallLists() is demonstrated.
45
45
  require 'opengl'
46
+ require 'glu'
47
+ require 'glut'
46
48
  require 'mathn'
47
49
  include Gl,Glu,Glut
48
50
 
@@ -51,109 +53,109 @@ STROKE=2
51
53
  END_=3
52
54
 
53
55
  Adata = [
54
- [[0, 0], PT], [[0, 9], PT], [[1, 10], PT], [[4, 10], PT],
55
- [[5, 9], PT], [[5, 0], STROKE], [[0, 5], PT], [[5, 5], END_]
56
+ [[0, 0], PT], [[0, 9], PT], [[1, 10], PT], [[4, 10], PT],
57
+ [[5, 9], PT], [[5, 0], STROKE], [[0, 5], PT], [[5, 5], END_]
56
58
  ]
57
59
 
58
60
  Edata = [
59
- [[5, 0], PT], [[0, 0], PT], [[0, 10], PT], [[5, 10], STROKE],
60
- [[0, 5], PT], [[4, 5], END_]
61
+ [[5, 0], PT], [[0, 0], PT], [[0, 10], PT], [[5, 10], STROKE],
62
+ [[0, 5], PT], [[4, 5], END_]
61
63
  ]
62
64
 
63
65
  Pdata = [
64
- [[0, 0], PT], [[0, 10], PT], [[4, 10], PT], [[5, 9], PT], [[5, 6], PT],
65
- [[4, 5], PT], [[0, 5], END_]
66
+ [[0, 0], PT], [[0, 10], PT], [[4, 10], PT], [[5, 9], PT], [[5, 6], PT],
67
+ [[4, 5], PT], [[0, 5], END_]
66
68
  ]
67
69
 
68
70
  Rdata = [
69
- [[0, 0], PT], [[0, 10], PT], [[4, 10], PT], [[5, 9], PT], [[5, 6], PT],
70
- [[4, 5], PT], [[0, 5], STROKE], [[3, 5], PT], [[5, 0], END_]
71
+ [[0, 0], PT], [[0, 10], PT], [[4, 10], PT], [[5, 9], PT], [[5, 6], PT],
72
+ [[4, 5], PT], [[0, 5], STROKE], [[3, 5], PT], [[5, 0], END_]
71
73
  ]
72
74
 
73
75
  Sdata = [
74
- [[0, 1], PT], [[1, 0], PT], [[4, 0], PT], [[5, 1], PT], [[5, 4], PT],
75
- [[4, 5], PT], [[1, 5], PT], [[0, 6], PT], [[0, 9], PT], [[1, 10], PT],
76
- [[4, 10], PT], [[5, 9], END_]
76
+ [[0, 1], PT], [[1, 0], PT], [[4, 0], PT], [[5, 1], PT], [[5, 4], PT],
77
+ [[4, 5], PT], [[1, 5], PT], [[0, 6], PT], [[0, 9], PT], [[1, 10], PT],
78
+ [[4, 10], PT], [[5, 9], END_]
77
79
  ]
78
80
 
79
81
  # drawLetter() interprets the instructions from the array
80
82
  # for that letter and renders the letter with line segments.
81
83
  def drawLetter(l)
82
- i = 0
83
- glBegin(GL_LINE_STRIP)
84
- while true
85
- case (l[i][1])
86
- when PT
87
- glVertex(l[i][0])
88
- when STROKE
89
- glVertex(l[i][0])
90
- glEnd()
91
- glBegin(GL_LINE_STRIP)
92
- when END_
93
- glVertex(l[i][0])
94
- glEnd()
95
- glTranslate(8.0, 0.0, 0.0)
96
- return
97
- end
98
- i += 1
99
- end
84
+ i = 0
85
+ glBegin(GL_LINE_STRIP)
86
+ while true
87
+ case (l[i][1])
88
+ when PT
89
+ glVertex(l[i][0])
90
+ when STROKE
91
+ glVertex(l[i][0])
92
+ glEnd()
93
+ glBegin(GL_LINE_STRIP)
94
+ when END_
95
+ glVertex(l[i][0])
96
+ glEnd()
97
+ glTranslate(8.0, 0.0, 0.0)
98
+ return
99
+ end
100
+ i += 1
101
+ end
100
102
  end
101
103
 
102
104
  # Create a display list for each of 6 characters
103
105
  def myinit
104
- glShadeModel(GL_FLAT)
105
-
106
- base = glGenLists(128)
107
- glListBase(base)
108
- glNewList(base+'A'[0], GL_COMPILE); drawLetter(Adata); glEndList()
109
- glNewList(base+'E'[0], GL_COMPILE); drawLetter(Edata); glEndList()
110
- glNewList(base+'P'[0], GL_COMPILE); drawLetter(Pdata); glEndList()
111
- glNewList(base+'R'[0], GL_COMPILE); drawLetter(Rdata); glEndList()
112
- glNewList(base+'S'[0], GL_COMPILE); drawLetter(Sdata); glEndList()
113
- glNewList(base+' '[0], GL_COMPILE); glTranslate(8.0, 0.0, 0.0); glEndList()
106
+ glShadeModel(GL_FLAT)
107
+
108
+ base = glGenLists(128)
109
+ glListBase(base)
110
+ glNewList(base+'A'[0], GL_COMPILE); drawLetter(Adata); glEndList()
111
+ glNewList(base+'E'[0], GL_COMPILE); drawLetter(Edata); glEndList()
112
+ glNewList(base+'P'[0], GL_COMPILE); drawLetter(Pdata); glEndList()
113
+ glNewList(base+'R'[0], GL_COMPILE); drawLetter(Rdata); glEndList()
114
+ glNewList(base+'S'[0], GL_COMPILE); drawLetter(Sdata); glEndList()
115
+ glNewList(base+' '[0], GL_COMPILE); glTranslate(8.0, 0.0, 0.0); glEndList()
114
116
  end
115
117
 
116
118
  $test1 = "A SPARE SERAPE APPEARS AS"
117
119
  $test2 = "APES PREPARE RARE PEPPERS"
118
120
 
119
121
  def printStrokedString(s)
120
- glCallLists(GL_BYTE,s)
122
+ glCallLists(GL_BYTE,s)
121
123
  end
122
124
 
123
125
  display = Proc.new do
124
- glClear(GL_COLOR_BUFFER_BIT)
125
- glColor(1.0, 1.0, 1.0)
126
- glPushMatrix()
127
- glScale(2.0, 2.0, 2.0)
128
- glTranslate(10.0, 30.0, 0.0)
129
- printStrokedString($test1)
130
- glPopMatrix()
131
- glPushMatrix()
132
- glScale(2.0, 2.0, 2.0)
133
- glTranslate(10.0, 13.0, 0.0)
134
- printStrokedString($test2)
135
- glPopMatrix()
136
- glutSwapBuffers()
126
+ glClear(GL_COLOR_BUFFER_BIT)
127
+ glColor(1.0, 1.0, 1.0)
128
+ glPushMatrix()
129
+ glScale(2.0, 2.0, 2.0)
130
+ glTranslate(10.0, 30.0, 0.0)
131
+ printStrokedString($test1)
132
+ glPopMatrix()
133
+ glPushMatrix()
134
+ glScale(2.0, 2.0, 2.0)
135
+ glTranslate(10.0, 13.0, 0.0)
136
+ printStrokedString($test2)
137
+ glPopMatrix()
138
+ glutSwapBuffers()
137
139
  end
138
140
 
139
141
  reshape = Proc.new do |w, h|
140
- glViewport(0, 0, w, h)
141
- glMatrixMode(GL_PROJECTION)
142
- glLoadIdentity()
143
- glOrtho(0.0, w, 0.0, h, -1.0, 1.0)
144
- glMatrixMode(GL_MODELVIEW)
145
- glLoadIdentity()
142
+ glViewport(0, 0, w, h)
143
+ glMatrixMode(GL_PROJECTION)
144
+ glLoadIdentity()
145
+ glOrtho(0.0, w, 0.0, h, -1.0, 1.0)
146
+ glMatrixMode(GL_MODELVIEW)
147
+ glLoadIdentity()
146
148
  end
147
149
 
148
150
  keyboard = Proc.new do |key, x, y|
149
- case (key)
150
- when ?\e
151
- exit(0);
152
- end
151
+ case (key)
152
+ when ?\e
153
+ exit(0);
154
+ end
153
155
  end
154
156
 
155
157
  # Main Loop
156
- # Open window with initial window size, title bar,
158
+ # Open window with initial window size, title bar,
157
159
  # RGBA display mode, and handle input events.
158
160
  glutInit
159
161
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)