sgl 0.3.1 → 0.4.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 (103) hide show
  1. data/ChangeLog +234 -0
  2. data/Manifest.txt +94 -0
  3. data/Rakefile +16 -5
  4. data/examples/cocoa1-basic.rb +14 -0
  5. data/examples/cocoa10-transparent.rb +26 -0
  6. data/examples/cocoa11-application.rb +13 -0
  7. data/examples/cocoa2-draw.rb +23 -0
  8. data/examples/cocoa3-affine.rb +29 -0
  9. data/examples/cocoa4-font.rb +24 -0
  10. data/examples/cocoa5-image.rb +22 -0
  11. data/examples/cocoa6-sound.rb +24 -0
  12. data/examples/cocoa7-movie.rb +40 -0
  13. data/examples/cocoa8-movieoverlay.rb +42 -0
  14. data/examples/cocoa9-streaming.rb +40 -0
  15. data/examples/opengl1-basic.rb +14 -0
  16. data/examples/opengl11-application.rb +13 -0
  17. data/examples/opengl2-draw.rb +23 -0
  18. data/examples/opengl3-affine.rb +29 -0
  19. data/examples/sample1.rb +11 -0
  20. data/examples/sample10.rb +16 -0
  21. data/examples/sample11.rb +22 -0
  22. data/examples/sample11a.rb +33 -0
  23. data/examples/sample12.rb +30 -0
  24. data/examples/sample12a.rb +35 -0
  25. data/examples/sample13.rb +116 -0
  26. data/examples/sample15.rb +24 -0
  27. data/examples/sample16.rb +31 -0
  28. data/examples/sample16a.rb +35 -0
  29. data/examples/sample6.rb +18 -0
  30. data/examples/sample7.rb +16 -0
  31. data/examples/sample9.rb +20 -0
  32. data/examples/sgl-sound1.rb +6 -0
  33. data/examples/sgl-sound2.rb +19 -0
  34. data/examples/sine.ogg +0 -0
  35. data/examples/testgl.rb +169 -0
  36. data/lib/sgl/bass-api.rb +202 -0
  37. data/lib/sgl/bass-sample.rb +106 -0
  38. data/lib/sgl/bass.rb +46 -0
  39. data/lib/sgl/cocoa-app.rb +43 -0
  40. data/lib/sgl/cocoa-color.rb +65 -0
  41. data/lib/sgl/cocoa-draw.rb +72 -0
  42. data/lib/sgl/cocoa-event.rb +229 -0
  43. data/lib/sgl/cocoa-media.rb +144 -0
  44. data/lib/sgl/cocoa-notuse.rb +493 -0
  45. data/lib/sgl/cocoa-window.rb +203 -0
  46. data/lib/sgl/cocoa.rb +8 -0
  47. data/lib/sgl/notuse-objs.rb +358 -0
  48. data/lib/sgl/opengl-app.rb +38 -0
  49. data/lib/sgl/opengl-color.rb +44 -0
  50. data/lib/sgl/opengl-draw.rb +260 -0
  51. data/lib/sgl/opengl-event.rb +325 -0
  52. data/lib/sgl/opengl-modules.rb +22 -0
  53. data/lib/sgl/opengl-window.rb +224 -0
  54. data/lib/sgl/opengl.rb +7 -0
  55. data/lib/sgl/sgl-basic.rb +61 -0
  56. data/lib/sgl/sgl-button.rb +135 -0
  57. data/lib/sgl/sgl-client.rb +21 -0
  58. data/lib/sgl/sgl-color.rb +82 -0
  59. data/lib/sgl/sgl-connect.rb +9 -0
  60. data/lib/sgl/sgl-objlib.rb +0 -0
  61. data/lib/sgl/sgl-objs.rb +0 -0
  62. data/lib/sgl/sgl-server.rb +58 -0
  63. data/lib/sgl/sgl-sound.rb +24 -0
  64. data/lib/sgl/sgl-spring.rb +216 -0
  65. data/lib/sgl/sgl-timer.rb +72 -0
  66. data/lib/sgl/sgl.rb +5 -0
  67. data/lib/sgl/version.rb +2 -2
  68. data/scripts/makemanifest.rb +20 -0
  69. data/test/test_bass.rb +27 -0
  70. data/test/test_cocoa_app.rb +5 -5
  71. data/test/test_helper.rb +9 -1
  72. data/test/test_module_ruby16.rb +22 -21
  73. data/test/test_opengl_app.rb +4 -5
  74. data/test/test_opengl_basic.rb +3 -4
  75. data/test/test_opengl_fullscreen.rb +4 -6
  76. data/test/test_opengl_novice.rb +3 -6
  77. data/test/test_sgl.rb +4 -27
  78. data/test/test_sound.rb +15 -0
  79. data/website/challenge1.html +91 -0
  80. data/website/challenge1.txt +30 -0
  81. data/website/challenge2.html +144 -0
  82. data/website/challenge2.txt +73 -0
  83. data/website/challenge3.html +63 -0
  84. data/website/challenge3.txt +15 -0
  85. data/website/cocoa.html +88 -0
  86. data/website/cocoa.txt +35 -0
  87. data/website/description.html +138 -0
  88. data/website/description.txt +90 -0
  89. data/website/exercise1.html +264 -0
  90. data/website/exercise1.txt +192 -0
  91. data/website/exercise2.html +683 -0
  92. data/website/exercise2.txt +597 -0
  93. data/website/exhibition.html +84 -0
  94. data/website/exhibition.txt +24 -0
  95. data/website/howto.html +134 -0
  96. data/website/howto.txt +56 -0
  97. data/website/index.html +17 -9
  98. data/website/index.txt +13 -4
  99. data/website/sound.html +141 -0
  100. data/website/sound.txt +87 -0
  101. data/website/stylesheets/grade.png +0 -0
  102. data/website/stylesheets/screen.css +21 -20
  103. metadata +109 -3
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl"
5
+
6
+ def setup
7
+ window 100, 100
8
+ end
9
+
10
+ def display
11
+ line 0, 0, 100, 100
12
+ end
13
+
14
+ mainloop
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl/opengl-app"
5
+
6
+ app = SGL::Application.new
7
+ app.set_setup {
8
+ app.window(100, 100)
9
+ }
10
+ app.set_display {
11
+ app.line(0, 0, 100, 100)
12
+ }
13
+ app.mainloop
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl"
5
+
6
+ def setup
7
+ window 300, 300
8
+ backgroundHSV 66, 100, 20
9
+ end
10
+
11
+ def display
12
+ x, y = mouseX, mouseY
13
+ colorHSV 0, 50, 100
14
+ lineWidth 3
15
+ line 0, 0, x, y
16
+ line 300, 0, x, y
17
+ line 0, 300, x, y
18
+ line 300, 300, x, y
19
+ colorHSV 0, 100, 100
20
+ rect x-10, y-10, x+10, y+10
21
+ end
22
+
23
+ mainloop
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2004-2007 Kouichirou Eto, All rights reserved.
3
+
4
+ require "sgl"
5
+
6
+ def setup
7
+ window 700, 700
8
+ backgroundHSV 66, 100, 20
9
+ # $font1 = font("Helvetica", 25)
10
+ end
11
+
12
+ def display
13
+ x, y = mouseX, mouseY
14
+ colorHSV 0, 50, 100
15
+ lineWidth 3
16
+ line 0, 0, x, y
17
+ line 700, 0, x, y
18
+ line 0, 700, x, y
19
+ line 700, 700, x, y
20
+ colorHSV 0, 100, 100
21
+
22
+ translate x, y
23
+ rotateZ y
24
+ colorHSV y, 100, 100
25
+ # $font1.text(10, 10, "hello")
26
+ rect -10, -10, +10, +10
27
+ end
28
+
29
+ mainloop
@@ -0,0 +1,11 @@
1
+ require "sgl/opengl"
2
+
3
+ def setup
4
+ window 100, 100
5
+ end
6
+
7
+ def display
8
+ line 0, 0, 100, 100
9
+ end
10
+
11
+ mainloop
@@ -0,0 +1,16 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ end
6
+
7
+ def display
8
+ push
9
+ translate 100, 0
10
+ rotateZ 10
11
+ scale 2
12
+ rect -5, -5, 5, 5
13
+ pop
14
+ end
15
+
16
+ mainloop
@@ -0,0 +1,22 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $x = 0
7
+ $y = 0
8
+ end
9
+
10
+ def display
11
+ x = mouseX
12
+ y = mouseY
13
+ speed = 20.0
14
+ vx = (x - $x)/speed
15
+ vy = (y - $y)/speed
16
+ $x = $x + vx
17
+ $y = $y + vy
18
+ color 100, 0, 0
19
+ circle($x, $y, 50, POLYGON)
20
+ end
21
+
22
+ mainloop
@@ -0,0 +1,33 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 0
6
+ $x1 = 0
7
+ $y1 = 0
8
+ $x2 = 0
9
+ $y2 = 0
10
+ end
11
+
12
+ def display
13
+ x = mouseX
14
+ y = mouseY
15
+
16
+ speed = 20.0
17
+ vx = (x - $x1)/speed
18
+ vy = (y - $y1)/speed
19
+ $x1 = $x1 + vx
20
+ $y1 = $y1 + vy
21
+ color (200+$x1)/4, 0, 0
22
+ circle($x1, $y1, 50, POLYGON) ## polygon�͓h��‚Ԃ�
23
+
24
+ speed = 10.0
25
+ vx = (x - $x2)/speed
26
+ vy = (y - $y2)/speed
27
+ $x2 = $x2 + vx
28
+ $y2 = $y2 + vy
29
+ color 0,(200+$y2)/4,0
30
+ circle($x2+30,$y2+30,80)
31
+ end
32
+
33
+ mainloop
@@ -0,0 +1,30 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $pos = [] # ���g����̔z���p�ӂ���D
7
+ for a in 0..10 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
8
+ $pos[a] = 0 # ���g�ɑS��0�����Ă����D
9
+ end
10
+ $index = 0 # ���ݔz��̂ǂ��̕������w���Ă��邩�������ϐ��D
11
+ end
12
+
13
+ def display
14
+ $pos[$index] = mouseX # �z���$index�̎����Ƃ���Ƀ}�E�X��x���W������D
15
+
16
+ for a in 0..10 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
17
+ x = $pos[a]
18
+ color 0
19
+ line x, -100, x, 100 # �c����`���D
20
+ end
21
+
22
+ $index = $index + 1 # ���݂�����$index�����̒l�̂Ƃ���ɃZ�b�g����D
23
+ if 10 < $index # $index���z��̑傫�����z������0�ɃZ�b�g����D
24
+ $index = 0
25
+ end
26
+
27
+ p $pos # $pos�Ƃ����z��̒��g��\������D
28
+ end
29
+
30
+ mainloop
@@ -0,0 +1,35 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $xpos = [] # ���g����̔z���x���W�Cy���W�ɂ‚��ėp�ӂ���D
7
+ $ypos = []
8
+ for a in 0..20 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
9
+ $xpos[a] = 0
10
+ $ypos[a] = 0
11
+ end
12
+ $index = 0 # ���ݔz��̂ǂ��̕������w���Ă��邩�������D
13
+ end
14
+
15
+ def display
16
+ $xpos[$index] = mouseX # �Y��
17
+ $ypos[$index] = mouseY
18
+
19
+ for a in 0..20 # �z��̗v�f���ꂼ��ɂ‚��ČJ��Ԃ��D
20
+ x = $xpos[a]
21
+ y = $ypos[a]
22
+ colorHSV 0, 100, 100, 20
23
+ circle x, y, 50, POLYGON
24
+ end
25
+
26
+ $index = $index + 1 # ���݂�����$index�����̒l�̂Ƃ���ɃZ�b�g����D
27
+ if 20 < $index # $index���z��̑傫�����z������0�ɃZ�b�g����
28
+ $index = 0
29
+ end
30
+
31
+ p $xpos
32
+ p $ypos
33
+ end
34
+
35
+ mainloop
@@ -0,0 +1,116 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -250, -250, 250, 250
5
+ background 100
6
+ $a = 0
7
+ end
8
+
9
+ def display
10
+ x = mouseX
11
+ y = mouseY
12
+
13
+ color 50, 50, 50
14
+ rect 190, -190, 200, -240
15
+ rect 230, -190, 240, -240
16
+ color 100, 0, 0
17
+ rect 200, -200, 230, -230
18
+
19
+ line x, y, x-5, y
20
+
21
+ color 0
22
+ circle 150, 150, 5
23
+ circle 0, -105, 4
24
+ circle -100, 0, 3
25
+ circle -150, 80, 2
26
+ line 150, 155, 150, 250
27
+ line 0, -108, 0, -250
28
+ line -100, -2, -100, -250
29
+ line -150, 81, -150, 250
30
+
31
+ if $a == 0
32
+ color 100, 0, 0
33
+ line x, y, 215, -200
34
+ else
35
+ color 100, 0, 0
36
+ line 150, 150, 215, -200
37
+ end
38
+
39
+ # 1�̌�
40
+ if $a == 0 && 145 <= x && 155 >= x && 145 <= y && 155 >= y
41
+ $a = 1
42
+ end
43
+
44
+ if $a == 1
45
+ color 100, 0, 0
46
+ line x, y, 150, 150
47
+ elsif $a > 1
48
+ line 0, -105, 150, 150
49
+ end
50
+
51
+ # 2�̌�
52
+ if $a == 1 && -5 <= x && 5 >= x && -110 <= y && -100 >= y
53
+ $a = 2
54
+ end
55
+
56
+ if $a == 2
57
+ color 100, 0, 0
58
+ line x, y, 0, -105
59
+ elsif $a > 2
60
+ line -100, 0, 0, -105
61
+ end
62
+
63
+ # 3�̌�
64
+ if $a == 2 && -103 <= x && -98 >= x && -3 <= y && 2 >= y
65
+ $a = 3
66
+ end
67
+
68
+ if $a == 3
69
+ color 100, 0, 0
70
+ line x, y, -100, 0
71
+ elsif $a > 3
72
+ line -150, 80, -100, 0
73
+ end
74
+
75
+ # 4�̌�
76
+ if $a == 3 && -152 <= x && -148 >= x && 78 <= y && 82 >= y
77
+ $a = 4
78
+ end
79
+
80
+ if $a == 4
81
+ color 100, 0, 0
82
+ line x, y, -150, 80
83
+ end
84
+
85
+ # �S�[���n�_
86
+ if $a == 4 && -250 <= x && -180 >= x
87
+ $a = 5
88
+ end
89
+
90
+ if $a == 5
91
+ background 70, 80, 100
92
+ color 100, 80, 80
93
+ circle -100, 0, 50, POLYGON
94
+ color 80, 80, 100
95
+ circle -100, 0, 30, POLYGON
96
+ color 100, 80, 80
97
+ rect 50, 50, 70, -50
98
+
99
+ beginObj(POLYGON)
100
+ vertex 70, -7
101
+ vertex 112, 35
102
+ vertex 138, 35
103
+ vertex 70, -33
104
+ endObj
105
+ beginObj(POLYGON)
106
+ vertex 103, 0
107
+ vertex 140, -50
108
+ vertex 115, -50
109
+ vertex 85, -9
110
+ endObj
111
+ end
112
+ end
113
+
114
+ mainloop
115
+
116
+ # �傫��������n�߂Ȃ��ƒʂ�܂���
@@ -0,0 +1,24 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window 100, 100
5
+ end
6
+
7
+ def my_rect(x1, y1, x2, y2, outline, fill)
8
+ color fill
9
+ rect x1, y1, x2, y2
10
+ color outline
11
+ line x1, y1, x2, y1
12
+ line x2, y1, x2, y2
13
+ line x2, y2, x1, y2
14
+ line x1, y2, x1, y1
15
+ end
16
+
17
+ def display
18
+ mx = mouseX
19
+ my = mouseY
20
+ my_rect(20, 20, 40, 30, 80, 50)
21
+ my_rect(60, 60, 80, 90, 90, 30)
22
+ end
23
+
24
+ mainloop
@@ -0,0 +1,31 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ end
7
+
8
+ def display
9
+ x = mouseX
10
+ y = mouseY
11
+
12
+ push
13
+ color 100, 0, 0
14
+ translate x, y, 0
15
+ rotateX x
16
+ rotateY y
17
+ scale 2
18
+ rect -5, -5, 5, 5
19
+ pop
20
+
21
+ push
22
+ color 100, 0, 0
23
+ translate x, y, 0
24
+ rotateX x
25
+ rotateY y
26
+ scale 2
27
+ rect 5, 5, 10, 10
28
+ pop
29
+ end
30
+
31
+ mainloop
@@ -0,0 +1,35 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ background 100
6
+ $pos = [] # ���g����̔z���p�ӂ���D
7
+ end
8
+
9
+ def display
10
+ x = mouseX
11
+ y = mouseY
12
+
13
+ $pos << [x, y] # �z��Ɍ��݂̃}�E�X�̈ʒu��lj�����D
14
+
15
+ $pos.each {|pos| # �z��̊e�X�̗v�f�ɂ‚���{}�̒��g�����s����D
16
+ # ���̊e�X�̗v�f��pos�Ƃ����ϐ��ɓ���D
17
+ x = pos[0]
18
+ y = pos[1]
19
+
20
+ push
21
+ colorHSV 0, 100, 100, 10
22
+ translate x, y, 0
23
+ rotateX x
24
+ rotateY y
25
+ scale 20
26
+ rect -5, -5, 5, 5
27
+ pop
28
+ }
29
+
30
+ if 10 < $pos.length # �����z�񂪂��܂肷�����ꍇ�͐擪���珇�Ɏ̂Ă�D
31
+ $pos.shift
32
+ end
33
+ end
34
+
35
+ mainloop
@@ -0,0 +1,18 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window 200, 200
5
+ end
6
+
7
+ def display
8
+ for a in 0..200
9
+ color a/2, 50, 50
10
+ if a < 100
11
+ line a, 50, a, 100
12
+ else
13
+ line a, 100, a, 150
14
+ end
15
+ end
16
+ end
17
+
18
+ mainloop
@@ -0,0 +1,16 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window 200, 200
5
+ end
6
+
7
+ def display
8
+ for a in 0..10
9
+ for b in 0..10
10
+ color a*10, b*10, b*10
11
+ rect a*20+5, b*20+5, a*20+15, b*20+15
12
+ end
13
+ end
14
+ end
15
+
16
+ mainloop
@@ -0,0 +1,20 @@
1
+ require "sgl"
2
+
3
+ def setup
4
+ window -200, -200, 200, 200
5
+ end
6
+
7
+ def display
8
+ beginObj(POLYGON)
9
+ color 100, 0, 0, 0
10
+ vertex 60, 90
11
+ color 0, 100, 0, 100
12
+ vertex -120, 60
13
+ color 0, 0, 100, 100
14
+ vertex -90, -90
15
+ color 100, 100, 0, 0
16
+ vertex 120, -90
17
+ endObj
18
+ end
19
+
20
+ mainloop
@@ -0,0 +1,6 @@
1
+ require 'sgl'
2
+ useSound # sound���g�����Ƃ�錾����D
3
+ sound = loadSound('sine.ogg') # �T���v�������t�@�C������ǂ݂��ށD
4
+ # �����ł�Windows���W���ŗp�ӂ���T���v�������g���Ă���D
5
+ sound.play # �T���v������������D
6
+ sleep 1 # �v���O�����������I������̂��ӂ������߂ɑ҂D
@@ -0,0 +1,19 @@
1
+ require 'sgl'
2
+
3
+ def setup
4
+ useSound
5
+ window -200, -200, 200, 200
6
+ $y = 0
7
+ $sound = loadSound('sine.ogg')
8
+ end
9
+
10
+ def onMouseDown(x, y)
11
+ $y = y
12
+ $sound.play(y / 10 + 60)
13
+ end
14
+
15
+ def display
16
+ line -200, $y, 200, $y
17
+ end
18
+
19
+ mainloop
data/examples/sine.ogg ADDED
Binary file
@@ -0,0 +1,169 @@
1
+ # You can use this test program to run Ruby/SDL, Ruby/OpenGL themselves.
2
+ # I created sgl by extending this small program.
3
+
4
+ require 'sdl'
5
+ require 'opengl'
6
+
7
+ SDL.init SDL::INIT_VIDEO
8
+ SDL.setGLAttr SDL::GL_RED_SIZE,5
9
+ SDL.setGLAttr SDL::GL_GREEN_SIZE,5
10
+ SDL.setGLAttr SDL::GL_BLUE_SIZE,5
11
+ SDL.setGLAttr SDL::GL_DEPTH_SIZE,16
12
+ SDL.setGLAttr SDL::GL_DOUBLEBUFFER,1
13
+ SDL.setVideoMode 640,400,16,SDL::OPENGL
14
+ GL::Viewport( 0, 0, 640, 400 );
15
+ GL::MatrixMode( GL::PROJECTION );
16
+ GL::LoadIdentity( );
17
+
18
+ GL::MatrixMode( GL::MODELVIEW );
19
+ GL::LoadIdentity( );
20
+
21
+ GL::Enable(GL::DEPTH_TEST);
22
+
23
+ GL::DepthFunc(GL::LESS);
24
+
25
+ GL::ShadeModel(GL::SMOOTH);
26
+
27
+ event=SDL::Event.new
28
+ shadedCube=true
29
+
30
+ color =
31
+ [[ 1.0, 1.0, 0.0],
32
+ [ 1.0, 0.0, 0.0],
33
+ [ 0.0, 0.0, 0.0],
34
+ [ 0.0, 1.0, 0.0],
35
+ [ 0.0, 1.0, 1.0],
36
+ [ 1.0, 1.0, 1.0],
37
+ [ 1.0, 0.0, 1.0],
38
+ [ 0.0, 0.0, 1.0]]
39
+
40
+ cube =
41
+ [[ 0.5, 0.5, -0.5],
42
+ [ 0.5, -0.5, -0.5],
43
+ [-0.5, -0.5, -0.5],
44
+ [-0.5, 0.5, -0.5],
45
+ [-0.5, 0.5, 0.5],
46
+ [ 0.5, 0.5, 0.5],
47
+ [ 0.5, -0.5, 0.5],
48
+ [-0.5, -0.5, 0.5]]
49
+
50
+
51
+ loop do
52
+
53
+ if event.poll != 0 then
54
+ if event.type==SDL::Event::QUIT then
55
+ break
56
+ end
57
+ if event.type==SDL::Event::KEYDOWN then
58
+ exit
59
+ end
60
+ end
61
+
62
+ GL.ClearColor(0.0, 0.0, 0.0, 1.0);
63
+ GL.Clear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT);
64
+
65
+
66
+ GL::Begin(GL::QUADS)
67
+
68
+ if shadedCube then
69
+ GL::Color(color[0]);
70
+ GL::Vertex(cube[0]);
71
+ GL::Color(color[1]);
72
+ GL::Vertex(cube[1]);
73
+ GL::Color(color[2]);
74
+ GL::Vertex(cube[2]);
75
+ GL::Color(color[3]);
76
+ GL::Vertex(cube[3]);
77
+
78
+ GL::Color(color[3]);
79
+ GL::Vertex(cube[3]);
80
+ GL::Color(color[4]);
81
+ GL::Vertex(cube[4]);
82
+ GL::Color(color[7]);
83
+ GL::Vertex(cube[7]);
84
+ GL::Color(color[2]);
85
+ GL::Vertex(cube[2]);
86
+
87
+ GL::Color(color[0]);
88
+ GL::Vertex(cube[0]);
89
+ GL::Color(color[5]);
90
+ GL::Vertex(cube[5]);
91
+ GL::Color(color[6]);
92
+ GL::Vertex(cube[6]);
93
+ GL::Color(color[1]);
94
+ GL::Vertex(cube[1]);
95
+
96
+ GL::Color(color[5]);
97
+ GL::Vertex(cube[5]);
98
+ GL::Color(color[4]);
99
+ GL::Vertex(cube[4]);
100
+ GL::Color(color[7]);
101
+ GL::Vertex(cube[7]);
102
+ GL::Color(color[6]);
103
+ GL::Vertex(cube[6]);
104
+
105
+ GL::Color(color[5]);
106
+ GL::Vertex(cube[5]);
107
+ GL::Color(color[0]);
108
+ GL::Vertex(cube[0]);
109
+ GL::Color(color[3]);
110
+ GL::Vertex(cube[3]);
111
+ GL::Color(color[4]);
112
+ GL::Vertex(cube[4]);
113
+
114
+ GL::Color(color[6]);
115
+ GL::Vertex(cube[6]);
116
+ GL::Color(color[1]);
117
+ GL::Vertex(cube[1]);
118
+ GL::Color(color[2]);
119
+ GL::Vertex(cube[2]);
120
+ GL::Color(color[7]);
121
+ GL::Vertex(cube[7]);
122
+
123
+ else
124
+ GL::Color(1.0, 0.0, 0.0);
125
+ GL::Vertex(cube[0]);
126
+ GL::Vertex(cube[1]);
127
+ GL::Vertex(cube[2]);
128
+ GL::Vertex(cube[3]);
129
+
130
+ GL::Color(0.0, 1.0, 0.0);
131
+ GL::Vertex(cube[3]);
132
+ GL::Vertex(cube[4]);
133
+ GL::Vertex(cube[7]);
134
+ GL::Vertex(cube[2]);
135
+
136
+ GL::Color(0.0, 0.0, 1.0);
137
+ GL::Vertex(cube[0]);
138
+ GL::Vertex(cube[5]);
139
+ GL::Vertex(cube[6]);
140
+ GL::Vertex(cube[1]);
141
+
142
+ GL::Color(0.0, 1.0, 1.0);
143
+ GL::Vertex(cube[5]);
144
+ GL::Vertex(cube[4]);
145
+ GL::Vertex(cube[7]);
146
+ GL::Vertex(cube[6]);
147
+
148
+ GL::Color(1.0, 1.0, 0.0);
149
+ GL::Vertex(cube[5]);
150
+ GL::Vertex(cube[0]);
151
+ GL::Vertex(cube[3]);
152
+ GL::Vertex(cube[4]);
153
+
154
+ GL::Color(1.0, 0.0, 1.0);
155
+ GL::Vertex(cube[6]);
156
+ GL::Vertex(cube[1]);
157
+ GL::Vertex(cube[2]);
158
+ GL::Vertex(cube[7]);
159
+
160
+ end
161
+
162
+ GL::End()
163
+
164
+ GL::MatrixMode(GL::MODELVIEW);
165
+ GL::Rotate(5.0, 1.0, 1.0, 1.0);
166
+
167
+ SDL.GLSwapBuffers
168
+
169
+ end