opengl 0.7.0.pre1-x86-mingw32 → 0.7.0.pre2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.autotest +29 -0
  2. data/.gitignore +5 -8
  3. data/History.rdoc +33 -0
  4. data/Manifest.txt +72 -57
  5. data/README.rdoc +72 -25
  6. data/Rakefile +60 -72
  7. data/Rakefile.cross +5 -2
  8. data/{doc → docs}/build_install.txt +0 -0
  9. data/{doc → docs}/extensions.txt.in +0 -0
  10. data/{doc → docs}/history.txt +0 -0
  11. data/{doc → docs}/requirements_and_design.txt +0 -0
  12. data/{doc → docs}/roadmap.txt +0 -0
  13. data/{doc → docs}/scientific_use.txt +0 -0
  14. data/{doc → docs}/supplies/page_template.html +0 -0
  15. data/{doc → docs}/thanks.txt +0 -0
  16. data/{doc → docs}/tutorial.txt +0 -0
  17. data/examples/NeHe/NeHe.png +0 -0
  18. data/examples/NeHe/crate.png +0 -0
  19. data/examples/NeHe/glass.png +0 -0
  20. data/examples/NeHe/nehe_lesson02.rb +82 -83
  21. data/examples/NeHe/nehe_lesson03.rb +88 -88
  22. data/examples/NeHe/nehe_lesson04.rb +93 -96
  23. data/examples/NeHe/nehe_lesson05.rb +137 -144
  24. data/examples/NeHe/nehe_lesson06.rb +183 -0
  25. data/examples/NeHe/nehe_lesson07.rb +237 -0
  26. data/examples/NeHe/nehe_lesson08.rb +252 -0
  27. data/examples/NeHe/nehe_lesson09.rb +199 -0
  28. data/examples/NeHe/nehe_lesson11.rb +173 -0
  29. data/examples/NeHe/nehe_lesson12.rb +200 -0
  30. data/examples/NeHe/nehe_lesson16.rb +208 -0
  31. data/examples/NeHe/nehe_lesson19.rb +206 -0
  32. data/examples/NeHe/particle.png +0 -0
  33. data/examples/NeHe/star.png +0 -0
  34. data/examples/NeHe/tim.png +0 -0
  35. data/examples/RedBook/light.rb +154 -0
  36. data/examples/misc/OGLBench.rb +2 -2
  37. data/examples/misc/trislam.rb +2 -2
  38. data/ext/{common → opengl}/common.h +2 -11
  39. data/ext/{common → opengl}/conv.h +43 -31
  40. data/ext/{glut → opengl}/extconf.rb +14 -7
  41. data/ext/{common → opengl}/funcdef.h +155 -125
  42. data/ext/{gl → opengl}/gl-1.0-1.1.c +426 -162
  43. data/ext/{gl → opengl}/gl-1.2.c +70 -66
  44. data/ext/{gl → opengl}/gl-1.3.c +19 -19
  45. data/ext/{gl → opengl}/gl-1.4.c +23 -23
  46. data/ext/{gl → opengl}/gl-1.5.c +46 -47
  47. data/ext/{gl → opengl}/gl-2.0.c +66 -60
  48. data/ext/{gl → opengl}/gl-2.1.c +4 -4
  49. data/ext/{gl → opengl}/gl-enums.c +2 -1
  50. data/ext/{common → opengl}/gl-enums.h +0 -0
  51. data/ext/{gl → opengl}/gl-error.c +12 -4
  52. data/ext/{common → opengl}/gl-error.h +7 -2
  53. data/ext/{gl → opengl}/gl-ext-3dfx.c +1 -1
  54. data/ext/{gl → opengl}/gl-ext-arb.c +75 -70
  55. data/ext/{gl → opengl}/gl-ext-ati.c +3 -3
  56. data/ext/{gl → opengl}/gl-ext-ext.c +54 -54
  57. data/ext/{gl → opengl}/gl-ext-gremedy.c +3 -3
  58. data/ext/{gl → opengl}/gl-ext-nv.c +49 -48
  59. data/ext/{common → opengl}/gl-types.h +0 -0
  60. data/ext/{gl → opengl}/gl.c +8 -10
  61. data/ext/{glu → opengl}/glu-enums.c +1 -1
  62. data/ext/{common → opengl}/glu-enums.h +0 -0
  63. data/ext/{glu → opengl}/glu.c +7 -3
  64. data/ext/{glut → opengl}/glut.c +98 -48
  65. data/ext/opengl/opengl.c +11 -0
  66. data/lib/gl.rb +1 -0
  67. data/lib/glu.rb +1 -0
  68. data/lib/glut.rb +1 -0
  69. data/lib/opengl.rb +13 -14
  70. data/lib/opengl/opengl.so +0 -0
  71. data/lib/opengl/test_case.rb +87 -0
  72. data/test/{tc_misc.rb → test_gl.rb} +2 -14
  73. data/test/test_gl_10_11.rb +1363 -0
  74. data/test/test_gl_12.rb +182 -0
  75. data/test/{tc_func_13.rb → test_gl_13.rb} +14 -14
  76. data/test/test_gl_14.rb +221 -0
  77. data/test/test_gl_15.rb +260 -0
  78. data/test/test_gl_20.rb +430 -0
  79. data/test/test_gl_21.rb +553 -0
  80. data/test/test_gl_ext_arb.rb +526 -0
  81. data/test/{tc_ext_ati.rb → test_gl_ext_ati.rb} +11 -14
  82. data/test/test_gl_ext_ext.rb +608 -0
  83. data/test/{tc_ext_gremedy.rb → test_gl_ext_gremedy.rb} +6 -6
  84. data/test/test_gl_ext_nv.rb +352 -0
  85. data/test/test_glu.rb +309 -0
  86. metadata +159 -102
  87. data/History.txt +0 -36
  88. data/ext/gl/extconf.rb +0 -43
  89. data/ext/glu/extconf.rb +0 -51
  90. data/test/README +0 -10
  91. data/test/tc_common.rb +0 -98
  92. data/test/tc_ext_arb.rb +0 -467
  93. data/test/tc_ext_ext.rb +0 -551
  94. data/test/tc_ext_nv.rb +0 -357
  95. data/test/tc_func_10_11.rb +0 -1281
  96. data/test/tc_func_12.rb +0 -186
  97. data/test/tc_func_14.rb +0 -197
  98. data/test/tc_func_15.rb +0 -270
  99. data/test/tc_func_20.rb +0 -346
  100. data/test/tc_func_21.rb +0 -541
  101. data/test/tc_glu.rb +0 -310
  102. data/test/tc_include_gl.rb +0 -35
  103. data/test/tc_require_gl.rb +0 -34
@@ -9,7 +9,7 @@ require 'uri'
9
9
  require 'rbconfig'
10
10
  require 'pathname'
11
11
 
12
- ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.3'
12
+ ENV['RUBY_CC_VERSION'] ||= '1.9.3'
13
13
 
14
14
  # Cross-compilation constants
15
15
  COMPILE_HOME = Pathname( "build" ).expand_path
@@ -94,6 +94,7 @@ end
94
94
  task LIBFREEGLUT_A => [LIBFREEGLUT_MAKEFILE] do |t|
95
95
  Dir.chdir( STATIC_LIBFREEGLUT_BUILDDIR ) do
96
96
  sh "make -j#{NUM_CPUS} install"
97
+ (STATIC_INSTALLDIR + "lib" + "libglut.dll.a").unlink
97
98
  end
98
99
  end
99
100
 
@@ -101,4 +102,6 @@ desc "compile static libraries"
101
102
  task :static_libs => [ LIBFREEGLUT_A ]
102
103
 
103
104
  desc 'cross compile required libs for win32'
104
- task :cross => [ :static_libs ]
105
+ task :cross => [ :static_libs ] do
106
+ ENV['CROSS_COMPILING'] = 'yes'
107
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
Binary file
Binary file
Binary file
@@ -2,12 +2,10 @@
2
2
  # Name: nehe_lesson02.rb
3
3
  # Purpose: An implementation of NeHe's OpenGL Lesson #02
4
4
  # using ruby-opengl (http://nehe.gamedev.net/)
5
- #
5
+ #
6
6
 
7
- require "gl"
8
- require "glu"
9
- require "glut"
10
- require "mathn"
7
+ require 'opengl'
8
+ require 'mathn'
11
9
 
12
10
  # Add GL and GLUT namespaces in to make porting easier
13
11
  include Gl
@@ -15,103 +13,104 @@ include Glu
15
13
  include Glut
16
14
 
17
15
  # Placeholder for the window object
18
- window = ""
19
-
20
- def init_gl_window(width = 640, height = 480)
21
- # Background color to black
22
- glClearColor(0.0, 0.0, 0.0, 0)
23
- # Enables clearing of depth buffer
24
- glClearDepth(1.0)
25
- # Set type of depth test
26
- glDepthFunc(GL_LEQUAL)
27
- # Enable depth testing
28
- glEnable(GL_DEPTH_TEST)
29
- # Enable smooth color shading
30
- glShadeModel(GL_SMOOTH)
31
-
32
- glMatrixMode(GL_PROJECTION)
33
- glLoadIdentity
34
- # Calculate aspect ratio of the window
35
- gluPerspective(45.0, width / height, 0.1, 100.0)
36
-
37
- glMatrixMode(GL_MODELVIEW)
38
-
39
- draw_gl_scene
16
+ window = nil
17
+
18
+ def init_gl_window width = 640, height = 480
19
+ # Background color to black
20
+ glClearColor 0.0, 0.0, 0.0, 0
21
+ # Enables clearing of depth buffer
22
+ glClearDepth 1.0
23
+ # Set type of depth test
24
+ glDepthFunc GL_LEQUAL
25
+ # Enable depth testing
26
+ glEnable GL_DEPTH_TEST
27
+ # Enable smooth color shading
28
+ glShadeModel GL_SMOOTH
29
+
30
+ glMatrixMode GL_PROJECTION
31
+ glLoadIdentity
32
+ # Calculate aspect ratio of the window
33
+ gluPerspective 45.0, width / height, 0.1, 100.0
34
+
35
+ glMatrixMode GL_MODELVIEW
36
+
37
+ draw_gl_scene
40
38
  end
41
39
 
42
40
  #reshape = Proc.new do |width, height|
43
- def reshape(width, height)
44
- height = 1 if height == 0
41
+ def reshape width, height
42
+ height = 1 if height == 0
45
43
 
46
- # Reset current viewpoint and perspective transformation
47
- glViewport(0, 0, width, height)
44
+ # Reset current viewpoint and perspective transformation
45
+ glViewport 0, 0, width, height
48
46
 
49
- glMatrixMode(GL_PROJECTION)
50
- glLoadIdentity
47
+ glMatrixMode GL_PROJECTION
48
+ glLoadIdentity
51
49
 
52
- gluPerspective(45.0, width / height, 0.1, 100.0)
50
+ gluPerspective 45.0, width / height, 0.1, 100.0
53
51
  end
54
52
 
55
53
  #draw_gl_scene = Proc.new do
56
54
  def draw_gl_scene
57
- # Clear the screen and depth buffer
58
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
59
-
60
- # Reset the view
61
- glMatrixMode(GL_MODELVIEW)
62
- glLoadIdentity
63
-
64
- # Move left 1.5 units and into the screen 6.0 units
65
- glTranslatef(-1.5, 0.0, -6.0)
66
-
67
- # Draw a triangle
68
- glBegin(GL_POLYGON)
69
- glVertex3f( 0.0, 1.0, 0.0)
70
- glVertex3f( 1.0, -1.0, 0.0)
71
- glVertex3f(-1.0, -1.0, 0.0)
72
- glEnd
73
-
74
- # Move right 3 units
75
- glTranslatef(3.0, 0.0, 0.0)
76
-
77
- # Draw a rectangle
78
- glBegin(GL_QUADS)
79
- glVertex3f(-1.0, 1.0, 0.0)
80
- glVertex3f( 1.0, 1.0, 0.0)
81
- glVertex3f( 1.0, -1.0, 0.0)
82
- glVertex3f(-1.0, -1.0, 0.0)
83
- glEnd
84
-
85
- # Swap buffers for display
86
- glutSwapBuffers
55
+ # Clear the screen and depth buffer
56
+ glClear GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
57
+
58
+ # Reset the view
59
+ glMatrixMode GL_MODELVIEW
60
+ glLoadIdentity
61
+
62
+ # Move left 1.5 units and into the screen 6.0 units
63
+ glTranslatef -1.5, 0.0, -6.0
64
+
65
+ # Draw a triangle
66
+ glBegin GL_POLYGON do
67
+ glVertex3f 0.0, 1.0, 0.0
68
+ glVertex3f 1.0, -1.0, 0.0
69
+ glVertex3f -1.0, -1.0, 0.0
70
+ end
71
+
72
+ # Move right 3 units
73
+ glTranslatef 3.0, 0.0, 0.0
74
+
75
+ # Draw a rectangle
76
+ glBegin GL_QUADS do
77
+ glVertex3f -1.0, 1.0, 0.0
78
+ glVertex3f 1.0, 1.0, 0.0
79
+ glVertex3f 1.0, -1.0, 0.0
80
+ glVertex3f -1.0, -1.0, 0.0
81
+ end
82
+
83
+ # Swap buffers for display
84
+ glutSwapBuffers
87
85
  end
88
86
 
89
- # The idle function to handle
87
+ # The idle function to handle
90
88
  def idle
91
- glutPostRedisplay
89
+ glutPostRedisplay
92
90
  end
93
91
 
94
92
  # Keyboard handler to exit when ESC is typed
95
93
  keyboard = lambda do |key, x, y|
96
- case(key)
97
- when ?\e
98
- glutDestroyWindow(window)
99
- exit(0)
100
- end
101
- glutPostRedisplay
94
+ case key
95
+ when ?\e
96
+ glutDestroyWindow window
97
+ exit(0)
98
+ end
99
+ glutPostRedisplay
102
100
  end
103
101
 
104
102
 
105
103
  # Initliaze our GLUT code
106
- glutInit;
104
+ glutInit
107
105
  # Setup a double buffer, RGBA color, alpha components and depth buffer
108
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
109
- glutInitWindowSize(640, 480);
110
- glutInitWindowPosition(0, 0);
111
- window = glutCreateWindow("NeHe Lesson 02 - ruby-opengl version");
112
- glutDisplayFunc(method(:draw_gl_scene).to_proc);
113
- glutReshapeFunc(method(:reshape).to_proc);
114
- glutIdleFunc(method(:idle).to_proc);
115
- glutKeyboardFunc(keyboard);
116
- init_gl_window(640, 480)
117
- glutMainLoop();
106
+ glutInitDisplayMode GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH
107
+ glutInitWindowSize 640, 480
108
+ glutInitWindowPosition 0, 0
109
+ window = glutCreateWindow "NeHe Lesson 02 - ruby-opengl version"
110
+ glutIdleFunc :idle
111
+ glutDisplayFunc :draw_gl_scene
112
+ glutReshapeFunc :reshape
113
+ glutKeyboardFunc keyboard
114
+ init_gl_window 640, 480
115
+ glutMainLoop
116
+
@@ -2,12 +2,10 @@
2
2
  # Name: nehe_lesson03.rb
3
3
  # Purpose: An implementation of NeHe's OpenGL Lesson #03
4
4
  # using ruby-opengl (http://nehe.gamedev.net/)
5
- #
5
+ #
6
6
 
7
- require "gl"
8
- require "glu"
9
- require "glut"
10
- require "mathn"
7
+ require 'opengl'
8
+ require 'mathn'
11
9
 
12
10
  # Add GL and GLUT namespaces in to make porting easier
13
11
  include Gl
@@ -15,108 +13,110 @@ include Glu
15
13
  include Glut
16
14
 
17
15
  # Placeholder for the window object
18
- window = ""
19
-
20
- def init_gl_window(width = 640, height = 480)
21
- # Background color to black
22
- glClearColor(0.0, 0.0, 0.0, 0)
23
- # Enables clearing of depth buffer
24
- glClearDepth(1.0)
25
- # Set type of depth test
26
- glDepthFunc(GL_LEQUAL)
27
- # Enable depth testing
28
- glEnable(GL_DEPTH_TEST)
29
- # Enable smooth color shading
30
- glShadeModel(GL_SMOOTH)
31
-
32
- glMatrixMode(GL_PROJECTION)
33
- glLoadIdentity
34
- # Calculate aspect ratio of the window
35
- gluPerspective(45.0, width / height, 0.1, 100.0)
36
-
37
- glMatrixMode(GL_MODELVIEW)
38
-
39
- draw_gl_scene
16
+ window = nil
17
+
18
+ def init_gl_window width = 640, height = 480
19
+ # Background color to black
20
+ glClearColor 0.0, 0.0, 0.0, 0
21
+ # Enables clearing of depth buffer
22
+ glClearDepth 1.0
23
+ # Set type of depth test
24
+ glDepthFunc GL_LEQUAL
25
+ # Enable depth testing
26
+ glEnable GL_DEPTH_TEST
27
+ # Enable smooth color shading
28
+ glShadeModel GL_SMOOTH
29
+
30
+ glMatrixMode GL_PROJECTION
31
+ glLoadIdentity
32
+ # Calculate aspect ratio of the window
33
+ gluPerspective 45.0, width / height, 0.1, 100.0
34
+
35
+ glMatrixMode GL_MODELVIEW
36
+
37
+ draw_gl_scene
40
38
  end
41
39
 
42
40
  #reshape = Proc.new do |width, height|
43
- def reshape(width, height)
44
- height = 1 if height == 0
41
+ def reshape width, height
42
+ height = 1 if height == 0
45
43
 
46
- # Reset current viewpoint and perspective transformation
47
- glViewport(0, 0, width, height)
44
+ # Reset current viewpoint and perspective transformation
45
+ glViewport 0, 0, width, height
48
46
 
49
- glMatrixMode(GL_PROJECTION)
50
- glLoadIdentity
47
+ glMatrixMode GL_PROJECTION
48
+ glLoadIdentity
51
49
 
52
- gluPerspective(45.0, width / height, 0.1, 100.0)
50
+ gluPerspective 45.0, width / height, 0.1, 100.0
53
51
  end
54
52
 
55
53
  #draw_gl_scene = Proc.new do
56
54
  def draw_gl_scene
57
- # Clear the screen and depth buffer
58
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
59
-
60
- # Reset the view
61
- glMatrixMode(GL_MODELVIEW)
62
- glLoadIdentity
63
-
64
- # Move left 1.5 units and into the screen 6.0 units
65
- glTranslatef(-1.5, 0.0, -6.0)
66
-
67
- # Draw a triangle
68
- glBegin(GL_POLYGON)
69
- glColor3f(1.0, 0.0, 0.0)
70
- glVertex3f( 0.0, 1.0, 0.0)
71
- glColor3f(0.0, 1.0, 0.0)
72
- glVertex3f( 1.0, -1.0, 0.0)
73
- glColor3f(0.0, 0.0, 1.0)
74
- glVertex3f(-1.0, -1.0, 0.0)
75
- glEnd
76
-
77
- # Move right 3 units
78
- glTranslatef(3.0, 0.0, 0.0)
79
-
80
- # Draw a rectangle
81
- # Set it to a blue color one time only
82
- glColor3f(0.5, 0.5, 1.0)
83
- glBegin(GL_QUADS)
84
- glVertex3f(-1.0, 1.0, 0.0)
85
- glVertex3f( 1.0, 1.0, 0.0)
86
- glVertex3f( 1.0, -1.0, 0.0)
87
- glVertex3f(-1.0, -1.0, 0.0)
88
- glEnd
89
-
90
- # Swap buffers for display
91
- glutSwapBuffers
55
+ # Clear the screen and depth buffer
56
+ glClear GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
57
+
58
+ # Reset the view
59
+ glMatrixMode GL_MODELVIEW
60
+ glLoadIdentity
61
+
62
+ # Move left 1.5 units and into the screen 6.0 units
63
+ glTranslatef -1.5, 0.0, -6.0
64
+
65
+ # Draw a triangle setting the color to red, green, blue for each respective
66
+ # vertex
67
+ glBegin GL_POLYGON do
68
+ glColor3f 1.0, 0.0, 0.0
69
+ glVertex3f 0.0, 1.0, 0.0
70
+ glColor3f 0.0, 1.0, 0.0
71
+ glVertex3f 1.0, -1.0, 0.0
72
+ glColor3f 0.0, 0.0, 1.0
73
+ glVertex3f -1.0, -1.0, 0.0
74
+ end
75
+
76
+ # Move right 3 units
77
+ glTranslatef 3.0, 0.0, 0.0
78
+
79
+ # Set the color to medium blue for all vertexes
80
+ glColor3f 0.5, 0.5, 1.0
81
+ # Draw a rectangle
82
+ glBegin GL_QUADS do
83
+ glVertex3f -1.0, 1.0, 0.0
84
+ glVertex3f 1.0, 1.0, 0.0
85
+ glVertex3f 1.0, -1.0, 0.0
86
+ glVertex3f -1.0, -1.0, 0.0
87
+ end
88
+
89
+ # Swap buffers for display
90
+ glutSwapBuffers
92
91
  end
93
92
 
94
- # The idle function to handle
93
+ # The idle function to handle
95
94
  def idle
96
- glutPostRedisplay
95
+ glutPostRedisplay
97
96
  end
98
97
 
99
98
  # Keyboard handler to exit when ESC is typed
100
99
  keyboard = lambda do |key, x, y|
101
- case(key)
102
- when ?\e
103
- glutDestroyWindow(window)
104
- exit(0)
105
- end
106
- glutPostRedisplay
100
+ case key
101
+ when ?\e
102
+ glutDestroyWindow window
103
+ exit(0)
104
+ end
105
+ glutPostRedisplay
107
106
  end
108
107
 
109
108
 
110
109
  # Initliaze our GLUT code
111
- glutInit;
110
+ glutInit
112
111
  # Setup a double buffer, RGBA color, alpha components and depth buffer
113
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);
114
- glutInitWindowSize(640, 480);
115
- glutInitWindowPosition(0, 0);
116
- window = glutCreateWindow("NeHe Lesson 03 - ruby-opengl version");
117
- glutDisplayFunc(method(:draw_gl_scene).to_proc);
118
- glutReshapeFunc(method(:reshape).to_proc);
119
- glutIdleFunc(method(:idle).to_proc);
120
- glutKeyboardFunc(keyboard);
121
- init_gl_window(640, 480)
122
- glutMainLoop();
112
+ glutInitDisplayMode GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH
113
+ glutInitWindowSize 640, 480
114
+ glutInitWindowPosition 0, 0
115
+ window = glutCreateWindow "NeHe Lesson 03 - ruby-opengl version"
116
+ glutIdleFunc :idle
117
+ glutDisplayFunc :draw_gl_scene
118
+ glutReshapeFunc :reshape
119
+ glutKeyboardFunc keyboard
120
+ init_gl_window 640, 480
121
+ glutMainLoop
122
+