ruby-opengl 0.60.1 → 0.61.0

Sign up to get free protection for your applications and to get access to all the features.
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,148 +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
- # wrap.c
38
- # This program texture maps a checkerboard image onto
39
- # two rectangles. This program demonstrates the wrapping
40
- # modes, if the texture coordinates fall outside 0.0 and 1.0.
41
- # Interaction: Pressing the 's' and 'S' keys switch the
42
- # wrapping between clamping and repeating for the s parameter.
43
- # The 't' and 'T' keys control the wrapping for the t parameter.
44
- #
45
- # If running this program on OpenGL 1.0, texture objects are
46
- # not used.
47
- require 'opengl'
48
- require 'mathn'
49
- include Gl,Glu,Glut
50
-
51
- # Create checkerboard texture
52
- CheckImageWidth=64
53
- CheckImageHeight=64
54
- $checkImage = []
55
-
56
- $texName = 0
57
-
58
- def makeCheckImage
59
- for i in 0..CheckImageHeight-1
60
- for j in 0..CheckImageWidth-1
61
- c = if (((i&0x8)==0)!=((j&0x8)==0)) then 255 else 0 end
62
- $checkImage[(i*CheckImageWidth+j)*4+0] = c
63
- $checkImage[(i*CheckImageWidth+j)*4+1] = c
64
- $checkImage[(i*CheckImageWidth+j)*4+2] = c
65
- $checkImage[(i*CheckImageWidth+j)*4+3] = 255
66
- end
67
- end
68
- end
69
-
70
- def init
71
- glClearColor(0.0, 0.0, 0.0, 0.0)
72
- glShadeModel(GL_FLAT)
73
- glEnable(GL_DEPTH_TEST)
74
-
75
- makeCheckImage()
76
- glPixelStore(GL_UNPACK_ALIGNMENT, 1)
77
-
78
- $texName = glGenTextures(1)
79
- glBindTexture(GL_TEXTURE_2D, $texName[0])
80
-
81
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
82
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
83
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
84
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
85
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CheckImageWidth,
86
- CheckImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, $checkImage.pack("C*"))
87
- end
88
-
89
- display = Proc.new do
90
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
91
- glEnable(GL_TEXTURE_2D)
92
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
93
- glBindTexture(GL_TEXTURE_2D, $texName[0])
94
-
95
- glBegin(GL_QUADS)
96
- glTexCoord(0.0, 0.0); glVertex(-2.0, -1.0, 0.0)
97
- glTexCoord(0.0, 3.0); glVertex(-2.0, 1.0, 0.0)
98
- glTexCoord(3.0, 3.0); glVertex(0.0, 1.0, 0.0)
99
- glTexCoord(3.0, 0.0); glVertex(0.0, -1.0, 0.0)
100
-
101
- glTexCoord(0.0, 0.0); glVertex(1.0, -1.0, 0.0)
102
- glTexCoord(0.0, 3.0); glVertex(1.0, 1.0, 0.0)
103
- glTexCoord(3.0, 3.0); glVertex(2.41421, 1.0, -1.41421)
104
- glTexCoord(3.0, 0.0); glVertex(2.41421, -1.0, -1.41421)
105
- glEnd()
106
- glutSwapBuffers()
107
- glDisable(GL_TEXTURE_2D)
108
- end
109
-
110
- reshape = Proc.new do |w, h|
111
- glViewport(0, 0, w, h)
112
- glMatrixMode(GL_PROJECTION)
113
- glLoadIdentity()
114
- GLU.Perspective(60.0, w/h, 1.0, 30.0)
115
- glMatrixMode(GL_MODELVIEW)
116
- glLoadIdentity()
117
- glTranslate(0.0, 0.0, -3.6)
118
- end
119
-
120
- keyboard = Proc.new do |key, x, y|
121
- case (key)
122
- when ?s
123
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
124
- glutPostRedisplay()
125
- when ?S
126
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
127
- glutPostRedisplay()
128
- when ?t
129
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
130
- glutPostRedisplay()
131
- when ?T
132
- glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
133
- glutPostRedisplay()
134
- when ?\e
135
- exit(0)
136
- end
137
- end
138
-
139
- glutInit
140
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
141
- glutInitWindowSize(500, 500)
142
- glutInitWindowPosition(100, 100)
143
- glutCreateWindow($0)
144
- init()
145
- glutDisplayFunc(display)
146
- glutReshapeFunc(reshape)
147
- glutKeyboardFunc(keyboard)
148
- glutMainLoop()
@@ -1,337 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Purpose: Factor out and clean up common code from OpenGL benchmarks
4
-
5
- # Copyright (c) 2006, Geoff Broadwell; this module is released
6
- # as open source and may be distributed and modified under the terms
7
- # of either the Artistic License or the GNU General Public License,
8
- # in the same manner as Perl itself. These licenses should have been
9
- # distributed to you as part of your Perl distribution, and can be
10
- # read using `perldoc perlartistic` and `perldoc perlgpl` respectively.
11
-
12
- # Conversion to ruby by Jan Dvorak <jan.dvorak@kraxnet.cz>
13
-
14
- module OGLBench
15
-
16
- require 'opengl'
17
- include Gl,Glu,Glut
18
-
19
- require 'getoptlong'
20
-
21
- $VERSION = '0.1.4'
22
-
23
- # Cached config and state, for simpler API
24
- $CACHED = {}
25
-
26
- # All resolutions listed in landscape orientation,
27
- # even for natively portrait devices such as handhelds.
28
- # Also, 'q' is annoyingly used as a prefix to mean both
29
- # 'quarter' and 'quad'.
30
- $KNOWN_RES = {
31
- 'qqvga' => [ 160, 120, 'Quarter Quarter VGA' ],
32
- 'palm' => [ 160, 160, 'Original Palm OS Devices' ],
33
- 'eigthvga' => [ 240, 160, '1/8 VGA' ],
34
- 'vcrntsc' => [ 240, 480, 'VCR NTSC' ],
35
- 'vcrpal' => [ 240, 576, 'VCR PAL' ],
36
- 'qcif' => [ 176, 144, 'Quarter CIF' ],
37
- 'gears' => [ 300, 300, 'OpenGL Gears Benchmark' ],
38
- 'glxgears' => [ 300, 300, 'OpenGL Gears Benchmark' ],
39
- 'cga' => [ 320, 200, 'IBM PC CGA (Color Graphics Adapter)' ],
40
- 'atarist16' => [ 320, 200, 'Atari ST 16 Color' ],
41
- 'qvga' => [ 320, 240, 'Quarter VGA' ],
42
- 'modex' => [ 320, 240, 'VGA Mode X' ],
43
- 'pocketpc' => [ 320, 240, 'Common Pocket PCs' ],
44
- 'clie' => [ 320, 320, 'Sony Clie (Palm OS)' ],
45
- 'vcdntsc' => [ 352, 240, 'VCD (Video CD) NTSC' ],
46
- 'vcdpal' => [ 352, 288, 'VCD (Video CD) PAL' ],
47
- 'cif' => [ 352, 288, 'CIF (Common Image Format)' ],
48
- 'tweakvga' => [ 360, 480, 'Highest 256-color mode for VGA monitors' ],
49
- 'svhsntsc' => [ 400, 480, 'S-VHS NTSC' ],
50
- 'svhspal' => [ 400, 576, 'S-VHS PAL' ],
51
- 'tungsten' => [ 480, 320, 'Tungsten (Palm OS)' ],
52
- 'bwmac9' => [ 512, 342, 'Black & White 9" Mac' ],
53
- 'maclc' => [ 512, 384, 'Mac LC' ],
54
- 'ldntsc' => [ 560, 480, 'Laserdisc NTSC' ],
55
- 'ldpal' => [ 560, 576, 'Laserdisc PAL' ],
56
- 'atarist4' => [ 640, 200, 'Atari ST 4 Color' ],
57
- 'ega' => [ 640, 350, 'IBM PC-AT EGA (Extended Graphics Adapter)' ],
58
- 'atarist2' => [ 640, 400, 'Atari ST 2 Color' ],
59
- 'qcga' => [ 640, 400, 'Quad CGA' ],
60
- 'vga400' => [ 640, 400, 'VGA 400 Line' ],
61
- 'pgc' => [ 640, 480, 'Professional Graphics Controller' ],
62
- 'mcga' => [ 640, 480, 'IBM PS/2 MultiColor Graphics Adapter' ],
63
- 'vga' => [ 640, 480, 'IBM PS/2 VGA (Video Graphics Array)' ],
64
- 'edtv1' => [ 640, 480, 'EDTV 1' ],
65
- 'edtv2' => [ 704, 480, 'EDTV 2' ],
66
- 'hgc' => [ 720, 348, 'Hercules Graphics Controller' ],
67
- 'mda' => [ 720, 350, 'IBM PC MDA (Monochrome Display Adapter)' ],
68
- 'lisa' => [ 720, 360, 'Apple Lisa' ],
69
- 'dv525' => [ 720, 480, 'Digital Video 525/60 (D-1 NTSC, DVD NTSC)' ],
70
- 'd1ntsc' => [ 720, 480, 'Digital Video 525/60 (D-1 NTSC, DVD NTSC)' ],
71
- 'dvdntsc' => [ 720, 480, 'Digital Video 525/60 (D-1 NTSC, DVD NTSC)' ],
72
- 'sp525' => [ 720, 540, 'Digital Video 525/60 (D-1 NTSC Square Pix)' ],
73
- 'spd1ntsc' => [ 720, 540, 'Digital Video 525/60 (D-1 NTSC Square Pix)' ],
74
- 'dv625' => [ 720, 576, 'Digital Video 625/50 (PAL, DVD PAL)' ],
75
- 'dvpal' => [ 720, 576, 'Digital Video 625/50 (PAL, DVD PAL)' ],
76
- 'dvdpal' => [ 720, 576, 'Digital Video 625/50 (PAL, DVD PAL)' ],
77
- 'ns525' => [ 768, 483, 'Non-Standard DV 525/60' ],
78
- 'sp625' => [ 768, 576, 'Square Pixel DV 625/50' ],
79
- 'wga' => [ 800, 480, 'Wide VGA' ],
80
- 'svga' => [ 800, 600, 'Super VGA' ],
81
- 'edtv3' => [ 852, 480, 'EDTV 3' ],
82
- 'ws480' => [ 854, 480, 'Wide Screen 480 Line' ],
83
- 'ns625' => [ 948, 576, 'Non-Standard DV 625/60' ],
84
- 'aacsict' => [ 960, 540, 'AACS Image Constraint Token, Degraded 1080' ],
85
- 'ws576' => [ 1024, 576, 'Wide Screen 576 Line' ],
86
- '8514' => [ 1024, 768, 'IBM 8514/A' ],
87
- '8514a' => [ 1024, 768, 'IBM 8514/A' ],
88
- 'evga' => [ 1024, 768, 'VESA Extended VGA' ],
89
- 'xga' => [ 1024, 768, 'IBM XGA (eXtended Graphics Array)' ],
90
- 'nextcube' => [ 1120, 832, 'NeXT Cube' ],
91
- 'apple1mp' => [ 1152, 864, 'Apple "1 Megapixel"' ],
92
- 'xga+' => [ 1152, 864, 'XGA+' ],
93
- 'olpcmono' => [ 1200, 900, 'One Laptop Per Child Mono Mode (true res)' ],
94
- 'olpc' => [ 1200, 900, 'One Laptop Per Child Mono Mode (true res)' ],
95
- '720i' => [ 1280, 720, 'HDTV 720 Line Interlaced' ],
96
- '720p' => [ 1280, 720, 'HDTV 720 Line Progressive' ],
97
- 'hd720' => [ 1280, 720, 'HDTV 720 Line' ],
98
- 'xga43' => [ 1280, 960, '4:3 XGA Alternative' ],
99
- 'xga960' => [ 1280, 960, '4:3 XGA Alternative' ],
100
- 'sxga' => [ 1280, 1024, 'Super XGA' ],
101
- 'wxga' => [ 1366, 768, 'Wide XGA' ],
102
- 'wxga768' => [ 1366, 768, 'Wide XGA' ],
103
- 'wsxga' => [ 1440, 900, 'Wide Super XGA (Low Variant)' ],
104
- 'wsxga1' => [ 1440, 900, 'Wide Super XGA (Low Variant)' ],
105
- 'wxga+' => [ 1440, 900, 'Wide XGA+' ],
106
- 'sxga+' => [ 1440, 1050, 'Super XGA+' ],
107
- 'wsxga2' => [ 1600, 1024, 'Wide Super XGA (High Variant)' ],
108
- 'uxga' => [ 1600, 1200, 'Ultra XGA' ],
109
- 'wsxga+' => [ 1680, 1050, 'Wide Super XGA+' ],
110
- 'academy2k' => [ 1828, 1332, 'Digital Film Academy 1.375:1 @ 2K' ],
111
- '1080i' => [ 1920, 1080, 'HDTV 1080 Line Interlaced' ],
112
- '1080p' => [ 1920, 1080, 'HDTV 1080 Line Progressive' ],
113
- 'hd1080' => [ 1920, 1080, 'HDTV 1080 Line' ],
114
- 'wuxga' => [ 1920, 1200, 'Wide Ultra XGA' ],
115
- 'dc2k1' => [ 1998, 1080, 'Digital Film Digital Cinema 1.85:1 @ 2K ' ],
116
- 'dc2k2' => [ 2048, 858, 'Digital Film Digital Cinema 2.39:1 @ 2K ' ],
117
- 'eurohd' => [ 2048, 1152, 'European HDTV' ],
118
- 'qxga' => [ 2048, 1536, 'Quad XGA' ],
119
- 'wqxga' => [ 2560, 1600, 'Wide Quad XGA' ],
120
- 'qsxga' => [ 2560, 2048, 'Quad Super XGA' ],
121
- 'wqsxga' => [ 3200, 2048, 'Wide Quad Super XGA' ],
122
- 'quxga' => [ 3200, 2400, 'Quad Ultra XGA' ],
123
- 'academy4k' => [ 3656, 2664, 'Digital Film Academy 1.375:1 @ 4K' ],
124
- 'wquxga' => [ 3840, 2400, 'Wide Quad Ultra XGA' ],
125
- 'dc4k1' => [ 3996, 2160, 'Digital Film Digital Cinema 1.85:1 @ 4K ' ],
126
- 'dc4k2' => [ 4096, 1714, 'Digital Film Digital Cinema 2.39:1 @ 4K ' ],
127
- 'hxga' => [ 4096, 3072, 'Hexadecatuple XGA' ],
128
- 'whxga' => [ 5120, 3200, 'Wide Hexadecatuple XGA' ],
129
- 'hsxga' => [ 5120, 4096, 'Hexadecatuple Super XGA' ],
130
- 'whsxga' => [ 6400, 4096, 'Wide Hexadecatuple Super XGA' ],
131
- 'huxga' => [ 6400, 4800, 'Hexadecatuple Ultra XGA' ],
132
- 'whuxga' => [ 7680, 4800, 'Wide Hexadecatuple Ultra XGA' ],
133
- }
134
-
135
- def OGLBench.w_h_from_geometry(geom)
136
- geometry = geom.downcase
137
-
138
- return $~[1,2] if geometry =~ /^(\d+)x(\d+)$/
139
-
140
- dims = $KNOWN_RES[geometry] || [0, 0]
141
- dims[0,2]
142
- end
143
-
144
- def OGLBench.show_known_geometries
145
- puts "Known geometries:"
146
-
147
- # convert the hash to array, sort by resolution and iterate
148
- $KNOWN_RES.sort {|a,b| a[1][0,2] <=> b[1][0,2] }.each do |row|
149
- name, res = row
150
- x,y,fullname = res
151
- printf "%-10s %4d x %4d %s\n", name, x, y, fullname
152
- end
153
- end
154
-
155
- def OGLBench.show_usage(conf = $CACHED[:conf])
156
- usage = conf[:usage]
157
-
158
- if (not conf[:extra_usage].empty?)
159
- conf[:_USAGE_LABEL_GENERAL] = "\nGENERAL OPTIONS:"
160
- usage = "#{conf[:usage]}\nOTHER OPTIONS:\n#{conf[:extra_usage]}"
161
- else
162
- conf[:_USAGE_LABEL_GENERAL] = ''
163
- end
164
-
165
- usage.gsub!(/\$(\w+)/) do conf[$1.to_sym] end
166
-
167
- print usage
168
- end
169
-
170
- def OGLBench.show_basic_config(conf,gl_info,version)
171
- print <<CONFIG
172
- #{conf[:title]}, version #{version}, with Ruby #{RUBY_VERSION}
173
-
174
- window size: #{conf[:width]} x #{conf[:height]}
175
- full screen: #{conf[:fs]}
176
- rgba bits: #{gl_info[:r]} #{gl_info[:g]} #{gl_info[:b]} #{gl_info[:a]}
177
- depth bits: #{gl_info[:d]}
178
- min frames/test: #{conf[:frames]}
179
- min seconds/test: #{conf[:seconds]}
180
- CONFIG
181
- end
182
-
183
- def OGLBench.friendly_booleans(conf)
184
- booleans = conf[:booleans].update(conf[:extra_booleans])
185
-
186
- booleans.each_pair do |logical,readable|
187
- conf[readable] = (conf[logical] ? 'yes' : 'no')
188
- end
189
- end
190
-
191
- def OGLBench.basic_init(extra_conf = nil,extra_options = nil)
192
- usage = <<'USAGE';
193
- $title
194
-
195
- usage: $0 [options...]
196
- $_USAGE_LABEL_GENERAL
197
- -f |--frames=[NNN] Set minimum frame count [$frames]
198
- -s |--seconds=[NNN] Set minimum time [$seconds seconds]
199
- --fs|--fullscreen Try to use full screen [$fs]
200
- -g |--geometry=[WWW]x[HHH] Set viewport size [$width x $height]
201
- -g |--geometry=<name> Set viewport size via well-known name
202
- -k |--known-geometries Show list of known geometry names
203
- -h |-?|--help Show this help message
204
- USAGE
205
-
206
- # conf = {:usage => usage, :frames => "150"}
207
- # show_usage(conf)
208
- # FIXME: $0 ?
209
-
210
- conf = {
211
- :title => 'Ruby-OpenGL Benchmark',
212
- :usage => usage,
213
- :extra_usage => '',
214
- "0".to_sym => $0,
215
-
216
- :frames => 100,
217
- :seconds => 10,
218
- :geometry => '300x300',
219
-
220
- :fullscreen => false,
221
- :known => false,
222
- :help => false,
223
-
224
- :booleans => {
225
- :fullscreen => :fs,
226
- :known => :show_known,
227
- :help => :show_help,
228
- },
229
- :extra_booleans => {},
230
- }
231
-
232
- conf.update(extra_conf) if extra_conf
233
-
234
- opts = GetoptLong.new(
235
- [ "--frames", "-f", GetoptLong::REQUIRED_ARGUMENT ],
236
- [ "--seconds", "-s", GetoptLong::REQUIRED_ARGUMENT ],
237
- [ "--geometry", "-g", GetoptLong::REQUIRED_ARGUMENT ],
238
- [ "--fullscreen", "--fs", GetoptLong::NO_ARGUMENT ],
239
- [ "--known", "-k","--known-geometries", GetoptLong::NO_ARGUMENT ],
240
- [ "--help", "-h", "-?", GetoptLong::NO_ARGUMENT ]
241
- )
242
-
243
- opts.each do |opt, arg|
244
- name = opt.tr('-','')
245
- if arg.empty?
246
- conf[name.to_sym] = true
247
- else
248
- conf[name.to_sym] = arg
249
- end
250
- end
251
-
252
- friendly_booleans(conf)
253
-
254
-
255
- geometry = conf[:geometry]
256
- w,h = w_h_from_geometry(geometry)
257
- conf[:width] = w.to_i
258
- conf[:height] = h.to_i
259
-
260
- $stdout.sync = true
261
-
262
- if (conf[:help])
263
- show_usage(conf)
264
- exit(0)
265
- end
266
-
267
- if (conf[:known])
268
- show_known_geometries()
269
- exit(0)
270
- end
271
-
272
-
273
- app = init_opengl(conf)
274
- gl_info = get_gl_info(app)
275
-
276
- [conf, app, gl_info]
277
- end
278
-
279
-
280
- def OGLBench.init_opengl(conf)
281
- w,h = conf[:width], conf[:height]
282
-
283
- raise "Could not determine sane width and height from '#{conf[:geometry]}'.\n" unless w > 0 && h > 0;
284
-
285
- glutInit()
286
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH)
287
- glutInitWindowSize(w,h)
288
- app = glutCreateWindow(conf[:title])
289
- glViewport(0, 0, w, h)
290
-
291
- glMatrixMode(GL_PROJECTION)
292
- glLoadIdentity
293
-
294
- glMatrixMode(GL_MODELVIEW)
295
- glLoadIdentity
296
-
297
- $CACHED[:conf] = conf
298
- $CACHED[:app] = app
299
-
300
- app
301
- end
302
-
303
- def OGLBench.get_gl_info(app = $CACHED[:app])
304
- gl_info = {}
305
-
306
- # These values are faked
307
- conf = $CACHED[:conf]
308
- gl_info[:r] = 8
309
- gl_info[:g] = 8
310
- gl_info[:b] = 8
311
- gl_info[:a] = 0
312
- gl_info[:d] = 24
313
-
314
- $CACHED[:gl_info] = gl_info
315
-
316
- gl_info
317
- end
318
-
319
- def OGLBench.fade_to_white(frac)
320
- glColor4f(frac, frac, frac, 1)
321
- glClearColor(frac, frac, frac, 1)
322
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
323
- glFinish
324
- end
325
-
326
- def OGLBench.draw_string(font_style,str,x,y)
327
- glRasterPos2i(x,y)
328
- str.each_byte do |char|
329
- glutBitmapCharacter(font_style, char)
330
- end
331
- end
332
-
333
- # def init_bitmap_font
334
- # def texture_from_texels
335
-
336
- end # end module
337
-