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
@@ -18,7 +18,7 @@ include Gl,Glu,Glut
18
18
 
19
19
  require 'getoptlong'
20
20
 
21
- $VERSION = '0.1.4'
21
+ VER = '0.1.4'
22
22
 
23
23
  # Cached config and state, for simpler API
24
24
  $CACHED = {}
@@ -334,4 +334,4 @@ end
334
334
  # def texture_from_texels
335
335
 
336
336
  end # end module
337
-
337
+
@@ -19,7 +19,7 @@ require 'mathn'
19
19
 
20
20
  require 'OGLBench'
21
21
 
22
- $VERSION = '0.1.24-ruby-p1'
22
+ VER = '0.1.24-ruby-p1'
23
23
 
24
24
  $test = 0
25
25
  $run = 0
@@ -144,7 +144,7 @@ The configuration for this series of tests will be as follows:
144
144
 
145
145
  EOM
146
146
 
147
- OGLBench.show_basic_config($conf, $gl_info, $VERSION)
147
+ OGLBench.show_basic_config($conf, $gl_info, VER)
148
148
 
149
149
  puts "standard runs: #{$slow.join(' ')}"
150
150
  puts "extra fast runs: #{$fast.join(' ')}"
@@ -107,8 +107,6 @@
107
107
  /* at least GL_MAX_VERTEX_ATTRIBS - usually 16 or 32 on today's high-end cards */
108
108
  #define _MAX_VERTEX_ATTRIBS 64
109
109
 
110
- typedef struct RArray RArray;
111
-
112
110
  extern VALUE cProc;
113
111
 
114
112
  /* For now we do not honor pixel store modes, so we need to
@@ -389,19 +387,12 @@ static inline void *load_gl_function(const char *name,int raise)
389
387
 
390
388
  #if defined(__APPLE__)
391
389
  void *library = NULL;
392
- char* symbolName;
393
- library = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
390
+ library = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY | RTLD_LOCAL | RTLD_FIRST);
394
391
 
395
392
  if (library == NULL)
396
393
  rb_raise(rb_eRuntimeError,"Can't load OpenGL library for dynamic loading");
397
394
 
398
- /* prepend a '_' for the Unix C symbol mangling convention */
399
- symbolName = ALLOC_N(char,strlen(name) + 2);
400
- symbolName[0] = '_';
401
- strcpy(symbolName+1, name);
402
-
403
- func_ptr = dlsym(library, symbolName);
404
- xfree(symbolName);
395
+ func_ptr = dlsym(library, name);
405
396
  dlclose(library);
406
397
  #elif HAVE_WGLGETPROCADDRESS
407
398
  func_ptr = wglGetProcAddress((LPCSTR)name);
@@ -65,8 +65,12 @@ FASTCONV(num2uint,unsigned long,FIX2ULONG,(unsigned int)NUM2ULONG)
65
65
 
66
66
  #undef FASTCONV
67
67
 
68
+ #define RUBY2GLENUM(x) \
69
+ (x) == Qtrue ? GL_TRUE : (((x) == Qfalse) ? GL_FALSE : NUM2INT(x))
70
+
68
71
  /* For conversion between ruby and GL boolean values */
69
- #define GLBOOL2RUBY(x) (x)==GL_TRUE? Qtrue :( (x)==GL_FALSE? Qfalse : INT2NUM((x)))
72
+ #define GLBOOL2RUBY(x) \
73
+ (x) == GL_TRUE ? Qtrue : ((x)==GL_FALSE ? Qfalse : INT2NUM((x)))
70
74
  #define RUBYBOOL2GL(x) (x)==Qtrue? GL_TRUE : GL_FALSE
71
75
 
72
76
  #define cond_GLBOOL2RUBY_FUNC(_name_,_type_,_conv_) \
@@ -110,8 +114,10 @@ cond_GLBOOL2RUBY_FUNC(cond_GLBOOL2RUBY_F,GLfloat,rb_float_new)
110
114
  cond_GLBOOL2RUBY_FUNC(cond_GLBOOL2RUBY_D,GLdouble,rb_float_new)
111
115
 
112
116
 
113
- /* For conversion between ruby array (or object that can be converted to array) and C array.
114
- The C array has to be preallocated by calling function. */
117
+ /* For conversion between ruby array (or object that can be converted to
118
+ * array) and C array.
119
+ *
120
+ * The C array has to be preallocated by calling function. */
115
121
  #define ARY2CTYPE(_type_,_convert_) \
116
122
  static inline long ary2c##_type_( arg, cary, maxlen ) \
117
123
  VALUE arg; \
@@ -135,7 +141,7 @@ ARY2CTYPE(byte,NUM2INT)
135
141
  ARY2CTYPE(ubyte,NUM2INT)
136
142
  ARY2CTYPE(short,NUM2INT)
137
143
  ARY2CTYPE(ushort,NUM2INT)
138
- ARY2CTYPE(boolean,NUM2INT)
144
+ ARY2CTYPE(boolean,GLBOOL2RUBY)
139
145
  ARY2CTYPE(float,NUM2DBL)
140
146
  ARY2CTYPE(double,NUM2DBL)
141
147
 
@@ -191,34 +197,39 @@ ARY2CMATCNT(double)
191
197
  ARY2CMATCNT(float)
192
198
  #undef ARY2CMATCNT
193
199
 
194
-
195
200
  #define EMPTY
196
201
  #define FREE(_x_) xfree(_x_);
197
202
 
198
- #define RET_ARRAY_OR_SINGLE(_size_,_conv_,_params_) RET_ARRAY_OR_SINGLE_FUNC(_size_,_conv_,_params_,EMPTY)
199
- #define RET_ARRAY_OR_SINGLE_FREE(_size_,_conv_,_params_) RET_ARRAY_OR_SINGLE_FUNC(_size_,_conv_,_params_,FREE(_params_))
200
-
201
- #define RET_ARRAY_OR_SINGLE_FUNC(_size_,_conv_,_params_,_extra_) \
202
- { \
203
- int iter; \
204
- VALUE return_array; \
205
- if (_size_ == 1) { \
206
- return_array = _conv_(_params_[0]); \
207
- } else { \
208
- return_array = rb_ary_new2(_size_); \
209
- for(iter=0;iter<_size_;iter++) \
210
- rb_ary_push(return_array, _conv_(_params_[iter])); \
211
- } \
212
- _extra_ \
213
- CHECK_GLERROR \
214
- return return_array; \
215
- }
216
-
217
- #define RET_ARRAY_OR_SINGLE_BOOL(_size_,_conv_,_enum_,_params_) RET_ARRAY_OR_SINGLE_BOOL_FUNC(_size_,_conv_,_enum_,_params_,EMPTY)
218
- #define RET_ARRAY_OR_SINGLE_BOOL_FREE(_size_,_conv_,_enum_,_params_) RET_ARRAY_OR_SINGLE_BOOL_FUNC(_size_,_conv_,_enum_,_params_,FREE(_params_))
219
-
220
- #define RET_ARRAY_OR_SINGLE_BOOL_FUNC(_size_,_conv_,_enum_,_params_,_extra_) \
221
- { \
203
+ #define RET_ARRAY_OR_SINGLE(_name_, _size_, _conv_, _params_) \
204
+ RET_ARRAY_OR_SINGLE_FUNC(_name_, _size_, _conv_, _params_, EMPTY)
205
+
206
+ #define RET_ARRAY_OR_SINGLE_FREE(_name, _size_, _conv_, _params_) \
207
+ RET_ARRAY_OR_SINGLE_FUNC(_name, _size_, _conv_, _params_, FREE(_params_))
208
+
209
+ #define RET_ARRAY_OR_SINGLE_FUNC(_name_, _size_, _conv_, _params_, _extra_) \
210
+ do { \
211
+ int iter; \
212
+ VALUE return_array; \
213
+ if (_size_ == 1) { \
214
+ return_array = _conv_(_params_[0]); \
215
+ } else { \
216
+ return_array = rb_ary_new2(_size_); \
217
+ for(iter=0;iter<_size_;iter++) \
218
+ rb_ary_push(return_array, _conv_(_params_[iter])); \
219
+ } \
220
+ _extra_ \
221
+ CHECK_GLERROR_FROM(_name_); \
222
+ return return_array; \
223
+ } while (0)
224
+
225
+ #define RET_ARRAY_OR_SINGLE_BOOL(_name_, _size_, _conv_, _enum_, _params_) \
226
+ RET_ARRAY_OR_SINGLE_BOOL_FUNC(_name_, _size_, _conv_, _enum_, _params_, EMPTY)
227
+
228
+ #define RET_ARRAY_OR_SINGLE_BOOL_FREE(_name_, _size_, _conv_, _enum_, _params_) \
229
+ RET_ARRAY_OR_SINGLE_BOOL_FUNC(_name_, _size_, _conv_, _enum_, _params_, FREE(_params_))
230
+
231
+ #define RET_ARRAY_OR_SINGLE_BOOL_FUNC(_name_, _size_, _conv_, _enum_, _params_, _extra_) \
232
+ do { \
222
233
  int iter; \
223
234
  VALUE return_array; \
224
235
  if (_size_ == 1) { \
@@ -229,6 +240,7 @@ ARY2CMATCNT(float)
229
240
  rb_ary_push(return_array, _conv_(_enum_,_params_[iter])); \
230
241
  } \
231
242
  _extra_ \
232
- CHECK_GLERROR \
243
+ CHECK_GLERROR_FROM(_name_); \
233
244
  return return_array; \
234
- }
245
+ } while (0)
246
+
@@ -13,16 +13,23 @@ def have_framework(fw, &b)
13
13
  end
14
14
  end unless respond_to? :have_framework
15
15
 
16
- dir_config("installed")
17
- $defs.push "-DGLUT_DISABLE_ATEXIT_HACK"
16
+ if ENV['CROSS_COMPILING']
17
+ dir_config("installed")
18
+
19
+ $defs.push "-DFREEGLUT_EXPORTS"
20
+
21
+ # libfreeglut is linked to gdi32 and winmm
22
+ have_library( 'gdi32', 'CreateDC' ) && append_library( $libs, 'gdi32' )
23
+ have_library( 'winmm', 'timeBeginPeriod' ) && append_library( $libs, 'winmm' )
24
+ end
18
25
 
19
26
  ok =
20
- (have_library('opengl32.lib') &&
21
- have_library('glu32.lib') &&
22
- have_library('glut32.lib')) ||
27
+ (have_library('opengl32.lib', 'glVertex3d') &&
28
+ have_library('glu32.lib', 'gluLookAt') &&
29
+ have_library('glut32.lib', 'gluSolidTeapot')) ||
23
30
  (have_library('opengl32') &&
24
31
  have_library('glu32') &&
25
- have_library('glut32')) ||
32
+ have_library('glut')) ||
26
33
  (have_library('GL', 'glVertex3d') &&
27
34
  have_library('GLU', 'gluLookAt') &&
28
35
  have_library('glut', 'glutSolidTeapot')) ||
@@ -62,6 +69,6 @@ end
62
69
 
63
70
  if ok then
64
71
  create_header
65
- create_makefile 'glut'
72
+ create_makefile 'opengl/opengl'
66
73
  end
67
74
 
@@ -14,39 +14,47 @@
14
14
  */
15
15
 
16
16
  /* These macros are for simplification of function definition, as passing
17
- arguments from/to OpenGL usually follows the same few patterns. It would
18
- be probably wise to adapt the whole bindings to C++ (templates, overloaded
19
- functions, etc.), but for now supporting ruby extension for Windows means
20
- MSVC6, and that in turn means unspeakable horrors and pains for everyone
21
- attempting to merely write, much less debug or maintain any template-based
22
- code.
23
- */
17
+ arguments from/to OpenGL usually follows the same few patterns. It would
18
+ be probably wise to adapt the whole bindings to C++ (templates, overloaded
19
+ functions, etc.), but for now supporting ruby extension for Windows means
20
+ MSVC6, and that in turn means unspeakable horrors and pains for everyone
21
+ attempting to merely write, much less debug or maintain any template-based
22
+ code.
23
+ */
24
24
 
25
- /* Will load function pointer for function _NAME_ on first call to the
26
- function, or raise if the OpenGL version is less then required or the
27
- required extension is not supported */
28
- #define LOAD_GL_FUNC(_NAME_,_VEREXT_) \
29
- if (fptr_##_NAME_==NULL) { \
30
- if (CheckVersionExtension(_VEREXT_)==GL_FALSE) { \
31
- if (isdigit(_VEREXT_[0])) \
32
- rb_raise(rb_eNotImpError,"OpenGL version %s is not available on this system",_VEREXT_); \
33
- else \
34
- rb_raise(rb_eNotImpError,"Extension %s is not available on this system",_VEREXT_); \
35
- } \
36
- fptr_##_NAME_ = load_gl_function(#_NAME_, 1); \
37
- }
25
+ /*
26
+ * Loads the function pointer for function _NAME_ on first call to the
27
+ * function, or raises a NotImplementedError if the OpenGL version is less
28
+ * then required or the required extension is not supported.
29
+ */
30
+ #define LOAD_GL_FUNC(_NAME_, _VEREXT_) \
31
+ do { \
32
+ if (fptr_##_NAME_==NULL) { \
33
+ if (CheckVersionExtension(_VEREXT_) == GL_FALSE) { \
34
+ if (isdigit(_VEREXT_[0])) { \
35
+ rb_raise(rb_eNotImpError, \
36
+ "OpenGL version %s is not available on this system",_VEREXT_); \
37
+ } else { \
38
+ rb_raise(rb_eNotImpError, \
39
+ "Extension %s is not available on this system",_VEREXT_); \
40
+ } \
41
+ } \
42
+ \
43
+ fptr_##_NAME_ = load_gl_function(#_NAME_, 1); \
44
+ } \
45
+ } while (0)
38
46
 
39
47
  /* Macroset for defining simple functions, i.e. functions that take n arguments and
40
- pass them to GL API function without any additional processing.
48
+ pass them to GL API function without any additional processing.
41
49
 
42
- Some checking is implicit in _conversion_ argument - e.g. NUM2INT makes sure that
43
- user is really passing type that can be converted to INT, otherwire raises.
44
-
45
- *_LOAD version of macros are for defining functions where we load function pointer
46
- instead of direct call - that means all functions above OpenGL 1.1 (including all extensions)
47
- */
50
+ Some checking is implicit in _conversion_ argument - e.g. NUM2INT makes sure that
51
+ user is really passing type that can be converted to INT, otherwire raises.
48
52
 
49
- #define ARGLIST0
53
+ *_LOAD version of macros are for defining functions where we load function pointer
54
+ instead of direct call - that means all functions above OpenGL 1.1 (including all extensions)
55
+ */
56
+
57
+ #define ARGLIST0
50
58
  #define ARGLIST1 ,arg1
51
59
  #define ARGLIST2 ,arg1,arg2
52
60
  #define ARGLIST3 ,arg1,arg2,arg3
@@ -58,8 +66,8 @@ if (fptr_##_NAME_==NULL) { \
58
66
  #define ARGLIST9 ,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9
59
67
  #define ARGLIST10 ,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10
60
68
 
61
- #define CONV_GLenum (GLenum)NUM2UINT
62
- #define CONV_GLboolean (GLboolean)NUM2UINT
69
+ #define CONV_GLenum (GLenum)RUBY2GLENUM
70
+ #define CONV_GLboolean (GLboolean)GLBOOL2RUBY
63
71
  #define CONV_GLbitfield (GLbitfield)NUM2UINT
64
72
  #define CONV_GLbyte (GLbyte)NUM2INT
65
73
  #define CONV_GLshort (GLshort)NUM2INT
@@ -150,131 +158,153 @@ if (fptr_##_NAME_==NULL) { \
150
158
  #define CALLCONV10(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3),CONV_##cv4(arg4),CONV_##cv5(arg5),CONV_##cv6(arg6),CONV_##cv7(arg7),CONV_##cv8(arg8),CONV_##cv9(arg9),CONV_##cv10(arg10)
151
159
 
152
160
  #define GL_FUNC_LOAD(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_) \
153
- static _returntype_ (APIENTRY * fptr_gl##_name_)(PROTOPARAM##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
161
+ static _returntype_ (APIENTRY * fptr_gl##_name_)(PROTOPARAM##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
154
162
  static VALUE \
155
163
  gl_##_name_(obj ARGLIST##_num_) \
156
164
  VALUE obj ARGLIST##_num_; \
157
165
  { \
158
- RETDECL_##_returntype_ \
159
- LOAD_GL_FUNC(gl##_name_,_ver_) \
160
- RETSTAT_##_returntype_ fptr_gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
161
- CHECK_GLERROR \
162
- return RETCONV_##_returntype_(ret) ; \
166
+ RETDECL_##_returntype_ \
167
+ LOAD_GL_FUNC(gl##_name_,_ver_); \
168
+ RETSTAT_##_returntype_ fptr_gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
169
+ CHECK_GLERROR_FROM("gl" #_name_); \
170
+ return RETCONV_##_returntype_(ret) ; \
163
171
  }
164
172
 
165
173
  #define GL_FUNC_STATIC(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10) \
166
- static VALUE \
174
+ static VALUE \
167
175
  gl_##_name_(obj ARGLIST##_num_) \
168
176
  VALUE obj ARGLIST##_num_; \
169
177
  { \
170
- RETDECL_##_returntype_ \
171
- RETSTAT_##_returntype_ gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
172
- CHECK_GLERROR \
173
- return RETCONV_##_returntype_(ret) ; \
178
+ RETDECL_##_returntype_ \
179
+ RETSTAT_##_returntype_ gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
180
+ CHECK_GLERROR_FROM("gl" #_name_); \
181
+ return RETCONV_##_returntype_(ret) ; \
174
182
  }
175
183
 
176
- #define GL_FUNC_LOAD_0(_name_,_returntype_,_ver_) GL_FUNC_LOAD(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0,_ver_)
177
- #define GL_FUNC_LOAD_1(_name_,_returntype_,targ1,_ver_) GL_FUNC_LOAD(1, _name_,_returntype_,targ1,0,0,0,0,0,0,0,0,0,_ver_)
178
- #define GL_FUNC_LOAD_2(_name_,_returntype_,targ1,targ2,_ver_) GL_FUNC_LOAD(2, _name_,_returntype_,targ1,targ2,0,0,0,0,0,0,0,0,_ver_)
179
- #define GL_FUNC_LOAD_3(_name_,_returntype_,targ1,targ2,targ3,_ver_) GL_FUNC_LOAD(3, _name_,_returntype_,targ1,targ2,targ3,0,0,0,0,0,0,0,_ver_)
180
- #define GL_FUNC_LOAD_4(_name_,_returntype_,targ1,targ2,targ3,targ4,_ver_) GL_FUNC_LOAD(4, _name_,_returntype_,targ1,targ2,targ3,targ4,0,0,0,0,0,0,_ver_)
181
- #define GL_FUNC_LOAD_5(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,_ver_) GL_FUNC_LOAD(5, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,0,0,0,0,0,_ver_)
182
- #define GL_FUNC_LOAD_6(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,_ver_) GL_FUNC_LOAD(6, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,0,0,0,0,_ver_)
183
- #define GL_FUNC_LOAD_7(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,_ver_) GL_FUNC_LOAD(7, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,0,0,0,_ver_)
184
- #define GL_FUNC_LOAD_8(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,_ver_) GL_FUNC_LOAD(8, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,0,0,_ver_)
185
- #define GL_FUNC_LOAD_9(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,_ver_) GL_FUNC_LOAD(9, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,0,_ver_)
186
- #define GL_FUNC_LOAD_10(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_) GL_FUNC_LOAD(10, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_)
184
+ #define GL_FUNC_LOAD_0(_name_,_returntype_,_ver_) \
185
+ GL_FUNC_LOAD(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0,_ver_)
186
+ #define GL_FUNC_LOAD_1(_name_,_returntype_,targ1,_ver_) \
187
+ GL_FUNC_LOAD(1, _name_,_returntype_,targ1,0,0,0,0,0,0,0,0,0,_ver_)
188
+ #define GL_FUNC_LOAD_2(_name_,_returntype_,targ1,targ2,_ver_) \
189
+ GL_FUNC_LOAD(2, _name_,_returntype_,targ1,targ2,0,0,0,0,0,0,0,0,_ver_)
190
+ #define GL_FUNC_LOAD_3(_name_,_returntype_,targ1,targ2,targ3,_ver_) \
191
+ GL_FUNC_LOAD(3, _name_,_returntype_,targ1,targ2,targ3,0,0,0,0,0,0,0,_ver_)
192
+ #define GL_FUNC_LOAD_4(_name_,_returntype_,targ1,targ2,targ3,targ4,_ver_) \
193
+ GL_FUNC_LOAD(4, _name_,_returntype_,targ1,targ2,targ3,targ4,0,0,0,0,0,0,_ver_)
194
+ #define GL_FUNC_LOAD_5(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,_ver_) \
195
+ GL_FUNC_LOAD(5, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,0,0,0,0,0,_ver_)
196
+ #define GL_FUNC_LOAD_6(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,_ver_) \
197
+ GL_FUNC_LOAD(6, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,0,0,0,0,_ver_)
198
+ #define GL_FUNC_LOAD_7(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,_ver_) \
199
+ GL_FUNC_LOAD(7, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,0,0,0,_ver_)
200
+ #define GL_FUNC_LOAD_8(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,_ver_) \
201
+ GL_FUNC_LOAD(8, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,0,0,_ver_)
202
+ #define GL_FUNC_LOAD_9(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,_ver_) \
203
+ GL_FUNC_LOAD(9, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,0,_ver_)
204
+ #define GL_FUNC_LOAD_10(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_) \
205
+ GL_FUNC_LOAD(10, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_)
187
206
 
188
- #define GL_FUNC_STATIC_0(_name_,_returntype_) GL_FUNC_STATIC(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0)
189
- #define GL_FUNC_STATIC_1(_name_,_returntype_,targ1) GL_FUNC_STATIC(1, _name_,_returntype_,targ1,0,0,0,0,0,0,0,0,0)
190
- #define GL_FUNC_STATIC_2(_name_,_returntype_,targ1,targ2) GL_FUNC_STATIC(2, _name_,_returntype_,targ1,targ2,0,0,0,0,0,0,0,0)
191
- #define GL_FUNC_STATIC_3(_name_,_returntype_,targ1,targ2,targ3) GL_FUNC_STATIC(3, _name_,_returntype_,targ1,targ2,targ3,0,0,0,0,0,0,0)
192
- #define GL_FUNC_STATIC_4(_name_,_returntype_,targ1,targ2,targ3,targ4) GL_FUNC_STATIC(4, _name_,_returntype_,targ1,targ2,targ3,targ4,0,0,0,0,0,0)
193
- #define GL_FUNC_STATIC_5(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5) GL_FUNC_STATIC(5, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,0,0,0,0,0)
194
- #define GL_FUNC_STATIC_6(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6) GL_FUNC_STATIC(6, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,0,0,0,0)
195
- #define GL_FUNC_STATIC_7(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7) GL_FUNC_STATIC(7, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,0,0,0)
196
- #define GL_FUNC_STATIC_8(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8) GL_FUNC_STATIC(8, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,0,0)
197
- #define GL_FUNC_STATIC_9(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9) GL_FUNC_STATIC(9, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,0)
198
- #define GL_FUNC_STATIC_10(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10_ver_) GL_FUNC_STATIC(10, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)
207
+ #define GL_FUNC_STATIC_0(_name_,_returntype_) \
208
+ GL_FUNC_STATIC(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0)
209
+ #define GL_FUNC_STATIC_1(_name_,_returntype_,targ1) \
210
+ GL_FUNC_STATIC(1, _name_,_returntype_,targ1,0,0,0,0,0,0,0,0,0)
211
+ #define GL_FUNC_STATIC_2(_name_,_returntype_,targ1,targ2) \
212
+ GL_FUNC_STATIC(2, _name_,_returntype_,targ1,targ2,0,0,0,0,0,0,0,0)
213
+ #define GL_FUNC_STATIC_3(_name_,_returntype_,targ1,targ2,targ3) \
214
+ GL_FUNC_STATIC(3, _name_,_returntype_,targ1,targ2,targ3,0,0,0,0,0,0,0)
215
+ #define GL_FUNC_STATIC_4(_name_,_returntype_,targ1,targ2,targ3,targ4) \
216
+ GL_FUNC_STATIC(4, _name_,_returntype_,targ1,targ2,targ3,targ4,0,0,0,0,0,0)
217
+ #define GL_FUNC_STATIC_5(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5) \
218
+ GL_FUNC_STATIC(5, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,0,0,0,0,0)
219
+ #define GL_FUNC_STATIC_6(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6) \
220
+ GL_FUNC_STATIC(6, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,0,0,0,0)
221
+ #define GL_FUNC_STATIC_7(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7) \
222
+ GL_FUNC_STATIC(7, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,0,0,0)
223
+ #define GL_FUNC_STATIC_8(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8) \
224
+ GL_FUNC_STATIC(8, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,0,0)
225
+ #define GL_FUNC_STATIC_9(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9) \
226
+ GL_FUNC_STATIC(9, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,0)
227
+ #define GL_FUNC_STATIC_10(_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10_ver_) \
228
+ GL_FUNC_STATIC(10, _name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)
199
229
 
200
230
  /* Templates for glGen* and glDelete* */
201
231
 
202
232
  #define GL_FUNC_GENOBJECTS_LOAD(_name_,_ver_) \
203
- static void (APIENTRY * fptr_gl##_name_)(GLsizei,GLuint *); \
233
+ static void (APIENTRY * fptr_gl##_name_)(GLsizei,GLuint *); \
204
234
  static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
205
235
  { \
206
- GLsizei n; \
207
- GLuint *objects; \
208
- VALUE ret; \
209
- GLsizei i; \
210
- LOAD_GL_FUNC(gl##_name_,_ver_) \
211
- n = CONV_GLsizei(arg1); \
212
- objects = ALLOC_N(GLuint, n); \
213
- fptr_gl##_name_(n,objects); \
214
- ret = rb_ary_new2(n); \
215
- for (i = 0; i < n; i++) \
216
- rb_ary_push(ret, RETCONV_GLuint(objects[i])); \
217
- xfree(objects); \
218
- CHECK_GLERROR \
219
- return ret; \
236
+ GLsizei n; \
237
+ GLuint *objects; \
238
+ VALUE ret; \
239
+ GLsizei i; \
240
+ LOAD_GL_FUNC(gl##_name_,_ver_); \
241
+ n = CONV_GLsizei(arg1); \
242
+ objects = ALLOC_N(GLuint, n); \
243
+ fptr_gl##_name_(n,objects); \
244
+ ret = rb_ary_new2(n); \
245
+ for (i = 0; i < n; i++) \
246
+ rb_ary_push(ret, RETCONV_GLuint(objects[i])); \
247
+ xfree(objects); \
248
+ CHECK_GLERROR_FROM("gl" #_name_); \
249
+ return ret; \
220
250
  }
221
251
 
222
252
  #define GL_FUNC_GENOBJECTS(_name_) \
223
- static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
253
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
224
254
  { \
225
- GLsizei n; \
226
- GLuint *objects; \
227
- VALUE ret; \
228
- GLsizei i; \
229
- n = CONV_GLsizei(arg1); \
230
- objects = ALLOC_N(GLuint, n); \
231
- gl##_name_(n,objects); \
232
- ret = rb_ary_new2(n); \
233
- for (i = 0; i < n; i++) \
234
- rb_ary_push(ret, RETCONV_GLuint(objects[i])); \
235
- xfree(objects); \
236
- CHECK_GLERROR \
237
- return ret; \
255
+ GLsizei n; \
256
+ GLuint *objects; \
257
+ VALUE ret; \
258
+ GLsizei i; \
259
+ n = CONV_GLsizei(arg1); \
260
+ objects = ALLOC_N(GLuint, n); \
261
+ gl##_name_(n,objects); \
262
+ ret = rb_ary_new2(n); \
263
+ for (i = 0; i < n; i++) \
264
+ rb_ary_push(ret, RETCONV_GLuint(objects[i])); \
265
+ xfree(objects); \
266
+ CHECK_GLERROR_FROM("gl" #_name_); \
267
+ return ret; \
238
268
  }
239
269
 
240
270
  #define GL_FUNC_DELETEOBJECTS_LOAD(_name_,_ver_) \
241
- static void (APIENTRY * fptr_gl##_name_)(GLsizei,const GLuint *); \
271
+ static void (APIENTRY * fptr_gl##_name_)(GLsizei,const GLuint *); \
242
272
  static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
243
273
  { \
244
- GLsizei n; \
245
- LOAD_GL_FUNC(gl##_name_,_ver_) \
246
- if (TYPE(arg1)==T_ARRAY) { \
247
- GLuint *objects; \
248
- n = (GLsizei)RARRAY_LENINT(arg1); \
249
- objects = ALLOC_N(GLuint,n); \
250
- ary2cuint(arg1,objects,n); \
251
- fptr_gl##_name_(n,objects); \
252
- xfree(objects); \
253
- } else { \
254
- GLuint object; \
255
- object = CONV_GLsizei(arg1); \
256
- fptr_gl##_name_(1,&object); \
257
- } \
258
- CHECK_GLERROR \
259
- return Qnil; \
274
+ GLsizei n; \
275
+ LOAD_GL_FUNC(gl##_name_,_ver_); \
276
+ if (TYPE(arg1)==T_ARRAY) { \
277
+ GLuint *objects; \
278
+ n = (GLsizei)RARRAY_LENINT(arg1); \
279
+ objects = ALLOC_N(GLuint,n); \
280
+ ary2cuint(arg1,objects,n); \
281
+ fptr_gl##_name_(n,objects); \
282
+ xfree(objects); \
283
+ } else { \
284
+ GLuint object; \
285
+ object = CONV_GLsizei(arg1); \
286
+ fptr_gl##_name_(1,&object); \
287
+ } \
288
+ CHECK_GLERROR_FROM("gl" #_name_); \
289
+ return Qnil; \
260
290
  }
261
291
 
262
292
  #define GL_FUNC_DELETEOBJECTS(_name_) \
263
- static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
293
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
264
294
  { \
265
- GLsizei n; \
266
- if (TYPE(arg1)==T_ARRAY) { \
267
- GLuint *objects; \
268
- n = (GLsizei)RARRAY_LENINT(arg1); \
269
- objects = ALLOC_N(GLuint,n); \
270
- ary2cuint(arg1,objects,n); \
271
- gl##_name_(n,objects); \
272
- xfree(objects); \
273
- } else { \
274
- GLuint object; \
275
- object = CONV_GLsizei(arg1); \
276
- gl##_name_(1,&object); \
277
- } \
278
- CHECK_GLERROR \
279
- return Qnil; \
295
+ GLsizei n; \
296
+ if (TYPE(arg1)==T_ARRAY) { \
297
+ GLuint *objects; \
298
+ n = (GLsizei)RARRAY_LENINT(arg1); \
299
+ objects = ALLOC_N(GLuint,n); \
300
+ ary2cuint(arg1,objects,n); \
301
+ gl##_name_(n,objects); \
302
+ xfree(objects); \
303
+ } else { \
304
+ GLuint object; \
305
+ object = CONV_GLsizei(arg1); \
306
+ gl##_name_(1,&object); \
307
+ } \
308
+ CHECK_GLERROR_FROM("gl" #_name_); \
309
+ return Qnil; \
280
310
  }