opengl 0.9.2-x64-mingw32 → 0.10.0-x64-mingw32

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -0
  3. data/{History.rdoc → History.md} +15 -0
  4. data/Manifest.txt +5 -1
  5. data/README.rdoc +25 -28
  6. data/Rakefile +125 -27
  7. data/examples/RedBook/font.rb +2 -2
  8. data/examples/RedBook/light.rb +2 -0
  9. data/examples/RedBook/stroke.rb +6 -6
  10. data/ext/opengl/GL/gl.h +2115 -0
  11. data/ext/opengl/GL/glext.h +11770 -0
  12. data/ext/opengl/common.h +116 -172
  13. data/ext/opengl/conv.h +2 -2
  14. data/ext/opengl/extconf.rb +3 -31
  15. data/ext/opengl/fptr_struct.h +912 -0
  16. data/ext/opengl/funcdef.h +29 -63
  17. data/ext/opengl/gl-1.0-1.1.c +918 -648
  18. data/ext/opengl/gl-1.2.c +13 -13
  19. data/ext/opengl/gl-1.3.c +68 -64
  20. data/ext/opengl/gl-1.4.c +64 -66
  21. data/ext/opengl/gl-1.5.c +32 -31
  22. data/ext/opengl/gl-2.0.c +126 -128
  23. data/ext/opengl/gl-2.1.c +8 -8
  24. data/ext/opengl/gl-3.0.c +102 -93
  25. data/ext/opengl/gl-enums.c +9 -29
  26. data/ext/opengl/gl-enums.h +31 -91
  27. data/ext/opengl/gl-error.c +15 -17
  28. data/ext/opengl/gl-error.h +4 -7
  29. data/ext/opengl/gl-ext-3dfx.c +2 -2
  30. data/ext/opengl/gl-ext-arb.c +176 -171
  31. data/ext/opengl/gl-ext-ati.c +4 -4
  32. data/ext/opengl/gl-ext-ext.c +151 -155
  33. data/ext/opengl/gl-ext-gremedy.c +4 -4
  34. data/ext/opengl/gl-ext-nv.c +141 -142
  35. data/ext/opengl/gl.c +121 -76
  36. data/ext/opengl/gl_buffer.c +44 -19
  37. data/ext/opengl/glimpl.c +187 -0
  38. data/ext/opengl/glimpl.h +47 -0
  39. data/ext/opengl/opengl.c +5 -3
  40. data/lib/opengl.rb +24 -4
  41. data/lib/opengl/2.0/opengl.so +0 -0
  42. data/lib/opengl/2.1/opengl.so +0 -0
  43. data/lib/opengl/2.2/opengl.so +0 -0
  44. data/lib/opengl/2.3/opengl.so +0 -0
  45. data/lib/opengl/2.4/opengl.so +0 -0
  46. data/lib/opengl/bindings_version.rb +4 -0
  47. data/lib/opengl/implementation.rb +38 -0
  48. data/opengl.gemspec +32 -0
  49. data/test/test_gl.rb +7 -0
  50. data/test/test_gl_21.rb +21 -21
  51. data/test/test_gl_ext_arb.rb +1 -1
  52. data/test/test_glimpl.rb +23 -0
  53. data/test/test_opengl_buffer.rb +2 -0
  54. data/utils/enumgen.rb +2 -2
  55. metadata +74 -61
  56. checksums.yaml.gz.sig +0 -0
  57. data.tar.gz.sig +0 -0
  58. data/ext/opengl/gl-types.h +0 -67
  59. metadata.gz.sig +0 -2
@@ -13,6 +13,9 @@
13
13
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  */
15
15
 
16
+ #ifndef _FUNCDEF_H_
17
+ #define _FUNCDEF_H_
18
+
16
19
  /*
17
20
  These macros are for simplification of function definition, as passing
18
21
  arguments from/to OpenGL usually follows the same few patterns. It would
@@ -29,23 +32,24 @@
29
32
  * then required or the required extension is not supported.
30
33
  */
31
34
  #define LOAD_GL_FUNC(_NAME_, _VEREXT_) \
32
- do { \
33
- if (fptr_##_NAME_==NULL) { \
34
- if (CheckVersionExtension(_VEREXT_) == GL_FALSE) { \
35
- if (isdigit(_VEREXT_[0])) { \
36
- rb_raise(rb_eNotImpError, \
37
- "OpenGL version %s is not available on this system",_VEREXT_); \
38
- } else { \
39
- rb_raise(rb_eNotImpError, \
40
- "Extension %s is not available on this system",_VEREXT_); \
41
- } \
42
- } \
43
- \
44
- fptr_##_NAME_ = load_gl_function(#_NAME_, 1); \
45
- } \
46
- } while (0)
35
+ do { \
36
+ fptr_##_NAME_ = GET_GLIMPL_VARIABLE(glfuncs._NAME_); \
37
+ if (fptr_##_NAME_==NULL){ \
38
+ if (_VEREXT_) EnsureVersionExtension(obj, (_VEREXT_)); \
39
+ fptr_##_NAME_ = GET_GLIMPL_VARIABLE(load_gl_function)(obj,#_NAME_, 1); \
40
+ SET_GLIMPL_VARIABLE(glfuncs._NAME_,fptr_##_NAME_); \
41
+ } \
42
+ } while (0)
43
+
44
+ #if defined(GLFUNC_MAGIC_START)
45
+ #define DECL_GL_FUNC_PTR(_returntype_,_name_,_args_) \
46
+ GLFUNC_MAGIC_START _returntype_ (GLFUNC_MAGIC_APIENTRY * _name_)_args_ GLFUNC_MAGIC_END
47
+ #else
48
+ #define DECL_GL_FUNC_PTR(_returntype_,_name_,_args_) \
49
+ _returntype_ (APIENTRY * fptr_##_name_)_args_ = NULL
50
+ #endif
47
51
 
48
- /*
52
+ /*
49
53
  Macroset for defining simple functions, i.e. functions that take n arguments and
50
54
  pass them to GL API function without any additional processing.
51
55
 
@@ -148,7 +152,7 @@
148
152
  #define PROTOPARAM9(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6,p7,p8,p9
149
153
  #define PROTOPARAM10(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) p1,p2,p3,p4,p5,p6,p7,p8,p9,p10
150
154
 
151
- #define CALLCONV0(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10)
155
+ #define CALLCONV0(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10)
152
156
  #define CALLCONV1(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1)
153
157
  #define CALLCONV2(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2)
154
158
  #define CALLCONV3(cv1,cv2,cv3,cv4,cv5,cv6,cv7,cv8,cv9,cv10) CONV_##cv1(arg1),CONV_##cv2(arg2),CONV_##cv3(arg3)
@@ -161,12 +165,12 @@
161
165
  #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)
162
166
 
163
167
  #define GL_FUNC_LOAD(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,_ver_) \
164
- static _returntype_ (APIENTRY * fptr_gl##_name_)(PROTOPARAM##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
165
168
  static VALUE \
166
169
  gl_##_name_(obj ARGLIST##_num_) \
167
170
  VALUE obj ARGLIST##_num_; \
168
171
  { \
169
172
  RETDECL_##_returntype_ \
173
+ DECL_GL_FUNC_PTR(_returntype_,gl##_name_,(PROTOPARAM##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10))); \
170
174
  LOAD_GL_FUNC(gl##_name_,_ver_); \
171
175
  RETSTAT_##_returntype_ fptr_gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
172
176
  CHECK_GLERROR_FROM("gl" #_name_); \
@@ -174,15 +178,7 @@ VALUE obj ARGLIST##_num_; \
174
178
  }
175
179
 
176
180
  #define GL_FUNC_STATIC(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10) \
177
- static VALUE \
178
- gl_##_name_(obj ARGLIST##_num_) \
179
- VALUE obj ARGLIST##_num_; \
180
- { \
181
- RETDECL_##_returntype_ \
182
- RETSTAT_##_returntype_ gl##_name_(CALLCONV##_num_(targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10)); \
183
- CHECK_GLERROR_FROM("gl" #_name_); \
184
- return RETCONV_##_returntype_(ret) ; \
185
- }
181
+ GL_FUNC_LOAD(_num_,_name_,_returntype_,targ1,targ2,targ3,targ4,targ5,targ6,targ7,targ8,targ9,targ10,NULL)
186
182
 
187
183
  #define GL_FUNC_LOAD_0(_name_,_returntype_,_ver_) \
188
184
  GL_FUNC_LOAD(0, _name_,_returntype_,0,0,0,0,0,0,0,0,0,0,_ver_)
@@ -233,13 +229,13 @@ VALUE obj ARGLIST##_num_; \
233
229
  /* Templates for glGen* and glDelete* */
234
230
 
235
231
  #define GL_FUNC_GENOBJECTS_LOAD(_name_,_ver_) \
236
- static void (APIENTRY * fptr_gl##_name_)(GLsizei,GLuint *); \
237
232
  static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
238
233
  { \
239
234
  GLsizei n; \
240
235
  GLuint *objects; \
241
236
  VALUE ret; \
242
237
  GLsizei i; \
238
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLsizei,GLuint *)); \
243
239
  LOAD_GL_FUNC(gl##_name_,_ver_); \
244
240
  n = CONV_GLsizei(arg1); \
245
241
  objects = ALLOC_N(GLuint, n); \
@@ -253,28 +249,13 @@ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
253
249
  }
254
250
 
255
251
  #define GL_FUNC_GENOBJECTS(_name_) \
256
- static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
257
- { \
258
- GLsizei n; \
259
- GLuint *objects; \
260
- VALUE ret; \
261
- GLsizei i; \
262
- n = CONV_GLsizei(arg1); \
263
- objects = ALLOC_N(GLuint, n); \
264
- gl##_name_(n,objects); \
265
- ret = rb_ary_new2(n); \
266
- for (i = 0; i < n; i++) \
267
- rb_ary_push(ret, RETCONV_GLuint(objects[i])); \
268
- xfree(objects); \
269
- CHECK_GLERROR_FROM("gl" #_name_); \
270
- return ret; \
271
- }
252
+ GL_FUNC_GENOBJECTS_LOAD(_name_,"1.1")
272
253
 
273
254
  #define GL_FUNC_DELETEOBJECTS_LOAD(_name_,_ver_) \
274
- static void (APIENTRY * fptr_gl##_name_)(GLsizei,const GLuint *); \
275
255
  static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
276
256
  { \
277
257
  GLsizei n; \
258
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLsizei,const GLuint *)); \
278
259
  LOAD_GL_FUNC(gl##_name_,_ver_); \
279
260
  if (TYPE(arg1)==T_ARRAY) { \
280
261
  GLuint *objects; \
@@ -293,21 +274,6 @@ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
293
274
  }
294
275
 
295
276
  #define GL_FUNC_DELETEOBJECTS(_name_) \
296
- static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
297
- { \
298
- GLsizei n; \
299
- if (TYPE(arg1)==T_ARRAY) { \
300
- GLuint *objects; \
301
- n = (GLsizei)RARRAY_LENINT(arg1); \
302
- objects = ALLOC_N(GLuint,n); \
303
- ary2cuint(arg1,objects,n); \
304
- gl##_name_(n,objects); \
305
- xfree(objects); \
306
- } else { \
307
- GLuint object; \
308
- object = CONV_GLsizei(arg1); \
309
- gl##_name_(1,&object); \
310
- } \
311
- CHECK_GLERROR_FROM("gl" #_name_); \
312
- return Qnil; \
313
- }
277
+ GL_FUNC_DELETEOBJECTS_LOAD(_name_,"1.1")
278
+
279
+ #endif
@@ -197,15 +197,21 @@ GL_FUNC_STATIC_4(Vertex4i,GLvoid, GLint,GLint,GLint,GLint)
197
197
  GL_FUNC_STATIC_4(Vertex4s,GLvoid, GLshort,GLshort,GLshort,GLshort)
198
198
  GL_FUNC_STATIC_4(Viewport,GLvoid, GLuint,GLuint,GLuint,GLuint)
199
199
 
200
- VALUE inside_begin_end = Qfalse;
200
+ struct gl_endisable_args {
201
+ VALUE obj;
202
+ VALUE caps;
203
+ };
201
204
 
202
205
  static VALUE
203
- gl_Enable1(VALUE caps)
206
+ gl_Enable1(struct gl_endisable_args *args)
204
207
  {
205
208
  long i;
209
+ VALUE obj = args->obj;
210
+ DECL_GL_FUNC_PTR(void,glEnable,(GLenum cap));
206
211
 
207
- for (i = 0; i < RARRAY_LEN(caps); i++) {
208
- glEnable(CONV_GLenum(rb_ary_entry(caps, i)));
212
+ LOAD_GL_FUNC(glEnable, NULL);
213
+ for (i = 0; i < RARRAY_LEN(args->caps); i++) {
214
+ fptr_glEnable(CONV_GLenum(rb_ary_entry(args->caps, i)));
209
215
 
210
216
  CHECK_GLERROR_FROM("glEnable");
211
217
  }
@@ -214,9 +220,9 @@ gl_Enable1(VALUE caps)
214
220
  }
215
221
 
216
222
  static VALUE
217
- gl_Enable0(VALUE caps)
223
+ gl_Enable0(struct gl_endisable_args *args)
218
224
  {
219
- gl_Enable1(caps);
225
+ gl_Enable1(args);
220
226
 
221
227
  if (rb_block_given_p())
222
228
  rb_yield(Qundef);
@@ -225,11 +231,15 @@ gl_Enable0(VALUE caps)
225
231
  }
226
232
 
227
233
  static VALUE
228
- gl_Disable1(VALUE caps)
234
+ gl_Disable1(struct gl_endisable_args *args)
229
235
  {
230
236
  long i;
231
- for (i = 0; i < RARRAY_LEN(caps); i++) {
232
- glDisable(CONV_GLenum(rb_ary_entry(caps, i)));
237
+ VALUE obj = args->obj;
238
+ DECL_GL_FUNC_PTR(void,glDisable,(GLenum cap));
239
+
240
+ LOAD_GL_FUNC(glDisable, NULL);
241
+ for (i = 0; i < RARRAY_LEN(args->caps); i++) {
242
+ fptr_glDisable(CONV_GLenum(rb_ary_entry(args->caps, i)));
233
243
 
234
244
  CHECK_GLERROR_FROM("glDisable");
235
245
  }
@@ -238,9 +248,9 @@ gl_Disable1(VALUE caps)
238
248
  }
239
249
 
240
250
  static VALUE
241
- gl_Disable0(VALUE caps)
251
+ gl_Disable0(struct gl_endisable_args *args)
242
252
  {
243
- gl_Disable1(caps);
253
+ gl_Disable1(args);
244
254
 
245
255
  if (rb_block_given_p())
246
256
  rb_yield(Qundef);
@@ -249,7 +259,7 @@ gl_Disable0(VALUE caps)
249
259
  }
250
260
 
251
261
  static VALUE
252
- gl_Enable(int argc, VALUE *argv, VALUE self)
262
+ gl_Enable(int argc, VALUE *argv, VALUE obj)
253
263
  {
254
264
  int i;
255
265
  VALUE caps, rev;
@@ -263,16 +273,20 @@ gl_Enable(int argc, VALUE *argv, VALUE self)
263
273
 
264
274
  rev = rb_ary_reverse(caps);
265
275
 
266
- if (rb_block_given_p())
267
- return rb_ensure(gl_Enable0, caps, gl_Disable1, rev);
268
- else
269
- gl_Enable0(caps);
276
+ if (rb_block_given_p()){
277
+ struct gl_endisable_args enargs = { obj, caps };
278
+ struct gl_endisable_args disargs = { obj, rev };
279
+ return rb_ensure(gl_Enable0, (VALUE)&enargs, gl_Disable1, (VALUE)&disargs);
280
+ } else {
281
+ struct gl_endisable_args args = { obj, caps };
282
+ gl_Enable0(&args);
283
+ }
270
284
 
271
285
  return Qnil;
272
286
  }
273
287
 
274
288
  static VALUE
275
- gl_Disable(int argc, VALUE *argv, VALUE self)
289
+ gl_Disable(int argc, VALUE *argv, VALUE obj)
276
290
  {
277
291
  int i;
278
292
  VALUE caps, rev;
@@ -286,20 +300,33 @@ gl_Disable(int argc, VALUE *argv, VALUE self)
286
300
 
287
301
  rev = rb_ary_reverse(caps);
288
302
 
289
- if (rb_block_given_p())
290
- return rb_ensure(gl_Disable0, caps, gl_Enable1, rev);
291
- else
292
- gl_Disable0(caps);
303
+ if (rb_block_given_p()){
304
+ struct gl_endisable_args disargs = { obj, caps };
305
+ struct gl_endisable_args enargs = { obj, rev };
306
+ return rb_ensure(gl_Disable0, (VALUE)&disargs, gl_Enable1, (VALUE)&enargs);
307
+ } else {
308
+ struct gl_endisable_args args = { obj, caps };
309
+ gl_Disable0(&args);
310
+ }
293
311
 
294
312
  return Qnil;
295
313
  }
296
314
 
315
+ struct gl_client_state_args {
316
+ VALUE obj;
317
+ VALUE ary;
318
+ };
319
+
297
320
  static VALUE
298
- gl_EnableClientState1(VALUE ary)
321
+ gl_EnableClientState1(struct gl_client_state_args *args)
299
322
  {
300
323
  long i;
301
- for (i = 0; i < RARRAY_LEN(ary); i++) {
302
- glEnableClientState(CONV_GLenum(rb_ary_entry(ary, i)));
324
+ VALUE obj = args->obj;
325
+ DECL_GL_FUNC_PTR(void,glEnableClientState,(GLenum cap));
326
+
327
+ LOAD_GL_FUNC(glEnableClientState, NULL);
328
+ for (i = 0; i < RARRAY_LEN(args->ary); i++) {
329
+ fptr_glEnableClientState(CONV_GLenum(rb_ary_entry(args->ary, i)));
303
330
 
304
331
  CHECK_GLERROR_FROM("glEnableClientState");
305
332
  }
@@ -308,9 +335,9 @@ gl_EnableClientState1(VALUE ary)
308
335
  }
309
336
 
310
337
  static VALUE
311
- gl_EnableClientState0(VALUE ary)
338
+ gl_EnableClientState0(struct gl_client_state_args *args)
312
339
  {
313
- gl_EnableClientState1(ary);
340
+ gl_EnableClientState1(args);
314
341
 
315
342
  if (rb_block_given_p())
316
343
  rb_yield(Qundef);
@@ -319,11 +346,15 @@ gl_EnableClientState0(VALUE ary)
319
346
  }
320
347
 
321
348
  static VALUE
322
- gl_DisableClientState1(VALUE ary)
349
+ gl_DisableClientState1(struct gl_client_state_args *args)
323
350
  {
324
351
  long i;
325
- for (i = 0; i < RARRAY_LEN(ary); i++) {
326
- glDisableClientState(CONV_GLenum(rb_ary_entry(ary, i)));
352
+ VALUE obj = args->obj;
353
+ DECL_GL_FUNC_PTR(void,glDisableClientState,(GLenum cap));
354
+
355
+ LOAD_GL_FUNC(glDisableClientState, NULL);
356
+ for (i = 0; i < RARRAY_LEN(args->ary); i++) {
357
+ fptr_glDisableClientState(CONV_GLenum(rb_ary_entry(args->ary, i)));
327
358
 
328
359
  CHECK_GLERROR_FROM("glDisableClientState");
329
360
  }
@@ -332,9 +363,9 @@ gl_DisableClientState1(VALUE ary)
332
363
  }
333
364
 
334
365
  static VALUE
335
- gl_DisableClientState0(VALUE ary)
366
+ gl_DisableClientState0(struct gl_client_state_args *args)
336
367
  {
337
- gl_DisableClientState1(ary);
368
+ gl_DisableClientState1(args);
338
369
 
339
370
  if (rb_block_given_p())
340
371
  rb_yield(Qundef);
@@ -343,7 +374,7 @@ gl_DisableClientState0(VALUE ary)
343
374
  }
344
375
 
345
376
  static VALUE
346
- gl_EnableClientState(int argc, VALUE *argv, VALUE self)
377
+ gl_EnableClientState(int argc, VALUE *argv, VALUE obj)
347
378
  {
348
379
  int i;
349
380
  VALUE ary, rev;
@@ -357,16 +388,20 @@ gl_EnableClientState(int argc, VALUE *argv, VALUE self)
357
388
 
358
389
  rev = rb_ary_reverse(ary);
359
390
 
360
- if (rb_block_given_p())
361
- return rb_ensure(gl_EnableClientState0, ary, gl_DisableClientState1, rev);
362
- else
363
- gl_EnableClientState0(ary);
391
+ if (rb_block_given_p()){
392
+ struct gl_client_state_args enargs = { obj, ary };
393
+ struct gl_client_state_args disargs = { obj, rev };
394
+ return rb_ensure(gl_EnableClientState0, (VALUE)&enargs, gl_DisableClientState1, (VALUE)&disargs);
395
+ } else {
396
+ struct gl_client_state_args args = { obj, ary };
397
+ gl_EnableClientState0(&args);
398
+ }
364
399
 
365
400
  return Qnil;
366
401
  }
367
402
 
368
403
  static VALUE
369
- gl_DisableClientState(int argc, VALUE *argv, VALUE self)
404
+ gl_DisableClientState(int argc, VALUE *argv, VALUE obj)
370
405
  {
371
406
  int i;
372
407
  VALUE ary, rev;
@@ -380,18 +415,31 @@ gl_DisableClientState(int argc, VALUE *argv, VALUE self)
380
415
 
381
416
  rev = rb_ary_reverse(ary);
382
417
 
383
- if (rb_block_given_p())
384
- return rb_ensure(gl_DisableClientState0, ary, gl_EnableClientState1, rev);
385
- else
386
- gl_DisableClientState0(ary);
418
+ if (rb_block_given_p()){
419
+ struct gl_client_state_args disargs = { obj, ary };
420
+ struct gl_client_state_args enargs = { obj, rev };
421
+ return rb_ensure(gl_DisableClientState0, (VALUE)&disargs, gl_EnableClientState1, (VALUE)&enargs);
422
+ } else {
423
+ struct gl_client_state_args args = { obj, ary };
424
+ gl_DisableClientState0(&args);
425
+ }
387
426
 
388
427
  return Qnil;
389
428
  }
390
429
 
430
+ struct gl_begin0_args {
431
+ VALUE obj;
432
+ GLenum mode;
433
+ };
434
+
391
435
  static VALUE
392
- gl_Begin0(GLenum mode)
436
+ gl_Begin0(struct gl_begin0_args *args)
393
437
  {
394
- glBegin(mode);
438
+ VALUE obj = args->obj;
439
+ DECL_GL_FUNC_PTR(void,glBegin,(GLenum mode));
440
+
441
+ LOAD_GL_FUNC(glBegin, NULL);
442
+ fptr_glBegin(args->mode);
395
443
 
396
444
  if (rb_block_given_p())
397
445
  rb_yield(Qundef);
@@ -400,11 +448,14 @@ gl_Begin0(GLenum mode)
400
448
  }
401
449
 
402
450
  static VALUE
403
- gl_End(VALUE self)
451
+ gl_End(VALUE obj)
404
452
  {
405
- inside_begin_end = Qfalse;
453
+ DECL_GL_FUNC_PTR(void,glEnd,(void));
454
+
455
+ LOAD_GL_FUNC(glEnd, NULL);
456
+ SET_GLIMPL_VARIABLE(inside_begin_end, Qfalse);
406
457
 
407
- glEnd();
458
+ fptr_glEnd();
408
459
 
409
460
  CHECK_GLERROR_FROM("glEnd");
410
461
 
@@ -412,23 +463,27 @@ gl_End(VALUE self)
412
463
  }
413
464
 
414
465
  static VALUE
415
- gl_Begin(VALUE self, VALUE mode)
466
+ gl_Begin(VALUE obj, VALUE mode)
416
467
  {
417
- GLenum begin_mode = CONV_GLenum(mode);
418
- inside_begin_end = Qtrue;
468
+ struct gl_begin0_args args = { obj, CONV_GLenum(mode) };
469
+
470
+ SET_GLIMPL_VARIABLE(inside_begin_end, Qtrue);
419
471
 
420
472
  if (rb_block_given_p())
421
- return rb_ensure(gl_Begin0, (VALUE)begin_mode, gl_End, self);
473
+ return rb_ensure(gl_Begin0, (VALUE)&args, gl_End, obj);
422
474
  else
423
- gl_Begin0(begin_mode);
475
+ gl_Begin0(&args);
424
476
 
425
477
  return Qnil;
426
478
  }
427
479
 
428
480
  static VALUE
429
- gl_PopMatrix(VALUE self)
481
+ gl_PopMatrix(VALUE obj)
430
482
  {
431
- glPopMatrix();
483
+ DECL_GL_FUNC_PTR(void,glPopMatrix,(void));
484
+
485
+ LOAD_GL_FUNC(glPopMatrix, NULL);
486
+ fptr_glPopMatrix();
432
487
 
433
488
  CHECK_GLERROR_FROM("glPopMatrix");
434
489
 
@@ -436,9 +491,12 @@ gl_PopMatrix(VALUE self)
436
491
  }
437
492
 
438
493
  static VALUE
439
- gl_PushMatrix0(void)
494
+ gl_PushMatrix0(VALUE obj)
440
495
  {
441
- glPushMatrix();
496
+ DECL_GL_FUNC_PTR(void,glPushMatrix,(void));
497
+
498
+ LOAD_GL_FUNC(glPushMatrix, NULL);
499
+ fptr_glPushMatrix();
442
500
 
443
501
  if (rb_block_given_p())
444
502
  rb_yield(Qnil);
@@ -447,26 +505,38 @@ gl_PushMatrix0(void)
447
505
  }
448
506
 
449
507
  static VALUE
450
- gl_PushMatrix(VALUE self)
508
+ gl_PushMatrix(VALUE obj)
451
509
  {
452
510
  if (rb_block_given_p())
453
- return rb_ensure(gl_PushMatrix0, (VALUE)NULL, gl_PopMatrix, self);
454
- else
455
- glPushMatrix();
511
+ return rb_ensure(gl_PushMatrix0, obj, gl_PopMatrix, obj);
512
+ else {
513
+ DECL_GL_FUNC_PTR(void,glPushMatrix,(void));
514
+ LOAD_GL_FUNC(glPushMatrix, NULL);
515
+ fptr_glPushMatrix();
516
+ }
456
517
 
457
518
  return Qnil;
458
519
  }
459
520
 
521
+ struct gl_list_args {
522
+ VALUE obj;
523
+ VALUE list;
524
+ VALUE mode;
525
+ };
526
+
460
527
  static VALUE
461
- gl_NewList0(VALUE args)
528
+ gl_NewList0(struct gl_list_args *args)
462
529
  {
463
530
  GLuint list;
464
531
  GLenum mode;
532
+ VALUE obj = args->obj;
533
+ DECL_GL_FUNC_PTR(void,glNewList,(GLuint list, GLenum mode));
465
534
 
466
- list = (GLuint)NUM2UINT(rb_ary_entry(args, 0));
467
- mode = RUBY2GLENUM(rb_ary_entry(args, 1));
535
+ LOAD_GL_FUNC(glNewList, NULL);
536
+ list = (GLuint)NUM2UINT(args->list);
537
+ mode = RUBY2GLENUM(args->mode);
468
538
 
469
- glNewList(list, mode);
539
+ fptr_glNewList(list, mode);
470
540
 
471
541
  if (rb_block_given_p())
472
542
  rb_yield(Qundef);
@@ -475,24 +545,25 @@ gl_NewList0(VALUE args)
475
545
  }
476
546
 
477
547
  static VALUE
478
- gl_EndList(VALUE self)
548
+ gl_EndList(VALUE obj)
479
549
  {
480
- glEndList();
550
+ DECL_GL_FUNC_PTR(void,glEndList,(void));
551
+
552
+ LOAD_GL_FUNC(glEndList, NULL);
553
+ fptr_glEndList();
481
554
 
482
555
  return Qnil;
483
556
  }
484
557
 
485
558
  static VALUE
486
- gl_NewList(VALUE self, VALUE list, VALUE mode)
559
+ gl_NewList(VALUE obj, VALUE list, VALUE mode)
487
560
  {
488
- VALUE args = rb_ary_new2(2);
489
- rb_ary_push(args, list);
490
- rb_ary_push(args, mode);
561
+ struct gl_list_args args = { obj, list, mode };
491
562
 
492
563
  if (rb_block_given_p())
493
- return rb_ensure(gl_NewList0, args, gl_EndList, self);
564
+ return rb_ensure(gl_NewList0, (VALUE)&args, gl_EndList, obj);
494
565
  else
495
- gl_NewList0(args);
566
+ gl_NewList0(&args);
496
567
 
497
568
  return Qnil;
498
569
  }
@@ -504,10 +575,13 @@ VALUE obj,arg1,arg2;
504
575
  GLsizei n;
505
576
  GLenum type;
506
577
  VALUE lists;
578
+ DECL_GL_FUNC_PTR(GLvoid,glCallLists,(GLsizei n, GLenum type, const GLvoid *lists));
579
+
580
+ LOAD_GL_FUNC(glCallLists, NULL);
507
581
  type = CONV_GLenum(arg1);
508
582
  lists = pack_array_or_pass_string(type,arg2);
509
583
  n = (GLsizei)RSTRING_LENINT(lists) / gltype_glformat_unit_size(type,1);
510
- glCallLists(n, type, RSTRING_PTR(lists));
584
+ fptr_glCallLists(n, type, RSTRING_PTR(lists));
511
585
  CHECK_GLERROR_FROM("glCallLists");
512
586
  return Qnil;
513
587
  }
@@ -522,14 +596,17 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
522
596
  GLfloat yorig;
523
597
  GLfloat xmove;
524
598
  GLfloat ymove;
599
+ DECL_GL_FUNC_PTR(void,glBitmap,(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap));
600
+
601
+ LOAD_GL_FUNC(glBitmap, NULL);
525
602
  width = (GLsizei)NUM2UINT(arg1);
526
603
  height = (GLsizei)NUM2UINT(arg2);
527
604
  xorig = (GLfloat)NUM2DBL(arg3);
528
605
  yorig = (GLfloat)NUM2DBL(arg4);
529
606
  xmove = (GLfloat)NUM2DBL(arg5);
530
607
  ymove = (GLfloat)NUM2DBL(arg6);
531
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
532
- glBitmap(width, height, xorig, yorig, xmove, ymove, (GLubyte *)NUM2SIZET(arg7));
608
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
609
+ fptr_glBitmap(width, height, xorig, yorig, xmove, ymove, (GLubyte *)NUM2SIZET(arg7));
533
610
  } else {
534
611
  VALUE data;
535
612
  data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
@@ -537,7 +614,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
537
614
  if ((RSTRING_LEN(data)*8) < (width * height))
538
615
  rb_raise(rb_eArgError, "string length:%li", RSTRING_LEN(data));
539
616
 
540
- glBitmap(width, height, xorig, yorig, xmove, ymove, (const GLubyte *)RSTRING_PTR(data));
617
+ fptr_glBitmap(width, height, xorig, yorig, xmove, ymove, (const GLubyte *)RSTRING_PTR(data));
541
618
  }
542
619
  CHECK_GLERROR_FROM("glBitmap");
543
620
  return Qnil;
@@ -548,9 +625,12 @@ gl_EdgeFlagv(obj,arg1)
548
625
  VALUE obj,arg1;
549
626
  {
550
627
  GLboolean flag[1] = { GL_FALSE };
628
+ DECL_GL_FUNC_PTR(void,glEdgeFlagv,(const GLboolean *flag));
629
+
630
+ LOAD_GL_FUNC(glEdgeFlagv, NULL);
551
631
  Check_Type(arg1,T_ARRAY);
552
632
  ary2cboolean(arg1,flag,1);
553
- glEdgeFlagv(flag);
633
+ fptr_glEdgeFlagv(flag);
554
634
  CHECK_GLERROR_FROM("glEdgeFlagv");
555
635
  return Qnil;
556
636
  }
@@ -560,9 +640,12 @@ gl_Indexdv(obj,arg1)
560
640
  VALUE obj,arg1;
561
641
  {
562
642
  GLdouble c[1] = {0.0};
643
+ DECL_GL_FUNC_PTR(void,glIndexdv,(const GLdouble *c));
644
+
645
+ LOAD_GL_FUNC(glIndexdv, NULL);
563
646
  Check_Type(arg1,T_ARRAY);
564
647
  ary2cdbl(arg1,c,1);
565
- glIndexdv(c);
648
+ fptr_glIndexdv(c);
566
649
  CHECK_GLERROR_FROM("glIndexdv");
567
650
  return Qnil;
568
651
  }
@@ -572,9 +655,12 @@ gl_Indexfv(obj,arg1)
572
655
  VALUE obj,arg1;
573
656
  {
574
657
  GLfloat c[1] = { (GLfloat)0.0 };
658
+ DECL_GL_FUNC_PTR(void,glIndexfv,(const GLfloat *c));
659
+
660
+ LOAD_GL_FUNC(glIndexfv, NULL);
575
661
  Check_Type(arg1,T_ARRAY);
576
662
  ary2cflt(arg1,c,1);
577
- glIndexfv(c);
663
+ fptr_glIndexfv(c);
578
664
  CHECK_GLERROR_FROM("glIndexfv");
579
665
  return Qnil;
580
666
  }
@@ -584,9 +670,12 @@ gl_Indexiv(obj,arg1)
584
670
  VALUE obj,arg1;
585
671
  {
586
672
  GLint c[1] = {0};
673
+ DECL_GL_FUNC_PTR(void,glIndexiv,(const GLint *c));
674
+
675
+ LOAD_GL_FUNC(glIndexiv, NULL);
587
676
  Check_Type(arg1,T_ARRAY);
588
677
  ary2cint(arg1,c,1);
589
- glIndexiv(c);
678
+ fptr_glIndexiv(c);
590
679
  CHECK_GLERROR_FROM("glIndexiv");
591
680
  return Qnil;
592
681
  }
@@ -596,9 +685,12 @@ gl_Indexsv(obj,arg1)
596
685
  VALUE obj,arg1;
597
686
  {
598
687
  GLshort c[1] = {0};
688
+ DECL_GL_FUNC_PTR(void,glIndexsv,(const GLshort *c));
689
+
690
+ LOAD_GL_FUNC(glIndexsv, NULL);
599
691
  Check_Type(arg1,T_ARRAY);
600
692
  ary2cshort(arg1,c,1);
601
- glIndexsv(c);
693
+ fptr_glIndexsv(c);
602
694
  CHECK_GLERROR_FROM("glIndexsv");
603
695
  return Qnil;
604
696
  }
@@ -609,10 +701,13 @@ VALUE obj,arg1,arg2;
609
701
  {
610
702
  GLenum plane;
611
703
  GLdouble equation[4];
704
+ DECL_GL_FUNC_PTR(void,glClipPlane,(GLenum plane, const GLdouble *equation));
705
+
706
+ LOAD_GL_FUNC(glClipPlane, NULL);
612
707
  plane = (GLenum)NUM2INT(arg1);
613
708
  Check_Type(arg2,T_ARRAY);
614
709
  ary2cdbl(arg2, equation, 4);
615
- glClipPlane(plane,equation);
710
+ fptr_glClipPlane(plane,equation);
616
711
  CHECK_GLERROR_FROM("glClipPlane");
617
712
  return Qnil;
618
713
  }
@@ -623,10 +718,13 @@ VALUE obj,arg1,arg2;
623
718
  {
624
719
  GLenum pname;
625
720
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
721
+ DECL_GL_FUNC_PTR(void,glFogfv,(GLenum pname, const GLfloat *params));
722
+
723
+ LOAD_GL_FUNC(glFogfv, NULL);
626
724
  pname = (GLenum)NUM2INT(arg1);
627
725
  Check_Type(arg2,T_ARRAY);
628
726
  ary2cflt(arg2,params,4);
629
- glFogfv(pname,params);
727
+ fptr_glFogfv(pname,params);
630
728
  CHECK_GLERROR_FROM("glFogfv");
631
729
  return Qnil;
632
730
  }
@@ -637,10 +735,13 @@ VALUE obj,arg1,arg2;
637
735
  {
638
736
  GLenum pname;
639
737
  GLint params[4] = {0,0,0,0};
738
+ DECL_GL_FUNC_PTR(void,glFogiv,(GLenum pname, const GLint *params));
739
+
740
+ LOAD_GL_FUNC(glFogiv, NULL);
640
741
  pname = (GLenum)NUM2INT(arg1);
641
742
  Check_Type(arg2,T_ARRAY);
642
743
  ary2cint(arg2,params,4);
643
- glFogiv(pname,params);
744
+ fptr_glFogiv(pname,params);
644
745
  CHECK_GLERROR_FROM("glFogiv");
645
746
  return Qnil;
646
747
  }
@@ -652,11 +753,14 @@ VALUE obj,arg1,arg2,arg3;
652
753
  GLenum light;
653
754
  GLenum pname;
654
755
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
756
+ DECL_GL_FUNC_PTR(void,glLightfv,(GLenum light, GLenum pname, const GLfloat *params));
757
+
758
+ LOAD_GL_FUNC(glLightfv, NULL);
655
759
  light = (GLenum)NUM2INT(arg1);
656
760
  pname = (GLenum)NUM2INT(arg2);
657
761
  Check_Type(arg3,T_ARRAY);
658
762
  ary2cflt(arg3,params,4);
659
- glLightfv(light,pname,params);
763
+ fptr_glLightfv(light,pname,params);
660
764
  CHECK_GLERROR_FROM("glLightfv");
661
765
  return Qnil;
662
766
  }
@@ -668,11 +772,14 @@ VALUE obj,arg1,arg2,arg3;
668
772
  GLenum light;
669
773
  GLenum pname;
670
774
  GLint params[4]={0,0,0,0};
775
+ DECL_GL_FUNC_PTR(void,glLightiv,(GLenum light, GLenum pname, const GLint *params));
776
+
777
+ LOAD_GL_FUNC(glLightiv, NULL);
671
778
  light = (GLenum)NUM2INT(arg1);
672
779
  pname = (GLenum)NUM2INT(arg2);
673
780
  Check_Type(arg3,T_ARRAY);
674
781
  ary2cint(arg3,params,4);
675
- glLightiv(light,pname,params);
782
+ fptr_glLightiv(light,pname,params);
676
783
  CHECK_GLERROR_FROM("glLightiv");
677
784
  return Qnil;
678
785
  }
@@ -683,10 +790,13 @@ VALUE obj,arg1,arg2;
683
790
  {
684
791
  GLenum pname;
685
792
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
793
+ DECL_GL_FUNC_PTR(void,glLightModelfv,(GLenum pname, const GLfloat *params));
794
+
795
+ LOAD_GL_FUNC(glLightModelfv, NULL);
686
796
  pname = (GLenum)NUM2INT(arg1);
687
797
  Check_Type(arg2,T_ARRAY);
688
798
  ary2cflt(arg2,params,4);
689
- glLightModelfv(pname,params);
799
+ fptr_glLightModelfv(pname,params);
690
800
  CHECK_GLERROR_FROM("glLightModelfv");
691
801
  return Qnil;
692
802
  }
@@ -697,10 +807,13 @@ VALUE obj,arg1,arg2;
697
807
  {
698
808
  GLenum pname;
699
809
  GLint params[4] = {0,0,0,0};
810
+ DECL_GL_FUNC_PTR(void,glLightModeliv,(GLenum pname, const GLint *params));
811
+
812
+ LOAD_GL_FUNC(glLightModeliv, NULL);
700
813
  pname = (GLenum)NUM2INT(arg1);
701
814
  Check_Type(arg2,T_ARRAY);
702
815
  ary2cint(arg2,params,4);
703
- glLightModeliv(pname,params);
816
+ fptr_glLightModeliv(pname,params);
704
817
  CHECK_GLERROR_FROM("glLightModeliv");
705
818
  return Qnil;
706
819
  }
@@ -713,11 +826,14 @@ VALUE obj,arg1,arg2,arg3;
713
826
  GLenum face;
714
827
  GLenum pname;
715
828
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
829
+ DECL_GL_FUNC_PTR(void,glMaterialfv,(GLenum face, GLenum pname, const GLfloat *params));
830
+
831
+ LOAD_GL_FUNC(glMaterialfv, NULL);
716
832
  face = (GLenum)NUM2INT(arg1);
717
833
  pname = (GLenum)NUM2INT(arg2);
718
834
  Check_Type(arg3,T_ARRAY);
719
835
  ary2cflt(arg3,params,4);
720
- glMaterialfv(face,pname,params);
836
+ fptr_glMaterialfv(face,pname,params);
721
837
  CHECK_GLERROR_FROM("glMaterialfv");
722
838
  return Qnil;
723
839
  }
@@ -729,11 +845,14 @@ VALUE obj,arg1,arg2,arg3;
729
845
  GLenum face;
730
846
  GLenum pname;
731
847
  GLint params[4] = {0,0,0,0};
848
+ DECL_GL_FUNC_PTR(void,glMaterialiv,(GLenum face, GLenum pname, const GLint *params));
849
+
850
+ LOAD_GL_FUNC(glMaterialiv, NULL);
732
851
  face = (GLenum)NUM2INT(arg1);
733
852
  pname = (GLenum)NUM2INT(arg2);
734
853
  Check_Type(arg3,T_ARRAY);
735
854
  ary2cint(arg3,params,4);
736
- glMaterialiv(face,pname,params);
855
+ fptr_glMaterialiv(face,pname,params);
737
856
  CHECK_GLERROR_FROM("glMaterialiv");
738
857
  return Qnil;
739
858
  }
@@ -742,15 +861,18 @@ static VALUE
742
861
  gl_PolygonStipple(obj,arg1)
743
862
  VALUE obj,arg1;
744
863
  {
745
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
746
- glPolygonStipple((GLubyte *)NUM2SIZET(arg1));
864
+ DECL_GL_FUNC_PTR(void,glPolygonStipple,(const GLubyte *mask));
865
+
866
+ LOAD_GL_FUNC(glPolygonStipple, NULL);
867
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
868
+ fptr_glPolygonStipple((GLubyte *)NUM2SIZET(arg1));
747
869
  } else {
748
870
  VALUE data;
749
871
  data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg1);
750
872
  if (RSTRING_LEN(data) < 128)
751
873
  rb_raise(rb_eArgError, "string length:%li", RSTRING_LEN(data));
752
874
 
753
- glPolygonStipple((GLubyte *)RSTRING_PTR(data));
875
+ fptr_glPolygonStipple((GLubyte *)RSTRING_PTR(data));
754
876
  }
755
877
  CHECK_GLERROR_FROM("glPolygonStipple");
756
878
  return Qnil;
@@ -764,11 +886,14 @@ VALUE obj,arg1,arg2,arg3;
764
886
  GLenum target;
765
887
  GLenum pname;
766
888
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
889
+ DECL_GL_FUNC_PTR(void,glTexParameterfv,(GLenum target, GLenum pname, const GLfloat *params));
890
+
891
+ LOAD_GL_FUNC(glTexParameterfv, NULL);
767
892
  target = (GLenum)NUM2INT(arg1);
768
893
  pname = (GLenum)NUM2INT(arg2);
769
894
  Check_Type(arg3,T_ARRAY);
770
895
  ary2cflt(arg3,params,4);
771
- glTexParameterfv(target,pname,params);
896
+ fptr_glTexParameterfv(target,pname,params);
772
897
  CHECK_GLERROR_FROM("glTexParameterfv");
773
898
  return Qnil;
774
899
  }
@@ -780,11 +905,14 @@ VALUE obj,arg1,arg2,arg3;
780
905
  GLenum target;
781
906
  GLenum pname;
782
907
  GLint params[4] = {0,0,0,0};
908
+ DECL_GL_FUNC_PTR(void,glTexParameteriv,(GLenum target, GLenum pname, const GLint *params));
909
+
910
+ LOAD_GL_FUNC(glTexParameteriv, NULL);
783
911
  target = (GLenum)NUM2INT(arg1);
784
912
  pname = (GLenum)NUM2INT(arg2);
785
913
  Check_Type(arg3,T_ARRAY);
786
914
  ary2cint(arg3,params,4);
787
- glTexParameteriv(target,pname,params);
915
+ fptr_glTexParameteriv(target,pname,params);
788
916
  CHECK_GLERROR_FROM("glTexParameteriv");
789
917
  return Qnil;
790
918
  }
@@ -801,6 +929,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
801
929
  GLenum format;
802
930
  GLenum type;
803
931
  const char *pixels;
932
+ DECL_GL_FUNC_PTR(void,glTexImage1D,(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
933
+
934
+ LOAD_GL_FUNC(glTexImage1D, NULL);
804
935
  target = (GLenum)NUM2INT(arg1);
805
936
  level = (GLint)NUM2INT(arg2);
806
937
  components = (GLint)NUM2INT(arg3);
@@ -809,8 +940,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
809
940
  format = (GLenum)NUM2INT(arg6);
810
941
  type = (GLenum)NUM2INT(arg7);
811
942
 
812
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
813
- glTexImage1D(target,level,components,width,border,format,type,(GLvoid *)NUM2SIZET(arg8));
943
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
944
+ fptr_glTexImage1D(target,level,components,width,border,format,type,(GLvoid *)NUM2SIZET(arg8));
814
945
  CHECK_GLERROR_FROM("glTexImage1D");
815
946
  return Qnil;
816
947
  }
@@ -823,7 +954,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
823
954
  CheckDataSize(type,format,width,data);
824
955
  pixels = RSTRING_PTR(data);
825
956
  }
826
- glTexImage1D(target,level,components,width,border,format,type,pixels);
957
+ fptr_glTexImage1D(target,level,components,width,border,format,type,pixels);
827
958
  CHECK_GLERROR_FROM("glTexImage1D");
828
959
  return Qnil;
829
960
  }
@@ -841,6 +972,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
841
972
  GLenum format;
842
973
  GLenum type;
843
974
  const char *pixels;
975
+ DECL_GL_FUNC_PTR(void,glTexImage2D,(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels));
976
+
977
+ LOAD_GL_FUNC(glTexImage2D, NULL);
844
978
  target = (GLenum)NUM2INT(arg1);
845
979
  level = (GLint)NUM2INT(arg2);
846
980
  components = (GLint)NUM2INT(arg3);
@@ -850,8 +984,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
850
984
  format = (GLenum)NUM2INT(arg7);
851
985
  type = (GLenum)NUM2INT(arg8);
852
986
 
853
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
854
- glTexImage2D(target,level,components,width,height,border,format,type,(GLvoid *)NUM2SIZET(arg9));
987
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
988
+ fptr_glTexImage2D(target,level,components,width,height,border,format,type,(GLvoid *)NUM2SIZET(arg9));
855
989
  CHECK_GLERROR_FROM("glTexImage2D");
856
990
  return Qnil;
857
991
  }
@@ -864,7 +998,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
864
998
  CheckDataSize(type,format,width*height,data);
865
999
  pixels = RSTRING_PTR(data);
866
1000
  }
867
- glTexImage2D(target,level,components,width,height,border,format,type,pixels);
1001
+ fptr_glTexImage2D(target,level,components,width,height,border,format,type,pixels);
868
1002
  CHECK_GLERROR_FROM("glTexImage2D");
869
1003
  return Qnil;
870
1004
  }
@@ -876,11 +1010,14 @@ VALUE obj,arg1,arg2,arg3;
876
1010
  GLenum target;
877
1011
  GLenum pname;
878
1012
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1013
+ DECL_GL_FUNC_PTR(void,glTexEnvfv,(GLenum target, GLenum pname, const GLfloat *params));
1014
+
1015
+ LOAD_GL_FUNC(glTexEnvfv, NULL);
879
1016
  target = (GLenum)NUM2INT(arg1);
880
1017
  pname = (GLenum)NUM2INT(arg2);
881
1018
  Check_Type(arg3,T_ARRAY);
882
1019
  ary2cflt(arg3,params,4);
883
- glTexEnvfv(target,pname,params);
1020
+ fptr_glTexEnvfv(target,pname,params);
884
1021
  CHECK_GLERROR_FROM("glTexEnvfv");
885
1022
  return Qnil;
886
1023
  }
@@ -892,11 +1029,14 @@ VALUE obj,arg1,arg2,arg3;
892
1029
  GLenum target;
893
1030
  GLenum pname;
894
1031
  GLint params[4] = {0,0,0,0};
1032
+ DECL_GL_FUNC_PTR(void,glTexEnviv,(GLenum target, GLenum pname, const GLint *params));
1033
+
1034
+ LOAD_GL_FUNC(glTexEnviv, NULL);
895
1035
  target = (GLenum)NUM2INT(arg1);
896
1036
  pname = (GLenum)NUM2INT(arg2);
897
1037
  Check_Type(arg3,T_ARRAY);
898
1038
  ary2cint(arg3,params,4);
899
- glTexEnviv(target,pname,params);
1039
+ fptr_glTexEnviv(target,pname,params);
900
1040
  CHECK_GLERROR_FROM("glTexEnviv");
901
1041
  return Qnil;
902
1042
  }
@@ -909,11 +1049,14 @@ VALUE obj,arg1,arg2,arg3;
909
1049
  GLenum coord;
910
1050
  GLenum pname;
911
1051
  GLdouble params[4] = {0.0,0.0,0.0,0.0};
1052
+ DECL_GL_FUNC_PTR(void,glTexGendv,(GLenum coord, GLenum pname, const GLdouble *params));
1053
+
1054
+ LOAD_GL_FUNC(glTexGendv, NULL);
912
1055
  coord = (GLenum)NUM2INT(arg1);
913
1056
  pname = (GLenum)NUM2INT(arg2);
914
1057
  Check_Type(arg3,T_ARRAY);
915
1058
  ary2cdbl(arg3,params,4);
916
- glTexGendv(coord,pname,params);
1059
+ fptr_glTexGendv(coord,pname,params);
917
1060
  CHECK_GLERROR_FROM("glTexGendv");
918
1061
  return Qnil;
919
1062
  }
@@ -926,11 +1069,14 @@ VALUE obj,arg1,arg2,arg3;
926
1069
  GLenum coord;
927
1070
  GLenum pname;
928
1071
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1072
+ DECL_GL_FUNC_PTR(void,glTexGenfv,(GLenum coord, GLenum pname, const GLfloat *params));
1073
+
1074
+ LOAD_GL_FUNC(glTexGenfv, NULL);
929
1075
  coord = (GLenum)NUM2INT(arg1);
930
1076
  pname = (GLenum)NUM2INT(arg2);
931
1077
  Check_Type(arg3,T_ARRAY);
932
1078
  ary2cflt(arg3,params,4);
933
- glTexGenfv(coord,pname,params);
1079
+ fptr_glTexGenfv(coord,pname,params);
934
1080
  CHECK_GLERROR_FROM("glTexGenfv");
935
1081
  return Qnil;
936
1082
  }
@@ -943,42 +1089,53 @@ VALUE obj,arg1,arg2,arg3;
943
1089
  GLenum coord;
944
1090
  GLenum pname;
945
1091
  GLint params[4] = {0,0,0,0};
1092
+ DECL_GL_FUNC_PTR(void,glTexGeniv,(GLenum coord, GLenum pname, const GLint *params));
1093
+
1094
+ LOAD_GL_FUNC(glTexGeniv, NULL);
946
1095
  coord = (GLenum)NUM2INT(arg1);
947
1096
  pname = (GLenum)NUM2INT(arg2);
948
1097
  Check_Type(arg3,T_ARRAY);
949
1098
  ary2cint(arg3,params,4);
950
- glTexGeniv(coord,pname,params);
1099
+ fptr_glTexGeniv(coord,pname,params);
951
1100
  CHECK_GLERROR_FROM("glTexGeniv");
952
1101
  return Qnil;
953
1102
  }
954
- static VALUE g_current_feed_buffer;
955
1103
  static VALUE
956
1104
  gl_FeedbackBuffer(obj,arg1,arg2)
957
1105
  VALUE obj,arg1,arg2;
958
1106
  {
959
1107
  GLsizei size;
960
1108
  GLenum type;
1109
+ VALUE current_feed_buffer;
1110
+ DECL_GL_FUNC_PTR(void,glFeedbackBuffer,(GLsizei size, GLenum type, GLfloat *buffer));
1111
+
1112
+ LOAD_GL_FUNC(glFeedbackBuffer, NULL);
961
1113
  size = (GLsizei)NUM2UINT(arg1);
962
1114
  type = (GLenum)NUM2INT(arg2);
963
- g_current_feed_buffer = allocate_buffer_with_string(sizeof(GLfloat)*size);
964
- rb_str_freeze(g_current_feed_buffer);
965
- glFeedbackBuffer(size, type, (GLfloat*)RSTRING_PTR(g_current_feed_buffer));
1115
+ current_feed_buffer = allocate_buffer_with_string(sizeof(GLfloat)*size);
1116
+ rb_str_freeze(current_feed_buffer);
1117
+ fptr_glFeedbackBuffer(size, type, (GLfloat*)RSTRING_PTR(current_feed_buffer));
966
1118
  CHECK_GLERROR_FROM("glFeedbackBuffer");
967
- return g_current_feed_buffer;
1119
+ SET_GLIMPL_VARIABLE(current_feed_buffer, current_feed_buffer);
1120
+ return current_feed_buffer;
968
1121
  }
969
1122
 
970
- static VALUE g_current_sel_buffer;
971
1123
  static VALUE
972
1124
  gl_SelectBuffer(obj,arg1)
973
1125
  VALUE obj,arg1;
974
1126
  {
975
1127
  GLsizei size;
1128
+ VALUE current_sel_buffer;
1129
+ DECL_GL_FUNC_PTR(void,glSelectBuffer,(GLsizei size, GLuint *buffer));
1130
+
1131
+ LOAD_GL_FUNC(glSelectBuffer, NULL);
976
1132
  size = (GLsizei)NUM2UINT(arg1);
977
- g_current_sel_buffer = allocate_buffer_with_string(sizeof(GLuint)*size);
978
- rb_str_freeze(g_current_sel_buffer);
979
- glSelectBuffer(size, (GLuint*)RSTRING_PTR(g_current_sel_buffer));
1133
+ current_sel_buffer = allocate_buffer_with_string(sizeof(GLuint)*size);
1134
+ rb_str_freeze(current_sel_buffer);
1135
+ fptr_glSelectBuffer(size, (GLuint*)RSTRING_PTR(current_sel_buffer));
980
1136
  CHECK_GLERROR_FROM("glSelectBuffer");
981
- return g_current_sel_buffer;
1137
+ SET_GLIMPL_VARIABLE(current_sel_buffer, current_sel_buffer);
1138
+ return current_sel_buffer;
982
1139
  }
983
1140
 
984
1141
 
@@ -994,7 +1151,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
994
1151
  GLdouble *points;
995
1152
 
996
1153
  VALUE work_ary;
1154
+ DECL_GL_FUNC_PTR(void,glMap1d,(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points));
997
1155
 
1156
+ LOAD_GL_FUNC(glMap1d, NULL);
998
1157
  target = (GLenum)NUM2INT(arg1);
999
1158
  u1 = (GLdouble)NUM2DBL(arg2);
1000
1159
  u2 = (GLdouble)NUM2DBL(arg3);
@@ -1003,7 +1162,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
1003
1162
  points = ALLOC_N(GLdouble, order*stride);
1004
1163
  work_ary = rb_funcall(arg6,rb_intern("flatten"),0);
1005
1164
  ary2cdbl(work_ary, points, order*stride);
1006
- glMap1d(target, u1, u2, stride, order, points);
1165
+ fptr_glMap1d(target, u1, u2, stride, order, points);
1007
1166
  xfree(points);
1008
1167
  CHECK_GLERROR_FROM("glMap1d");
1009
1168
  return Qnil;
@@ -1021,7 +1180,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
1021
1180
  GLfloat *points;
1022
1181
 
1023
1182
  VALUE work_ary;
1183
+ DECL_GL_FUNC_PTR(void,glMap1f,(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points));
1024
1184
 
1185
+ LOAD_GL_FUNC(glMap1f, NULL);
1025
1186
  target = (GLenum)NUM2INT(arg1);
1026
1187
  u1 = (GLfloat)NUM2DBL(arg2);
1027
1188
  u2 = (GLfloat)NUM2DBL(arg3);
@@ -1030,7 +1191,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
1030
1191
  points = ALLOC_N(GLfloat, order*stride);
1031
1192
  work_ary = rb_funcall(arg6,rb_intern("flatten"),0);
1032
1193
  ary2cflt(work_ary, points, order*stride);
1033
- glMap1f(target, u1, u2, stride, order, points);
1194
+ fptr_glMap1f(target, u1, u2, stride, order, points);
1034
1195
  xfree(points);
1035
1196
  CHECK_GLERROR_FROM("glMap1f");
1036
1197
  return Qnil;
@@ -1052,7 +1213,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
1052
1213
  GLdouble *points;
1053
1214
 
1054
1215
  VALUE work_ary;
1216
+ DECL_GL_FUNC_PTR(void,glMap2d,(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points));
1055
1217
 
1218
+ LOAD_GL_FUNC(glMap2d, NULL);
1056
1219
  target = (GLenum)NUM2INT(arg1);
1057
1220
  u1 = (GLdouble)NUM2INT(arg2);
1058
1221
  u2 = (GLdouble)NUM2INT(arg3);
@@ -1065,7 +1228,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
1065
1228
  points = ALLOC_N(GLdouble, MAX(ustride*uorder, vstride*vorder));
1066
1229
  work_ary = rb_funcall(arg10,rb_intern("flatten"),0);
1067
1230
  ary2cdbl(work_ary, points, MAX(ustride*uorder, vstride*vorder));
1068
- glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
1231
+ fptr_glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
1069
1232
  xfree(points);
1070
1233
  CHECK_GLERROR_FROM("glMap2d");
1071
1234
  return Qnil;
@@ -1087,7 +1250,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
1087
1250
  GLfloat *points;
1088
1251
 
1089
1252
  VALUE work_ary;
1253
+ DECL_GL_FUNC_PTR(void,glMap2f,(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points));
1090
1254
 
1255
+ LOAD_GL_FUNC(glMap2f, NULL);
1091
1256
  target = (GLenum)NUM2INT(arg1);
1092
1257
  u1 = (GLfloat)NUM2INT(arg2);
1093
1258
  u2 = (GLfloat)NUM2INT(arg3);
@@ -1100,7 +1265,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
1100
1265
  points = ALLOC_N(GLfloat, MAX(ustride*uorder, vstride*vorder));
1101
1266
  work_ary = rb_funcall(arg10,rb_intern("flatten"),0);
1102
1267
  ary2cflt(work_ary, points, MAX(ustride*uorder, vstride*vorder));
1103
- glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
1268
+ fptr_glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
1104
1269
  xfree(points);
1105
1270
  CHECK_GLERROR_FROM("glMap2f");
1106
1271
  return Qnil;
@@ -1111,9 +1276,12 @@ gl_EvalCoord1dv(obj,arg1)
1111
1276
  VALUE obj,arg1;
1112
1277
  {
1113
1278
  GLdouble params[1] = {0.0};
1279
+ DECL_GL_FUNC_PTR(void,glEvalCoord1dv,(const GLdouble *u));
1280
+
1281
+ LOAD_GL_FUNC(glEvalCoord1dv, NULL);
1114
1282
  Check_Type(arg1,T_ARRAY);
1115
1283
  ary2cdbl(arg1,params,1);
1116
- glEvalCoord1dv(params);
1284
+ fptr_glEvalCoord1dv(params);
1117
1285
  CHECK_GLERROR_FROM("glEvalCoord1dv");
1118
1286
  return Qnil;
1119
1287
  }
@@ -1123,9 +1291,12 @@ gl_EvalCoord1fv(obj,arg1)
1123
1291
  VALUE obj,arg1;
1124
1292
  {
1125
1293
  GLfloat params[1] = {(GLfloat)0.0};
1294
+ DECL_GL_FUNC_PTR(void,glEvalCoord1fv,(const GLfloat *u));
1295
+
1296
+ LOAD_GL_FUNC(glEvalCoord1fv, NULL);
1126
1297
  Check_Type(arg1,T_ARRAY);
1127
1298
  ary2cflt(arg1,params,1);
1128
- glEvalCoord1fv(params);
1299
+ fptr_glEvalCoord1fv(params);
1129
1300
  CHECK_GLERROR_FROM("glEvalCoord1fv");
1130
1301
  return Qnil;
1131
1302
  }
@@ -1135,9 +1306,12 @@ gl_EvalCoord2dv(obj,arg1)
1135
1306
  VALUE obj,arg1;
1136
1307
  {
1137
1308
  GLdouble params[2] = {0.0,0.0};
1309
+ DECL_GL_FUNC_PTR(void,glEvalCoord2dv,(const GLdouble *u));
1310
+
1311
+ LOAD_GL_FUNC(glEvalCoord2dv, NULL);
1138
1312
  Check_Type(arg1,T_ARRAY);
1139
1313
  ary2cdbl(arg1,params,2);
1140
- glEvalCoord2dv(params);
1314
+ fptr_glEvalCoord2dv(params);
1141
1315
  CHECK_GLERROR_FROM("glEvalCoord2fv");
1142
1316
  return Qnil;
1143
1317
  }
@@ -1147,9 +1321,12 @@ gl_EvalCoord2fv(obj,arg1)
1147
1321
  VALUE obj,arg1;
1148
1322
  {
1149
1323
  GLfloat params[2] = {(GLfloat)0.0,(GLfloat)0.0};
1324
+ DECL_GL_FUNC_PTR(void,glEvalCoord2fv,(const GLfloat *u));
1325
+
1326
+ LOAD_GL_FUNC(glEvalCoord2fv, NULL);
1150
1327
  Check_Type(arg1,T_ARRAY);
1151
1328
  ary2cflt(arg1,params,2);
1152
- glEvalCoord2fv(params);
1329
+ fptr_glEvalCoord2fv(params);
1153
1330
  CHECK_GLERROR_FROM("glEvalCoord2fv");
1154
1331
  return Qnil;
1155
1332
  }
@@ -1166,25 +1343,27 @@ VALUE obj; \
1166
1343
  _vartype_ *values; \
1167
1344
  GLsizei size; \
1168
1345
  VALUE args[4]; \
1346
+ DECL_GL_FUNC_PTR(void,glPixelMap##_type_##v,(GLenum map, GLsizei mapsize, const _vartype_ *values)); \
1347
+ LOAD_GL_FUNC(glPixelMap##_type_##v, NULL); \
1169
1348
  switch(rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2])) { \
1170
1349
  default: \
1171
1350
  case 2: \
1172
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
1351
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
1173
1352
  rb_raise(rb_eArgError, "Pixel unpack buffer bound, but offset argument missing"); \
1174
1353
  map = (GLenum)NUM2INT(args[0]); \
1175
1354
  Check_Type(args[1],T_ARRAY); \
1176
1355
  size = (int)RARRAY_LENINT(args[1]); \
1177
1356
  values = ALLOC_N(_vartype_,size); \
1178
1357
  _convert_(args[1],values,size); \
1179
- glPixelMap##_type_##v(map,size,values); \
1358
+ fptr_glPixelMap##_type_##v(map,size,values); \
1180
1359
  xfree(values); \
1181
1360
  break; \
1182
1361
  case 3: \
1183
- if (!CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
1362
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) \
1184
1363
  rb_raise(rb_eArgError, "Pixel unpack buffer not bound"); \
1185
1364
  map = (GLenum)NUM2INT(args[0]); \
1186
1365
  size = (GLsizei)NUM2INT(args[1]); \
1187
- glPixelMap##_type_##v(map,size,(GLvoid *)NUM2SIZET(args[2])); \
1366
+ fptr_glPixelMap##_type_##v(map,size,(GLvoid *)NUM2SIZET(args[2])); \
1188
1367
  break; \
1189
1368
  } \
1190
1369
  CHECK_GLERROR_FROM("glPixelMap" #_type_ "v"); \
@@ -1212,6 +1391,9 @@ VALUE obj;
1212
1391
  VALUE pixels;
1213
1392
  VALUE args[7];
1214
1393
  int numargs;
1394
+ DECL_GL_FUNC_PTR(void,glReadPixels,(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels));
1395
+
1396
+ LOAD_GL_FUNC(glReadPixels, NULL);
1215
1397
  numargs = rb_scan_args(argc, argv, "61", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6]);
1216
1398
  x = (GLint)NUM2INT(args[0]);
1217
1399
  y = (GLint)NUM2INT(args[1]);
@@ -1223,20 +1405,20 @@ VALUE obj;
1223
1405
  switch(numargs) {
1224
1406
  default:
1225
1407
  case 6:
1226
- if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
1408
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1227
1409
  rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
1228
1410
  pixels = allocate_buffer_with_string(GetDataSize(type,format,width*height));
1229
1411
  FORCE_PIXEL_STORE_MODE
1230
- glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING_PTR(pixels));
1412
+ fptr_glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING_PTR(pixels));
1231
1413
  RESTORE_PIXEL_STORE_MODE
1232
1414
  CHECK_GLERROR_FROM("glReadPixels");
1233
1415
  return pixels;
1234
1416
  break;
1235
1417
  case 7:
1236
- if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
1418
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1237
1419
  rb_raise(rb_eArgError, "Pixel pack buffer not bound");
1238
1420
  FORCE_PIXEL_STORE_MODE
1239
- glReadPixels(x,y,width,height,format,type,(GLvoid*)NUM2SIZET(args[6]));
1421
+ fptr_glReadPixels(x,y,width,height,format,type,(GLvoid*)NUM2SIZET(args[6]));
1240
1422
  RESTORE_PIXEL_STORE_MODE
1241
1423
  CHECK_GLERROR_FROM("glReadPixels");
1242
1424
  return Qnil;
@@ -1253,18 +1435,21 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5;
1253
1435
  GLenum format;
1254
1436
  GLenum type;
1255
1437
  const char *pixels;
1438
+ DECL_GL_FUNC_PTR(void,glDrawPixels,(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels));
1439
+
1440
+ LOAD_GL_FUNC(glDrawPixels, NULL);
1256
1441
  width = (GLsizei)NUM2UINT(arg1);
1257
1442
  height = (GLsizei)NUM2UINT(arg2);
1258
1443
  format = (GLenum)NUM2INT(arg3);
1259
1444
  type = (GLenum)NUM2INT(arg4);
1260
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
1261
- glDrawPixels(width,height,format,type,(GLvoid *)NUM2SIZET(arg5));
1445
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
1446
+ fptr_glDrawPixels(width,height,format,type,(GLvoid *)NUM2SIZET(arg5));
1262
1447
  } else {
1263
1448
  VALUE data;
1264
1449
  data = pack_array_or_pass_string(type,arg5);
1265
1450
  CheckDataSize(type,format,width*height,data);
1266
1451
  pixels = RSTRING_PTR(data);
1267
- glDrawPixels(width,height,format,type,pixels);
1452
+ fptr_glDrawPixels(width,height,format,type,pixels);
1268
1453
  }
1269
1454
  CHECK_GLERROR_FROM("glDrawPixels");
1270
1455
  return Qnil;
@@ -1278,8 +1463,11 @@ VALUE obj,arg1;
1278
1463
  GLdouble equation[4] = {0.0,0.0,0.0,0.0};
1279
1464
  VALUE retary;
1280
1465
  int i;
1466
+ DECL_GL_FUNC_PTR(void,glGetClipPlane,(GLenum plane, GLdouble *equation));
1467
+
1468
+ LOAD_GL_FUNC(glGetClipPlane, NULL);
1281
1469
  plane = (GLenum)NUM2INT(arg1);
1282
- glGetClipPlane(plane,equation);
1470
+ fptr_glGetClipPlane(plane,equation);
1283
1471
  retary = rb_ary_new2(4);
1284
1472
  for(i=0;i<4;i++)
1285
1473
  rb_ary_push(retary, rb_float_new(equation[i]));
@@ -1297,6 +1485,8 @@ VALUE obj,arg1; \
1297
1485
  VALUE ary, ary2; \
1298
1486
  int i,j; \
1299
1487
  _type_ items[64]; \
1488
+ DECL_GL_FUNC_PTR(void,glGet##_name_##v,(GLenum pname, _type_ *params)); \
1489
+ LOAD_GL_FUNC(glGet##_name_##v, NULL); \
1300
1490
  pname = NUM2INT(arg1); \
1301
1491
  switch(pname) { \
1302
1492
  case GL_ACCUM_CLEAR_VALUE: \
@@ -1398,7 +1588,7 @@ VALUE obj,arg1; \
1398
1588
  case GL_PIXEL_TRANSFORM_2D_MATRIX_EXT: \
1399
1589
  case GL_MODELVIEW1_MATRIX_EXT: \
1400
1590
  case GL_CURRENT_MATRIX_NV: \
1401
- glGet##_name_##v(pname, items); \
1591
+ fptr_glGet##_name_##v(pname, items); \
1402
1592
  ary = rb_ary_new2(4); \
1403
1593
  for (i = 0; i < 4; i++) { \
1404
1594
  ary2 = rb_ary_new2(4); \
@@ -1409,21 +1599,25 @@ VALUE obj,arg1; \
1409
1599
  CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1410
1600
  return ary; \
1411
1601
  case GL_POLYGON_STIPPLE: \
1412
- glGet##_name_##v(pname, items); \
1602
+ fptr_glGet##_name_##v(pname, items); \
1413
1603
  CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1414
1604
  return rb_str_new((const char*)items, 32); \
1415
1605
  case GL_COMPRESSED_TEXTURE_FORMATS: \
1416
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nitems); \
1417
- CHECK_GLERROR_FROM("glGetIntegerv"); \
1418
- if (nitems<=0||nitems>64) \
1419
- return INT2NUM(0); \
1606
+ { \
1607
+ DECL_GL_FUNC_PTR(void,glGetIntegerv,(GLenum pname, GLint *params)); \
1608
+ LOAD_GL_FUNC(glGetIntegerv, NULL); \
1609
+ fptr_glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &nitems); \
1610
+ CHECK_GLERROR_FROM("glGetIntegerv"); \
1611
+ if (nitems<=0||nitems>64) \
1612
+ return INT2NUM(0); \
1613
+ } \
1420
1614
  break; \
1421
1615
  default: /* size=1 */ \
1422
- glGet##_name_##v(pname, items); \
1616
+ fptr_glGet##_name_##v(pname, items); \
1423
1617
  CHECK_GLERROR_FROM("glGet" #_name_ "v"); \
1424
1618
  return _conv_(items[0]); \
1425
1619
  } \
1426
- glGet##_name_##v(pname, items); \
1620
+ fptr_glGet##_name_##v(pname, items); \
1427
1621
  ary = rb_ary_new2(nitems); \
1428
1622
  for (i = 0; i < nitems; i++) \
1429
1623
  rb_ary_push(ary, _conv_(items[i])); \
@@ -1447,6 +1641,9 @@ VALUE obj,arg1,arg2;
1447
1641
  GLenum pname;
1448
1642
  GLsizei size;
1449
1643
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1644
+ DECL_GL_FUNC_PTR(void,glGetLightfv,(GLenum light, GLenum pname, GLfloat *params));
1645
+
1646
+ LOAD_GL_FUNC(glGetLightfv, NULL);
1450
1647
  light = (GLenum)NUM2INT(arg1);
1451
1648
  pname = (GLenum)NUM2INT(arg2);
1452
1649
  switch(pname) {
@@ -1470,7 +1667,7 @@ VALUE obj,arg1,arg2;
1470
1667
  rb_raise(rb_eArgError, "unknown pname:%d",pname);
1471
1668
  break; /* not reached */
1472
1669
  }
1473
- glGetLightfv(light,pname,params);
1670
+ fptr_glGetLightfv(light,pname,params);
1474
1671
  RET_ARRAY_OR_SINGLE("glGetLightfv", size, rb_float_new, params);
1475
1672
  }
1476
1673
 
@@ -1482,6 +1679,9 @@ VALUE obj,arg1,arg2;
1482
1679
  GLenum pname;
1483
1680
  GLsizei size;
1484
1681
  GLint params[4] = {0,0,0,0};
1682
+ DECL_GL_FUNC_PTR(void,glGetLightiv,(GLenum light, GLenum pname, GLint *params));
1683
+
1684
+ LOAD_GL_FUNC(glGetLightiv, NULL);
1485
1685
  light = (GLenum)NUM2INT(arg1);
1486
1686
  pname = (GLenum)NUM2INT(arg2);
1487
1687
  switch(pname) {
@@ -1505,7 +1705,7 @@ VALUE obj,arg1,arg2;
1505
1705
  rb_raise(rb_eArgError, "unknown pname:%d",pname);
1506
1706
  break; /* not reached */
1507
1707
  }
1508
- glGetLightiv(light,pname,params);
1708
+ fptr_glGetLightiv(light,pname,params);
1509
1709
  RET_ARRAY_OR_SINGLE("glGetLightiv", size, INT2NUM, params);
1510
1710
  }
1511
1711
 
@@ -1521,6 +1721,8 @@ VALUE obj,arg1,arg2; \
1521
1721
  int size=0; \
1522
1722
  _type_ *points; \
1523
1723
  GLint order[2] = {0,0}; /* for GL_COEFF, [order] or [uorder,vorder] (MAP1/MAP2) */ \
1724
+ DECL_GL_FUNC_PTR(void,gl##_name_,(GLenum target, GLenum query, _type_ *v)); \
1725
+ LOAD_GL_FUNC(gl##_name_, NULL); \
1524
1726
  target = (GLenum)NUM2INT(arg1); \
1525
1727
  query = (GLenum)NUM2INT(arg2); \
1526
1728
  switch(target) { \
@@ -1550,19 +1752,23 @@ VALUE obj,arg1,arg2; \
1550
1752
  case GL_ORDER: size = dims; break; \
1551
1753
  case GL_DOMAIN: size = dims*2; break; \
1552
1754
  case GL_COEFF: \
1553
- glGetMapiv(target,GL_ORDER,order); \
1554
- CHECK_GLERROR_FROM("glGetMapiv"); \
1555
- if (dims==1) \
1556
- size = order[0] * pointsize; \
1557
- else \
1558
- size = (order[0]*order[1]) * pointsize; \
1755
+ { \
1756
+ DECL_GL_FUNC_PTR(void,glGetMapiv,(GLenum target, GLenum query, GLint *v)); \
1757
+ LOAD_GL_FUNC(glGetMapiv, NULL); \
1758
+ fptr_glGetMapiv(target,GL_ORDER,order); \
1759
+ CHECK_GLERROR_FROM("glGetMapiv"); \
1760
+ if (dims==1) \
1761
+ size = order[0] * pointsize; \
1762
+ else \
1763
+ size = (order[0]*order[1]) * pointsize; \
1764
+ } \
1559
1765
  break; \
1560
1766
  default: \
1561
1767
  rb_raise(rb_eArgError, "unknown target:%d",target); \
1562
1768
  break; /* not reached */ \
1563
1769
  } \
1564
1770
  points = ALLOC_N(_type_,size); \
1565
- gl##_name_(target,query,points); \
1771
+ fptr_gl##_name_(target,query,points); \
1566
1772
  \
1567
1773
  RET_ARRAY_OR_SINGLE_FREE("gl" #_name_, size, RETCONV_##_type_, points); \
1568
1774
  }
@@ -1580,6 +1786,9 @@ VALUE obj,arg1,arg2;
1580
1786
  GLenum pname;
1581
1787
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1582
1788
  int size;
1789
+ DECL_GL_FUNC_PTR(void,glGetMaterialfv,(GLenum face, GLenum pname, GLfloat *params));
1790
+
1791
+ LOAD_GL_FUNC(glGetMaterialfv, NULL);
1583
1792
  face = (GLenum)NUM2INT(arg1);
1584
1793
  pname = (GLenum)NUM2INT(arg2);
1585
1794
  switch(pname) {
@@ -1599,7 +1808,7 @@ VALUE obj,arg1,arg2;
1599
1808
  rb_raise(rb_eArgError, "unknown pname:%d",pname);
1600
1809
  break; /* not reached */
1601
1810
  }
1602
- glGetMaterialfv(face,pname,params);
1811
+ fptr_glGetMaterialfv(face,pname,params);
1603
1812
  RET_ARRAY_OR_SINGLE("glGetMaterialfv", size, rb_float_new, params);
1604
1813
  }
1605
1814
 
@@ -1611,6 +1820,9 @@ VALUE obj,arg1,arg2;
1611
1820
  GLenum pname;
1612
1821
  GLint params[4] = {0,0,0,0};
1613
1822
  int size;
1823
+ DECL_GL_FUNC_PTR(void,glGetMaterialiv,(GLenum face, GLenum pname, GLint *params));
1824
+
1825
+ LOAD_GL_FUNC(glGetMaterialiv, NULL);
1614
1826
  face = (GLenum)NUM2INT(arg1);
1615
1827
  pname = (GLenum)NUM2INT(arg2);
1616
1828
  switch(pname) {
@@ -1630,7 +1842,7 @@ VALUE obj,arg1,arg2;
1630
1842
  rb_raise(rb_eArgError, "unknown pname:%d",pname);
1631
1843
  break; /* not reached */
1632
1844
  }
1633
- glGetMaterialiv(face,pname,params);
1845
+ fptr_glGetMaterialiv(face,pname,params);
1634
1846
  RET_ARRAY_OR_SINGLE("glGetMaterialiv", size, INT2NUM, params);
1635
1847
  }
1636
1848
 
@@ -1646,10 +1858,12 @@ VALUE obj; \
1646
1858
  GLint size = 0; \
1647
1859
  _vartype_ *values; \
1648
1860
  VALUE args[2]; \
1861
+ DECL_GL_FUNC_PTR(void,glGetPixelMap##_type_##v,(GLenum map, _vartype_ *values)); \
1862
+ LOAD_GL_FUNC(glGetPixelMap##_type_##v, NULL); \
1649
1863
  switch (rb_scan_args(argc, argv, "11", &args[0], &args[1])) { \
1650
1864
  default: \
1651
1865
  case 1: \
1652
- if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING)) \
1866
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING)) \
1653
1867
  rb_raise(rb_eArgError, \
1654
1868
  "Pixel pack buffer bound, but offset argument missing"); \
1655
1869
  \
@@ -1669,19 +1883,23 @@ VALUE obj; \
1669
1883
  rb_raise(rb_eArgError, "unknown map:%d",map); \
1670
1884
  break; \
1671
1885
  } \
1672
- glGetIntegerv(map_size,&size); \
1886
+ { \
1887
+ DECL_GL_FUNC_PTR(void,glGetIntegerv,(GLenum pname, GLint *params)); \
1888
+ LOAD_GL_FUNC(glGetIntegerv, NULL); \
1889
+ fptr_glGetIntegerv(map_size,&size); \
1890
+ } \
1673
1891
  CHECK_GLERROR_FROM("glGetIntegerv"); \
1674
1892
  values = ALLOC_N(_vartype_,size); \
1675
- glGetPixelMap##_type_##v(map,values); \
1893
+ fptr_glGetPixelMap##_type_##v(map,values); \
1676
1894
  RET_ARRAY_OR_SINGLE_FREE("glGetPixelMap" #_type_ "v", size, _convert_, \
1677
1895
  values); \
1678
1896
  break; \
1679
1897
  case 2: \
1680
- if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING)) \
1898
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING)) \
1681
1899
  rb_raise(rb_eArgError, "Pixel pack buffer not bound"); \
1682
1900
  \
1683
1901
  map = (GLenum)NUM2INT(args[0]); \
1684
- glGetPixelMap##_type_##v(map,(GLvoid*)NUM2SIZET(args[1])); \
1902
+ fptr_glGetPixelMap##_type_##v(map,(GLvoid*)NUM2SIZET(args[1])); \
1685
1903
  CHECK_GLERROR_FROM("glGetPixelMap" #_type_ "v"); \
1686
1904
  return Qnil; \
1687
1905
  } \
@@ -1700,21 +1918,24 @@ VALUE obj;
1700
1918
  {
1701
1919
  VALUE args[1];
1702
1920
  GLubyte mask[128];
1921
+ DECL_GL_FUNC_PTR(void,glGetPolygonStipple,(GLubyte *mask));
1922
+
1923
+ LOAD_GL_FUNC(glGetPolygonStipple, NULL);
1703
1924
  switch(rb_scan_args(argc, argv, "01", &args[0])) {
1704
1925
  default:
1705
1926
  case 0:
1706
- if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
1927
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1707
1928
  rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
1708
1929
  memset(mask, 0x0, sizeof(GLubyte)*128);
1709
1930
  FORCE_PIXEL_STORE_MODE
1710
- glGetPolygonStipple(mask);
1931
+ fptr_glGetPolygonStipple(mask);
1711
1932
  RESTORE_PIXEL_STORE_MODE
1712
1933
  CHECK_GLERROR_FROM("glGetPolygonStipple");
1713
1934
  return rb_str_new((const char*)mask, 128);
1714
1935
  case 1:
1715
- if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
1936
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1716
1937
  rb_raise(rb_eArgError, "Pixel pack buffer not bound");
1717
- glGetPolygonStipple((GLvoid *)NUM2SIZET(args[0]));
1938
+ fptr_glGetPolygonStipple((GLvoid *)NUM2SIZET(args[0]));
1718
1939
  CHECK_GLERROR_FROM("glGetPolygonStipple");
1719
1940
  return Qnil;
1720
1941
  }
@@ -1726,8 +1947,11 @@ VALUE obj,arg1;
1726
1947
  {
1727
1948
  GLenum name;
1728
1949
  const GLubyte *ret;
1950
+ DECL_GL_FUNC_PTR(const GLubyte *,glGetString,(GLenum name));
1951
+
1952
+ LOAD_GL_FUNC(glGetString, NULL);
1729
1953
  name = (GLenum)NUM2INT(arg1);
1730
- ret = glGetString(name);
1954
+ ret = fptr_glGetString(name);
1731
1955
  CHECK_GLERROR_FROM("glGetString");
1732
1956
  return rb_str_new2((const char*)ret);
1733
1957
  }
@@ -1741,6 +1965,8 @@ VALUE obj,arg1,arg2; \
1741
1965
  GLenum pname; \
1742
1966
  _type_ params[4] = {(_type_)0.0, (_type_)0.0, (_type_)0.0, (_type_)0.0}; \
1743
1967
  int size; \
1968
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLenum target, GLenum pname, _type_ *params)); \
1969
+ LOAD_GL_FUNC(gl##_name_, NULL); \
1744
1970
  target = (GLenum)NUM2INT(arg1); \
1745
1971
  pname = (GLenum)NUM2INT(arg2); \
1746
1972
  switch(pname) { \
@@ -1757,7 +1983,7 @@ VALUE obj,arg1,arg2; \
1757
1983
  size = 1; \
1758
1984
  break; \
1759
1985
  } \
1760
- gl##_name_(target,pname,params); \
1986
+ fptr_gl##_name_(target,pname,params); \
1761
1987
  RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
1762
1988
  }
1763
1989
 
@@ -1774,6 +2000,8 @@ VALUE obj,arg1,arg2; \
1774
2000
  GLenum pname; \
1775
2001
  _type_ params[4] = {(_type_)0.0, (_type_)0.0, (_type_)0.0, (_type_)0.0}; \
1776
2002
  int size; \
2003
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLenum coord, GLenum pname, _type_ *params)); \
2004
+ LOAD_GL_FUNC(gl##_name_, NULL); \
1777
2005
  coord = (GLenum)NUM2INT(arg1); \
1778
2006
  pname = (GLenum)NUM2INT(arg2); \
1779
2007
  switch(pname) { \
@@ -1785,7 +2013,7 @@ VALUE obj,arg1,arg2; \
1785
2013
  size = 1; \
1786
2014
  break; \
1787
2015
  } \
1788
- gl##_name_(coord,pname,params); \
2016
+ fptr_gl##_name_(coord,pname,params); \
1789
2017
  RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
1790
2018
  }
1791
2019
 
@@ -1812,6 +2040,9 @@ VALUE obj;
1812
2040
  VALUE pixels;
1813
2041
  VALUE args[5];
1814
2042
  int numargs;
2043
+ DECL_GL_FUNC_PTR(void,glGetTexImage,(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels));
2044
+
2045
+ LOAD_GL_FUNC(glGetTexImage, NULL);
1815
2046
  numargs = rb_scan_args(argc, argv, "41", &args[0], &args[1], &args[2], &args[3], &args[4]);
1816
2047
  tex = (GLenum)NUM2INT(args[0]);
1817
2048
  lod = (GLint)NUM2INT(args[1]);
@@ -1820,55 +2051,59 @@ VALUE obj;
1820
2051
  switch(numargs) {
1821
2052
  default:
1822
2053
  case 4:
1823
- if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
1824
- rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
1825
-
1826
- size = 1;
1827
- switch(tex) {
1828
- case GL_TEXTURE_4D_SGIS:
1829
- glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_4DSIZE_SGIS,&size4d);
1830
- size *= size4d;
1831
- /* fall through */
1832
- case GL_TEXTURE_3D:
1833
- case GL_TEXTURE_1D_STACK_MESAX:
1834
- case GL_TEXTURE_2D_STACK_MESAX:
1835
- glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_DEPTH,&depth);
1836
- size *= depth;
1837
- /* fall through */
1838
- case GL_TEXTURE_2D:
1839
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
1840
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
1841
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
1842
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
1843
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
1844
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
1845
- case GL_TEXTURE_RECTANGLE_ARB:
1846
- case GL_DETAIL_TEXTURE_2D_SGIS:
1847
- glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_HEIGHT,&height);
1848
- size *= height;
1849
- /* fall through */
1850
- case GL_TEXTURE_1D:
1851
- glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_WIDTH,&width);
1852
- size *= width;
1853
- break;
1854
- default:
1855
- rb_raise(rb_eArgError, "Target type not supported");
2054
+ {
2055
+ DECL_GL_FUNC_PTR(void,glGetTexLevelParameteriv,(GLenum target, GLint level, GLenum pname, GLint *params));
2056
+ LOAD_GL_FUNC(glGetTexLevelParameteriv, NULL);
2057
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
2058
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
2059
+
2060
+ size = 1;
2061
+ switch(tex) {
2062
+ case GL_TEXTURE_4D_SGIS:
2063
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_4DSIZE_SGIS,&size4d);
2064
+ size *= size4d;
2065
+ /* fall through */
2066
+ case GL_TEXTURE_3D:
2067
+ case GL_TEXTURE_1D_STACK_MESAX:
2068
+ case GL_TEXTURE_2D_STACK_MESAX:
2069
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_DEPTH,&depth);
2070
+ size *= depth;
2071
+ /* fall through */
2072
+ case GL_TEXTURE_2D:
2073
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
2074
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
2075
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
2076
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
2077
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
2078
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
2079
+ case GL_TEXTURE_RECTANGLE_ARB:
2080
+ case GL_DETAIL_TEXTURE_2D_SGIS:
2081
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_HEIGHT,&height);
2082
+ size *= height;
2083
+ /* fall through */
2084
+ case GL_TEXTURE_1D:
2085
+ fptr_glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_WIDTH,&width);
2086
+ size *= width;
2087
+ break;
2088
+ default:
2089
+ rb_raise(rb_eArgError, "Target type not supported");
2090
+ }
2091
+ CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
2092
+ pixels = allocate_buffer_with_string(GetDataSize(type,format,size));
2093
+
2094
+ FORCE_PIXEL_STORE_MODE
2095
+ fptr_glGetTexImage(tex,lod,format,type,(GLvoid*)RSTRING_PTR(pixels));
2096
+ RESTORE_PIXEL_STORE_MODE
2097
+ CHECK_GLERROR_FROM("glGetTexImage");
2098
+ return pixels;
1856
2099
  }
1857
- CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
1858
- pixels = allocate_buffer_with_string(GetDataSize(type,format,size));
1859
-
1860
- FORCE_PIXEL_STORE_MODE
1861
- glGetTexImage(tex,lod,format,type,(GLvoid*)RSTRING_PTR(pixels));
1862
- RESTORE_PIXEL_STORE_MODE
1863
- CHECK_GLERROR_FROM("glGetTexImage");
1864
- return pixels;
1865
2100
  break;
1866
2101
  case 5:
1867
- if (!CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
2102
+ if (!CHECK_BUFFER_BINDING(GL_PIXEL_PACK_BUFFER_BINDING))
1868
2103
  rb_raise(rb_eArgError, "Pixel pack buffer not bound");
1869
2104
 
1870
2105
  FORCE_PIXEL_STORE_MODE
1871
- glGetTexImage(tex,lod,format,type,(GLvoid*)NUM2SIZET(args[4]));
2106
+ fptr_glGetTexImage(tex,lod,format,type,(GLvoid*)NUM2SIZET(args[4]));
1872
2107
  RESTORE_PIXEL_STORE_MODE
1873
2108
  CHECK_GLERROR_FROM("glGetTexImage");
1874
2109
  return Qnil;
@@ -1883,6 +2118,9 @@ VALUE obj,arg1,arg2;
1883
2118
  GLenum pname;
1884
2119
  GLfloat params[4] = {(GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0, (GLfloat)0.0};
1885
2120
  int size;
2121
+ DECL_GL_FUNC_PTR(void,glGetTexParameterfv,(GLenum target, GLenum pname, GLfloat *params));
2122
+
2123
+ LOAD_GL_FUNC(glGetTexParameterfv, NULL);
1886
2124
  target = (GLenum)NUM2INT(arg1);
1887
2125
  pname = (GLenum)NUM2INT(arg2);
1888
2126
  switch(pname) {
@@ -1896,7 +2134,7 @@ VALUE obj,arg1,arg2;
1896
2134
  size = 1;
1897
2135
  break;
1898
2136
  }
1899
- glGetTexParameterfv(target,pname,params);
2137
+ fptr_glGetTexParameterfv(target,pname,params);
1900
2138
  RET_ARRAY_OR_SINGLE("glGetTexParameterfv", size, RETCONV_GLfloat, params);
1901
2139
  }
1902
2140
 
@@ -1908,6 +2146,9 @@ VALUE obj,arg1,arg2;
1908
2146
  GLenum pname;
1909
2147
  GLint params[4] = {0,0,0,0};
1910
2148
  int size;
2149
+ DECL_GL_FUNC_PTR(void,glGetTexParameteriv,(GLenum target, GLenum pname, GLint *params));
2150
+
2151
+ LOAD_GL_FUNC(glGetTexParameteriv, NULL);
1911
2152
  target = (GLenum)NUM2INT(arg1);
1912
2153
  pname = (GLenum)NUM2INT(arg2);
1913
2154
  switch(pname) {
@@ -1921,7 +2162,7 @@ VALUE obj,arg1,arg2;
1921
2162
  size = 1;
1922
2163
  break;
1923
2164
  }
1924
- glGetTexParameteriv(target,pname,params);
2165
+ fptr_glGetTexParameteriv(target,pname,params);
1925
2166
  RET_ARRAY_OR_SINGLE_BOOL("glGetTexParameteriv", size, cond_GLBOOL2RUBY,
1926
2167
  pname, params);
1927
2168
  }
@@ -1934,10 +2175,13 @@ VALUE obj,arg1,arg2,arg3;
1934
2175
  GLint level;
1935
2176
  GLenum pname;
1936
2177
  GLfloat params = (GLfloat)0.0;
2178
+ DECL_GL_FUNC_PTR(void,glGetTexLevelParameterfv,(GLenum target, GLint level, GLenum pname, GLfloat *params));
2179
+
2180
+ LOAD_GL_FUNC(glGetTexLevelParameterfv, NULL);
1937
2181
  target = (GLenum)NUM2INT(arg1);
1938
2182
  level = (GLint)NUM2INT(arg2);
1939
2183
  pname = (GLenum)NUM2INT(arg3);
1940
- glGetTexLevelParameterfv(target,level,pname,&params);
2184
+ fptr_glGetTexLevelParameterfv(target,level,pname,&params);
1941
2185
  CHECK_GLERROR_FROM("glGetTexLevelParameterfv");
1942
2186
  return RETCONV_GLfloat(params);
1943
2187
  }
@@ -1950,10 +2194,13 @@ VALUE obj,arg1,arg2,arg3;
1950
2194
  GLint level;
1951
2195
  GLenum pname;
1952
2196
  GLint params = 0;
2197
+ DECL_GL_FUNC_PTR(void,glGetTexLevelParameteriv,(GLenum target, GLint level, GLenum pname, GLint *params));
2198
+
2199
+ LOAD_GL_FUNC(glGetTexLevelParameteriv, NULL);
1953
2200
  target = (GLenum)NUM2INT(arg1);
1954
2201
  level = (GLint)NUM2INT(arg2);
1955
2202
  pname = (GLenum)NUM2INT(arg3);
1956
- glGetTexLevelParameteriv(target,level,pname,&params);
2203
+ fptr_glGetTexLevelParameteriv(target,level,pname,&params);
1957
2204
  CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
1958
2205
  return cond_GLBOOL2RUBY(pname,params);
1959
2206
  }
@@ -1964,8 +2211,11 @@ gl_LoadMatrixf(obj,arg1)
1964
2211
  VALUE obj,arg1;
1965
2212
  {
1966
2213
  GLfloat m[4*4];
2214
+ DECL_GL_FUNC_PTR(void,glLoadMatrixf,(const GLfloat *m));
2215
+
2216
+ LOAD_GL_FUNC(glLoadMatrixf, NULL);
1967
2217
  ary2cmatfloat(arg1, m, 4, 4);
1968
- glLoadMatrixf(m);
2218
+ fptr_glLoadMatrixf(m);
1969
2219
  CHECK_GLERROR_FROM("glLoadMatrixf");
1970
2220
  return Qnil;
1971
2221
  }
@@ -1975,8 +2225,11 @@ gl_LoadMatrixd(obj,arg1)
1975
2225
  VALUE obj,arg1;
1976
2226
  {
1977
2227
  GLdouble m[4*4];
2228
+ DECL_GL_FUNC_PTR(void,glLoadMatrixd,(const GLdouble *m));
2229
+
2230
+ LOAD_GL_FUNC(glLoadMatrixd, NULL);
1978
2231
  ary2cmatdouble(arg1, m, 4, 4);
1979
- glLoadMatrixd(m);
2232
+ fptr_glLoadMatrixd(m);
1980
2233
  CHECK_GLERROR_FROM("glLoadMatrixd");
1981
2234
  return Qnil;
1982
2235
  }
@@ -1986,8 +2239,11 @@ gl_MultMatrixf(obj,arg1)
1986
2239
  VALUE obj,arg1;
1987
2240
  {
1988
2241
  GLfloat m[4*4];
2242
+ DECL_GL_FUNC_PTR(void,glMultMatrixf,(const GLfloat *m));
2243
+
2244
+ LOAD_GL_FUNC(glMultMatrixf, NULL);
1989
2245
  ary2cmatfloat(arg1, m, 4, 4);
1990
- glMultMatrixf(m);
2246
+ fptr_glMultMatrixf(m);
1991
2247
  CHECK_GLERROR_FROM("glMultMatrixf");
1992
2248
  return Qnil;
1993
2249
  }
@@ -1997,21 +2253,16 @@ gl_MultMatrixd(obj,arg1)
1997
2253
  VALUE obj,arg1;
1998
2254
  {
1999
2255
  GLdouble m[4*4];
2256
+ DECL_GL_FUNC_PTR(void,glMultMatrixd,(const GLdouble *m));
2257
+
2258
+ LOAD_GL_FUNC(glMultMatrixd, NULL);
2000
2259
  ary2cmatdouble(arg1, m, 4, 4);
2001
- glMultMatrixd(m);
2260
+ fptr_glMultMatrixd(m);
2002
2261
  CHECK_GLERROR_FROM("glMultMatrixd");
2003
2262
  return Qnil;
2004
2263
  }
2005
2264
 
2006
2265
 
2007
- static VALUE g_Vertex_ptr;
2008
- static VALUE g_Normal_ptr;
2009
- static VALUE g_Color_ptr;
2010
- static VALUE g_Index_ptr;
2011
- static VALUE g_TexCoord_ptr;
2012
- static VALUE g_EdgeFlag_ptr;
2013
- VALUE g_FogCoord_ptr; /* OpenGL 1.4 */
2014
- VALUE g_SecondaryColor_ptr; /* OpenGL 1.4 */
2015
2266
  #define POINTER_FUNC(_func_) \
2016
2267
  static VALUE \
2017
2268
  gl_##_func_##Pointer(obj, arg1, arg2, arg3, arg4) \
@@ -2020,18 +2271,20 @@ VALUE obj, arg1, arg2, arg3, arg4; \
2020
2271
  GLint size; \
2021
2272
  GLenum type; \
2022
2273
  GLsizei stride; \
2274
+ DECL_GL_FUNC_PTR(GLvoid,gl##_func_##Pointer,(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)); \
2275
+ LOAD_GL_FUNC(gl##_func_##Pointer, NULL); \
2023
2276
  size = (GLint)NUM2INT(arg1); \
2024
2277
  type = (GLenum)NUM2INT(arg2); \
2025
2278
  stride = (GLsizei)NUM2UINT(arg3); \
2026
- if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) { \
2027
- g_##_func_##_ptr = arg4; \
2028
- gl##_func_##Pointer(size, type, stride, (const GLvoid*)NUM2SIZET(arg4)); \
2279
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) { \
2280
+ SET_GLIMPL_VARIABLE(_func_##_ptr, arg4); \
2281
+ fptr_gl##_func_##Pointer(size, type, stride, (const GLvoid*)NUM2SIZET(arg4)); \
2029
2282
  } else { \
2030
2283
  VALUE data; \
2031
2284
  data = pack_array_or_pass_string(type,arg4); \
2032
2285
  rb_str_freeze(data); \
2033
- g_##_func_##_ptr = data; \
2034
- gl##_func_##Pointer(size, type, stride, (const GLvoid*)RSTRING_PTR(data)); \
2286
+ SET_GLIMPL_VARIABLE(_func_##_ptr, data); \
2287
+ fptr_gl##_func_##Pointer(size, type, stride, (const GLvoid*)RSTRING_PTR(data)); \
2035
2288
  } \
2036
2289
  CHECK_GLERROR_FROM("gl" #_func_ "Pointer"); \
2037
2290
  return Qnil; \
@@ -2050,15 +2303,18 @@ VALUE obj,arg1,arg2,arg3,arg4;
2050
2303
  GLenum mode;
2051
2304
  GLsizei count;
2052
2305
  GLenum type;
2306
+ DECL_GL_FUNC_PTR(void,glDrawElements,(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices));
2307
+
2308
+ LOAD_GL_FUNC(glDrawElements, NULL);
2053
2309
  mode = (GLenum)NUM2INT(arg1);
2054
2310
  count = (GLsizei)NUM2UINT(arg2);
2055
2311
  type = (GLenum)NUM2INT(arg3);
2056
- if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
2057
- glDrawElements(mode, count, type, (const GLvoid*)NUM2SIZET(arg4));
2312
+ if (CHECK_BUFFER_BINDING(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
2313
+ fptr_glDrawElements(mode, count, type, (const GLvoid*)NUM2SIZET(arg4));
2058
2314
  } else {
2059
2315
  VALUE data;
2060
2316
  data = pack_array_or_pass_string(type,arg4);
2061
- glDrawElements(mode, count, type, (const GLvoid*)RSTRING_PTR(data));
2317
+ fptr_glDrawElements(mode, count, type, (const GLvoid*)RSTRING_PTR(data));
2062
2318
  }
2063
2319
  CHECK_GLERROR_FROM("glDrawElements");
2064
2320
  return Qnil;
@@ -2069,16 +2325,19 @@ gl_EdgeFlagPointer(obj,arg1,arg2)
2069
2325
  VALUE obj,arg1,arg2;
2070
2326
  {
2071
2327
  GLsizei stride;
2328
+ DECL_GL_FUNC_PTR(void,glEdgeFlagPointer,(GLsizei stride, const GLvoid *ptr));
2329
+
2330
+ LOAD_GL_FUNC(glEdgeFlagPointer, NULL);
2072
2331
  stride = (GLsizei)NUM2UINT(arg1);
2073
- if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
2074
- g_EdgeFlag_ptr = arg2;
2075
- glEdgeFlagPointer(stride, (const GLvoid*) NUM2SIZET(arg2));
2332
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
2333
+ SET_GLIMPL_VARIABLE(EdgeFlag_ptr, arg2);
2334
+ fptr_glEdgeFlagPointer(stride, (const GLvoid*) NUM2SIZET(arg2));
2076
2335
  } else {
2077
2336
  VALUE data;
2078
2337
  data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg2);
2079
2338
  rb_str_freeze(data);
2080
- g_EdgeFlag_ptr = data;
2081
- glEdgeFlagPointer(stride, (const GLvoid*)RSTRING_PTR(data));
2339
+ SET_GLIMPL_VARIABLE(EdgeFlag_ptr, data);
2340
+ fptr_glEdgeFlagPointer(stride, (const GLvoid*)RSTRING_PTR(data));
2082
2341
  }
2083
2342
  CHECK_GLERROR_FROM("glEdgeFlagPointer");
2084
2343
  return Qnil;
@@ -2089,28 +2348,29 @@ gl_GetPointerv(obj,arg1)
2089
2348
  VALUE obj,arg1;
2090
2349
  {
2091
2350
  GLenum pname;
2351
+
2092
2352
  pname = (GLenum)NUM2INT(arg1);
2093
2353
  switch (pname) {
2094
2354
  case GL_VERTEX_ARRAY_POINTER:
2095
- return g_Vertex_ptr;
2355
+ return GET_GLIMPL_VARIABLE(Vertex_ptr);
2096
2356
  case GL_NORMAL_ARRAY_POINTER:
2097
- return g_Normal_ptr;
2357
+ return GET_GLIMPL_VARIABLE(Normal_ptr);
2098
2358
  case GL_COLOR_ARRAY_POINTER:
2099
- return g_Color_ptr;
2359
+ return GET_GLIMPL_VARIABLE(Color_ptr);
2100
2360
  case GL_INDEX_ARRAY_POINTER:
2101
- return g_Index_ptr;
2361
+ return GET_GLIMPL_VARIABLE(Index_ptr);
2102
2362
  case GL_TEXTURE_COORD_ARRAY_POINTER:
2103
- return g_TexCoord_ptr;
2363
+ return GET_GLIMPL_VARIABLE(TexCoord_ptr);
2104
2364
  case GL_EDGE_FLAG_ARRAY_POINTER:
2105
- return g_EdgeFlag_ptr;
2365
+ return GET_GLIMPL_VARIABLE(EdgeFlag_ptr);
2106
2366
  case GL_FOG_COORD_ARRAY_POINTER:
2107
- return g_FogCoord_ptr;
2367
+ return GET_GLIMPL_VARIABLE(FogCoord_ptr);
2108
2368
  case GL_SECONDARY_COLOR_ARRAY_POINTER:
2109
- return g_SecondaryColor_ptr;
2369
+ return GET_GLIMPL_VARIABLE(SecondaryColor_ptr);
2110
2370
  case GL_FEEDBACK_BUFFER_POINTER:
2111
- return g_current_feed_buffer;
2371
+ return GET_GLIMPL_VARIABLE(current_feed_buffer);
2112
2372
  case GL_SELECTION_BUFFER_POINTER:
2113
- return g_current_sel_buffer;
2373
+ return GET_GLIMPL_VARIABLE(current_sel_buffer);
2114
2374
  default:
2115
2375
  rb_raise(rb_eArgError, "Invalid pname %d",pname);
2116
2376
  break; /* not reached */
@@ -2124,16 +2384,19 @@ VALUE obj,arg1,arg2,arg3;
2124
2384
  {
2125
2385
  GLenum type;
2126
2386
  GLsizei stride;
2387
+ DECL_GL_FUNC_PTR(void,glIndexPointer,(GLenum type, GLsizei stride, const GLvoid *ptr));
2388
+
2389
+ LOAD_GL_FUNC(glIndexPointer, NULL);
2127
2390
  type = (GLenum)NUM2INT(arg1);
2128
2391
  stride = (GLsizei)NUM2UINT(arg2);
2129
- if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
2130
- g_Index_ptr = arg3;
2131
- glIndexPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
2392
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
2393
+ SET_GLIMPL_VARIABLE(Index_ptr, arg3);
2394
+ fptr_glIndexPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
2132
2395
  } else {
2133
2396
  VALUE data;
2134
2397
  data = pack_array_or_pass_string(type,arg3);
2135
- g_Index_ptr = data;
2136
- glIndexPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
2398
+ SET_GLIMPL_VARIABLE(Index_ptr, data);
2399
+ fptr_glIndexPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
2137
2400
  }
2138
2401
  CHECK_GLERROR_FROM("glIndexPointer");
2139
2402
  return Qnil;
@@ -2146,12 +2409,15 @@ VALUE obj,arg1,arg2,arg3;
2146
2409
  GLenum format;
2147
2410
  GLsizei stride;
2148
2411
  VALUE data;
2412
+ DECL_GL_FUNC_PTR(void,glInterleavedArrays,(GLenum format, GLsizei stride, const GLvoid *pointer));
2413
+
2414
+ LOAD_GL_FUNC(glInterleavedArrays, NULL);
2149
2415
  format = (GLenum)NUM2INT(arg1);
2150
2416
  stride = (GLsizei)NUM2UINT(arg2);
2151
2417
  /* FIXME: add support for GL_C4UB_V2F,GL_C4UB_V3F, GL_T2F_C4UB_V3 */
2152
2418
  data = pack_array_or_pass_string(GL_FLOAT,arg3);
2153
2419
  rb_str_freeze(data);
2154
- glInterleavedArrays(format, stride, (const GLvoid*)RSTRING_PTR(data));
2420
+ fptr_glInterleavedArrays(format, stride, (const GLvoid*)RSTRING_PTR(data));
2155
2421
  CHECK_GLERROR_FROM("glInterleavedArrays");
2156
2422
  return Qnil;
2157
2423
  }
@@ -2162,17 +2428,20 @@ VALUE obj,arg1,arg2,arg3;
2162
2428
  {
2163
2429
  GLenum type;
2164
2430
  GLsizei stride;
2431
+ DECL_GL_FUNC_PTR(void,glNormalPointer,(GLenum type, GLsizei stride, const GLvoid *ptr));
2432
+
2433
+ LOAD_GL_FUNC(glNormalPointer, NULL);
2165
2434
  type = (GLenum)NUM2INT(arg1);
2166
2435
  stride = (GLsizei)NUM2UINT(arg2);
2167
- if (CheckBufferBinding(GL_ARRAY_BUFFER_BINDING)) {
2168
- g_Normal_ptr = arg3;
2169
- glNormalPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
2436
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
2437
+ SET_GLIMPL_VARIABLE(Normal_ptr, arg3);
2438
+ fptr_glNormalPointer(type, stride, (const GLvoid*)NUM2SIZET(arg3));
2170
2439
  } else {
2171
2440
  VALUE data;
2172
2441
  data = pack_array_or_pass_string(type,arg3);
2173
2442
  rb_str_freeze(data);
2174
- g_Normal_ptr = data;
2175
- glNormalPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
2443
+ SET_GLIMPL_VARIABLE(Normal_ptr, data);
2444
+ fptr_glNormalPointer(type, stride, (const GLvoid*)RSTRING_PTR(data));
2176
2445
  }
2177
2446
  CHECK_GLERROR_FROM("glNormalPointer");
2178
2447
  return Qnil;
@@ -2190,6 +2459,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
2190
2459
  GLenum format;
2191
2460
  GLenum type;
2192
2461
  VALUE data;
2462
+ DECL_GL_FUNC_PTR(void,glTexSubImage1D,(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels));
2463
+
2464
+ LOAD_GL_FUNC(glTexSubImage1D, NULL);
2193
2465
  target = (GLenum)NUM2INT(arg1);
2194
2466
  level = (GLint)NUM2INT(arg2);
2195
2467
  xoffset = (GLint)NUM2INT(arg3);
@@ -2197,8 +2469,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
2197
2469
  format = (GLenum)NUM2INT(arg5);
2198
2470
  type = (GLenum)NUM2INT(arg6);
2199
2471
 
2200
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
2201
- glTexSubImage1D(target,level,xoffset,width,format,type,(GLvoid *)NUM2SIZET(arg7));
2472
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
2473
+ fptr_glTexSubImage1D(target,level,xoffset,width,format,type,(GLvoid *)NUM2SIZET(arg7));
2202
2474
  CHECK_GLERROR_FROM("glTexSubImage1D");
2203
2475
  return Qnil;
2204
2476
  }
@@ -2206,7 +2478,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
2206
2478
  data = pack_array_or_pass_string(type,arg7);
2207
2479
  CheckDataSize(type,format,width,data);
2208
2480
 
2209
- glTexSubImage1D(target,level,xoffset,width,format,type,RSTRING_PTR(data));
2481
+ fptr_glTexSubImage1D(target,level,xoffset,width,format,type,RSTRING_PTR(data));
2210
2482
  CHECK_GLERROR_FROM("glTexSubImage1D");
2211
2483
  return Qnil;
2212
2484
  }
@@ -2224,6 +2496,9 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
2224
2496
  GLenum format;
2225
2497
  GLenum type;
2226
2498
  VALUE data;
2499
+ DECL_GL_FUNC_PTR(void,glTexSubImage2D,(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels));
2500
+
2501
+ LOAD_GL_FUNC(glTexSubImage2D, NULL);
2227
2502
  target = (GLenum)NUM2INT(arg1);
2228
2503
  level = (GLint)NUM2INT(arg2);
2229
2504
  xoffset = (GLint)NUM2INT(arg3);
@@ -2233,8 +2508,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
2233
2508
  format = (GLenum)NUM2INT(arg7);
2234
2509
  type = (GLenum)NUM2INT(arg8);
2235
2510
 
2236
- if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
2237
- glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,(GLvoid *)NUM2SIZET(arg9));
2511
+ if (CHECK_BUFFER_BINDING(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
2512
+ fptr_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,(GLvoid *)NUM2SIZET(arg9));
2238
2513
  CHECK_GLERROR_FROM("glTexSubImage2D");
2239
2514
  return Qnil;
2240
2515
  }
@@ -2242,7 +2517,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
2242
2517
  data = pack_array_or_pass_string(type,arg9);
2243
2518
  CheckDataSize(type,format,width*height,data);
2244
2519
 
2245
- glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,RSTRING_PTR(data));
2520
+ fptr_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,RSTRING_PTR(data));
2246
2521
  CHECK_GLERROR_FROM("glTexSubImage2D");
2247
2522
  return Qnil;
2248
2523
  }
@@ -2258,12 +2533,15 @@ VALUE obj,arg1;
2258
2533
  VALUE retary;
2259
2534
  VALUE ary;
2260
2535
  int i;
2536
+ DECL_GL_FUNC_PTR(GLboolean,glAreTexturesResident,(GLsizei n, const GLuint *textures, GLboolean *residences));
2537
+
2538
+ LOAD_GL_FUNC(glAreTexturesResident, NULL);
2261
2539
  ary = rb_Array(arg1);
2262
2540
  size = (int)RARRAY_LENINT(ary);
2263
2541
  textures = ALLOC_N(GLuint,size);
2264
2542
  residences = ALLOC_N(GLboolean,size);
2265
2543
  ary2cuint(ary,textures,size);
2266
- r = glAreTexturesResident(size,textures,residences);
2544
+ r = fptr_glAreTexturesResident(size,textures,residences);
2267
2545
  retary = rb_ary_new2(size);
2268
2546
  if (r==GL_TRUE) { /* all are resident */
2269
2547
  for(i=0;i<size;i++)
@@ -2288,6 +2566,9 @@ VALUE obj,arg1,arg2;
2288
2566
  GLuint *textures;
2289
2567
  GLclampf *priorities;
2290
2568
  GLsizei size;
2569
+ DECL_GL_FUNC_PTR(void,glPrioritizeTextures,(GLsizei n, const GLuint *textures, const GLclampf *priorities));
2570
+
2571
+ LOAD_GL_FUNC(glPrioritizeTextures, NULL);
2291
2572
  Check_Type(arg1,T_ARRAY);
2292
2573
  Check_Type(arg2,T_ARRAY);
2293
2574
  if ((size = (GLsizei)RARRAY_LENINT(arg1)) != (GLsizei)RARRAY_LENINT(arg2))
@@ -2296,7 +2577,7 @@ VALUE obj,arg1,arg2;
2296
2577
  priorities = ALLOC_N(GLclampf,size);
2297
2578
  ary2cuint(arg1,textures,size);
2298
2579
  ary2cflt(arg2,priorities,size);
2299
- glPrioritizeTextures(size,textures,priorities);
2580
+ fptr_glPrioritizeTextures(size,textures,priorities);
2300
2581
  xfree(textures);
2301
2582
  xfree(priorities);
2302
2583
  CHECK_GLERROR_FROM("glPrioritizeTextures");
@@ -2308,9 +2589,12 @@ gl_Indexubv(obj,arg1)
2308
2589
  VALUE obj,arg1;
2309
2590
  {
2310
2591
  GLubyte c[1] = {0};
2592
+ DECL_GL_FUNC_PTR(void,glIndexubv,(const GLubyte *c));
2593
+
2594
+ LOAD_GL_FUNC(glIndexubv, NULL);
2311
2595
  Check_Type(arg1,T_ARRAY);
2312
2596
  ary2cubyte(arg1,c,1);
2313
- glIndexubv(c);
2597
+ fptr_glIndexubv(c);
2314
2598
  CHECK_GLERROR_FROM("glIndexubv");
2315
2599
  return Qnil;
2316
2600
  }
@@ -2681,395 +2965,381 @@ VALUE obj,arg1,arg2,arg3;
2681
2965
  }
2682
2966
 
2683
2967
  /* init */
2684
- void gl_init_functions_1_0__1_1(VALUE module)
2968
+ void gl_init_functions_1_0__1_1(VALUE klass)
2685
2969
  {
2686
- g_FogCoord_ptr = 0; /* for use in gl-1.4.c */
2687
- g_SecondaryColor_ptr = 0; /* for use in gl-1.4.c */
2688
-
2689
2970
  /* OpenGL 1.0 functions */
2690
- rb_define_module_function(module, "glNewList", gl_NewList, 2);
2691
- rb_define_module_function(module, "glEndList", gl_EndList, 0);
2692
- rb_define_module_function(module, "glCallList", gl_CallList, 1);
2693
- rb_define_module_function(module, "glCallLists", gl_CallLists, 2);
2694
- rb_define_module_function(module, "glDeleteLists", gl_DeleteLists, 2);
2695
- rb_define_module_function(module, "glGenLists", gl_GenLists, 1);
2696
- rb_define_module_function(module, "glListBase", gl_ListBase, 1);
2697
- rb_define_module_function(module, "glBegin", gl_Begin, 1);
2698
- rb_define_module_function(module, "glBitmap", gl_Bitmap, 7);
2699
- rb_define_module_function(module, "glColor3b", gl_Color3b, 3);
2700
- rb_define_module_function(module, "glColor3d", gl_Color3d, 3);
2701
- rb_define_module_function(module, "glColor3f", gl_Color3f, 3);
2702
- rb_define_module_function(module, "glColor3i", gl_Color3i, 3);
2703
- rb_define_module_function(module, "glColor3s", gl_Color3s, 3);
2704
- rb_define_module_function(module, "glColor3ub", gl_Color3ub, 3);
2705
- rb_define_module_function(module, "glColor3ui", gl_Color3ui, 3);
2706
- rb_define_module_function(module, "glColor3us", gl_Color3us, 3);
2707
- rb_define_module_function(module, "glColor4b", gl_Color4b, 4);
2708
- rb_define_module_function(module, "glColor4d", gl_Color4d, 4);
2709
- rb_define_module_function(module, "glColor4f", gl_Color4f, 4);
2710
- rb_define_module_function(module, "glColor4i", gl_Color4i, 4);
2711
- rb_define_module_function(module, "glColor4s", gl_Color4s, 4);
2712
- rb_define_module_function(module, "glColor4ub", gl_Color4ub, 4);
2713
- rb_define_module_function(module, "glColor4ui", gl_Color4ui, 4);
2714
- rb_define_module_function(module, "glColor4us", gl_Color4us, 4);
2715
- rb_define_module_function(module, "glEdgeFlag", gl_EdgeFlag, 1);
2716
- rb_define_module_function(module, "glEdgeFlagv", gl_EdgeFlagv, 1);
2717
- rb_define_module_function(module, "glEnd", gl_End, 0);
2718
- rb_define_module_function(module, "glIndexd", gl_Indexd, 1);
2719
- rb_define_module_function(module, "glIndexdv", gl_Indexdv, 1);
2720
- rb_define_module_function(module, "glIndexf", gl_Indexf, 1);
2721
- rb_define_module_function(module, "glIndexfv", gl_Indexfv, 1);
2722
- rb_define_module_function(module, "glIndexi", gl_Indexi, 1);
2723
- rb_define_module_function(module, "glIndexiv", gl_Indexiv, 1);
2724
- rb_define_module_function(module, "glIndexs", gl_Indexs, 1);
2725
- rb_define_module_function(module, "glIndexsv", gl_Indexsv, 1);
2726
- rb_define_module_function(module, "glNormal3b", gl_Normal3b, 3);
2727
- rb_define_module_function(module, "glNormal3d", gl_Normal3d, 3);
2728
- rb_define_module_function(module, "glNormal3f", gl_Normal3f, 3);
2729
- rb_define_module_function(module, "glNormal3i", gl_Normal3i, 3);
2730
- rb_define_module_function(module, "glNormal3s", gl_Normal3s, 3);
2731
- rb_define_module_function(module, "glRasterPos2d", gl_RasterPos2d, 2);
2732
- rb_define_module_function(module, "glRasterPos2f", gl_RasterPos2f, 2);
2733
- rb_define_module_function(module, "glRasterPos2i", gl_RasterPos2i, 2);
2734
- rb_define_module_function(module, "glRasterPos2s", gl_RasterPos2s, 2);
2735
- rb_define_module_function(module, "glRasterPos3d", gl_RasterPos3d, 3);
2736
- rb_define_module_function(module, "glRasterPos3f", gl_RasterPos3f, 3);
2737
- rb_define_module_function(module, "glRasterPos3i", gl_RasterPos3i, 3);
2738
- rb_define_module_function(module, "glRasterPos3s", gl_RasterPos3s, 3);
2739
- rb_define_module_function(module, "glRasterPos4d", gl_RasterPos4d, 4);
2740
- rb_define_module_function(module, "glRasterPos4f", gl_RasterPos4f, 4);
2741
- rb_define_module_function(module, "glRasterPos4i", gl_RasterPos4i, 4);
2742
- rb_define_module_function(module, "glRasterPos4s", gl_RasterPos4s, 4);
2743
- rb_define_module_function(module, "glRectd", gl_Rectd, 4);
2744
- rb_define_module_function(module, "glRectf", gl_Rectf, 4);
2745
- rb_define_module_function(module, "glRecti", gl_Recti, 4);
2746
- rb_define_module_function(module, "glRects", gl_Rects, 4);
2747
- rb_define_module_function(module, "glTexCoord1d", gl_TexCoord1d, 1);
2748
- rb_define_module_function(module, "glTexCoord1f", gl_TexCoord1f, 1);
2749
- rb_define_module_function(module, "glTexCoord1i", gl_TexCoord1i, 1);
2750
- rb_define_module_function(module, "glTexCoord1s", gl_TexCoord1s, 1);
2751
- rb_define_module_function(module, "glTexCoord2d", gl_TexCoord2d, 2);
2752
- rb_define_module_function(module, "glTexCoord2f", gl_TexCoord2f, 2);
2753
- rb_define_module_function(module, "glTexCoord2i", gl_TexCoord2i, 2);
2754
- rb_define_module_function(module, "glTexCoord2s", gl_TexCoord2s, 2);
2755
- rb_define_module_function(module, "glTexCoord3d", gl_TexCoord3d, 3);
2756
- rb_define_module_function(module, "glTexCoord3f", gl_TexCoord3f, 3);
2757
- rb_define_module_function(module, "glTexCoord3i", gl_TexCoord3i, 3);
2758
- rb_define_module_function(module, "glTexCoord3s", gl_TexCoord3s, 3);
2759
- rb_define_module_function(module, "glTexCoord4d", gl_TexCoord4d, 4);
2760
- rb_define_module_function(module, "glTexCoord4f", gl_TexCoord4f, 4);
2761
- rb_define_module_function(module, "glTexCoord4i", gl_TexCoord4i, 4);
2762
- rb_define_module_function(module, "glTexCoord4s", gl_TexCoord4s, 4);
2763
- rb_define_module_function(module, "glVertex2d", gl_Vertex2d, 2);
2764
- rb_define_module_function(module, "glVertex2f", gl_Vertex2f, 2);
2765
- rb_define_module_function(module, "glVertex2i", gl_Vertex2i, 2);
2766
- rb_define_module_function(module, "glVertex2s", gl_Vertex2s, 2);
2767
- rb_define_module_function(module, "glVertex3d", gl_Vertex3d, 3);
2768
- rb_define_module_function(module, "glVertex3f", gl_Vertex3f, 3);
2769
- rb_define_module_function(module, "glVertex3i", gl_Vertex3i, 3);
2770
- rb_define_module_function(module, "glVertex3s", gl_Vertex3s, 3);
2771
- rb_define_module_function(module, "glVertex4d", gl_Vertex4d, 4);
2772
- rb_define_module_function(module, "glVertex4f", gl_Vertex4f, 4);
2773
- rb_define_module_function(module, "glVertex4i", gl_Vertex4i, 4);
2774
- rb_define_module_function(module, "glVertex4s", gl_Vertex4s, 4);
2775
- rb_define_module_function(module, "glClipPlane", gl_ClipPlane, 2);
2776
- rb_define_module_function(module, "glColorMaterial", gl_ColorMaterial, 2);
2777
- rb_define_module_function(module, "glCullFace", gl_CullFace, 1);
2778
- rb_define_module_function(module, "glFogf", gl_Fogf, 2);
2779
- rb_define_module_function(module, "glFogfv", gl_Fogfv, 2);
2780
- rb_define_module_function(module, "glFogi", gl_Fogi, 2);
2781
- rb_define_module_function(module, "glFogiv", gl_Fogiv, 2);
2782
- rb_define_module_function(module, "glFrontFace", gl_FrontFace, 1);
2783
- rb_define_module_function(module, "glHint", gl_Hint, 2);
2784
- rb_define_module_function(module, "glLightf", gl_Lightf, 3);
2785
- rb_define_module_function(module, "glLightfv", gl_Lightfv, 3);
2786
- rb_define_module_function(module, "glLighti", gl_Lighti, 3);
2787
- rb_define_module_function(module, "glLightiv", gl_Lightiv, 3);
2788
- rb_define_module_function(module, "glLightModelf", gl_LightModelf, 2);
2789
- rb_define_module_function(module, "glLightModelfv", gl_LightModelfv, 2);
2790
- rb_define_module_function(module, "glLightModeli", gl_LightModeli, 2);
2791
- rb_define_module_function(module, "glLightModeliv", gl_LightModeliv, 2);
2792
- rb_define_module_function(module, "glLineStipple", gl_LineStipple, 2);
2793
- rb_define_module_function(module, "glLineWidth", gl_LineWidth, 1);
2794
- rb_define_module_function(module, "glMaterialf", gl_Materialf, 3);
2795
- rb_define_module_function(module, "glMaterialfv", gl_Materialfv, 3);
2796
- rb_define_module_function(module, "glMateriali", gl_Materiali, 3);
2797
- rb_define_module_function(module, "glMaterialiv", gl_Materialiv, 3);
2798
- rb_define_module_function(module, "glPointSize", gl_PointSize, 1);
2799
- rb_define_module_function(module, "glPolygonMode", gl_PolygonMode, 2);
2800
- rb_define_module_function(module, "glPolygonStipple", gl_PolygonStipple, 1);
2801
- rb_define_module_function(module, "glScissor", gl_Scissor, 4);
2802
- rb_define_module_function(module, "glShadeModel", gl_ShadeModel, 1);
2803
- rb_define_module_function(module, "glTexParameterf", gl_TexParameterf, 3);
2804
- rb_define_module_function(module, "glTexParameterfv", gl_TexParameterfv, 3);
2805
- rb_define_module_function(module, "glTexParameteri", gl_TexParameteri, 3);
2806
- rb_define_module_function(module, "glTexParameteriv", gl_TexParameteriv, 3);
2807
- rb_define_module_function(module, "glTexImage1D", gl_TexImage1D, 8);
2808
- rb_define_module_function(module, "glTexImage2D", gl_TexImage2D, 9);
2809
- rb_define_module_function(module, "glTexEnvf", gl_TexEnvf, 3);
2810
- rb_define_module_function(module, "glTexEnvfv", gl_TexEnvfv, 3);
2811
- rb_define_module_function(module, "glTexEnvi", gl_TexEnvi, 3);
2812
- rb_define_module_function(module, "glTexEnviv", gl_TexEnviv, 3);
2813
- rb_define_module_function(module, "glTexGend", gl_TexGend, 3);
2814
- rb_define_module_function(module, "glTexGendv", gl_TexGendv, 3);
2815
- rb_define_module_function(module, "glTexGenf", gl_TexGenf, 3);
2816
- rb_define_module_function(module, "glTexGenfv", gl_TexGenfv, 3);
2817
- rb_define_module_function(module, "glTexGeni", gl_TexGeni, 3);
2818
- rb_define_module_function(module, "glTexGeniv", gl_TexGeniv, 3);
2819
- rb_define_module_function(module, "glFeedbackBuffer", gl_FeedbackBuffer, 2);
2820
- rb_define_module_function(module, "glSelectBuffer", gl_SelectBuffer, 1);
2821
- rb_define_module_function(module, "glRenderMode", gl_RenderMode, 1);
2822
- rb_define_module_function(module, "glInitNames", gl_InitNames, 0);
2823
- rb_define_module_function(module, "glLoadName", gl_LoadName, 1);
2824
- rb_define_module_function(module, "glPassThrough", gl_PassThrough, 1);
2825
- rb_define_module_function(module, "glPopName", gl_PopName, 0);
2826
- rb_define_module_function(module, "glPushName", gl_PushName, 1);
2827
- rb_define_module_function(module, "glDrawBuffer", gl_DrawBuffer, 1);
2828
- rb_define_module_function(module, "glClear", gl_Clear, 1);
2829
- rb_define_module_function(module, "glClearAccum", gl_ClearAccum, 4);
2830
- rb_define_module_function(module, "glClearIndex", gl_ClearIndex, 1);
2831
- rb_define_module_function(module, "glClearColor", gl_ClearColor, 4);
2832
- rb_define_module_function(module, "glClearStencil", gl_ClearStencil, 1);
2833
- rb_define_module_function(module, "glClearDepth", gl_ClearDepth, 1);
2834
- rb_define_module_function(module, "glStencilMask", gl_StencilMask, 1);
2835
- rb_define_module_function(module, "glColorMask", gl_ColorMask, 4);
2836
- rb_define_module_function(module, "glDepthMask", gl_DepthMask, 1);
2837
- rb_define_module_function(module, "glIndexMask", gl_IndexMask, 1);
2838
- rb_define_module_function(module, "glAccum", gl_Accum, 2);
2839
- rb_define_module_function(module, "glDisable", gl_Disable, -1);
2840
- rb_define_module_function(module, "glEnable", gl_Enable, -1);
2841
- rb_define_module_function(module, "glFinish", gl_Finish, 0);
2842
- rb_define_module_function(module, "glFlush", gl_Flush, 0);
2843
- rb_define_module_function(module, "glPopAttrib", gl_PopAttrib, 0);
2844
- rb_define_module_function(module, "glPushAttrib", gl_PushAttrib, 1);
2845
- rb_define_module_function(module, "glMap1d", gl_Map1d, 6);
2846
- rb_define_module_function(module, "glMap1f", gl_Map1f, 6);
2847
- rb_define_module_function(module, "glMap2d", gl_Map2d, 10);
2848
- rb_define_module_function(module, "glMap2f", gl_Map2f, 10);
2849
- rb_define_module_function(module, "glMapGrid1d", gl_MapGrid1d, 3);
2850
- rb_define_module_function(module, "glMapGrid1f", gl_MapGrid1f, 3);
2851
- rb_define_module_function(module, "glMapGrid2d", gl_MapGrid2d, 6);
2852
- rb_define_module_function(module, "glMapGrid2f", gl_MapGrid2f, 6);
2853
- rb_define_module_function(module, "glEvalCoord1d", gl_EvalCoord1d, 1);
2854
- rb_define_module_function(module, "glEvalCoord1dv", gl_EvalCoord1dv, 1);
2855
- rb_define_module_function(module, "glEvalCoord1f", gl_EvalCoord1f, 1);
2856
- rb_define_module_function(module, "glEvalCoord1fv", gl_EvalCoord1fv, 1);
2857
- rb_define_module_function(module, "glEvalCoord2d", gl_EvalCoord2d, 2);
2858
- rb_define_module_function(module, "glEvalCoord2dv", gl_EvalCoord2dv, 1);
2859
- rb_define_module_function(module, "glEvalCoord2f", gl_EvalCoord2f, 2);
2860
- rb_define_module_function(module, "glEvalCoord2fv", gl_EvalCoord2fv, 1);
2861
- rb_define_module_function(module, "glEvalMesh1", gl_EvalMesh1, 3);
2862
- rb_define_module_function(module, "glEvalPoint1", gl_EvalPoint1, 1);
2863
- rb_define_module_function(module, "glEvalMesh2", gl_EvalMesh2, 5);
2864
- rb_define_module_function(module, "glEvalPoint2", gl_EvalPoint2, 2);
2865
- rb_define_module_function(module, "glAlphaFunc", gl_AlphaFunc, 2);
2866
- rb_define_module_function(module, "glBlendFunc", gl_BlendFunc, 2);
2867
- rb_define_module_function(module, "glLogicOp", gl_LogicOp, 1);
2868
- rb_define_module_function(module, "glStencilFunc", gl_StencilFunc, 3);
2869
- rb_define_module_function(module, "glStencilOp", gl_StencilOp, 3);
2870
- rb_define_module_function(module, "glDepthFunc", gl_DepthFunc, 1);
2871
- rb_define_module_function(module, "glPixelZoom", gl_PixelZoom, 2);
2872
- rb_define_module_function(module, "glPixelTransferf", gl_PixelTransferf, 2);
2873
- rb_define_module_function(module, "glPixelTransferi", gl_PixelTransferi, 2);
2874
- rb_define_module_function(module, "glPixelStoref", gl_PixelStoref, 2);
2875
- rb_define_module_function(module, "glPixelStorei", gl_PixelStorei, 2);
2876
- rb_define_module_function(module, "glPixelMapfv", gl_PixelMapfv, -1);
2877
- rb_define_module_function(module, "glPixelMapuiv", gl_PixelMapuiv, -1);
2878
- rb_define_module_function(module, "glPixelMapusv", gl_PixelMapusv, -1);
2879
- rb_define_module_function(module, "glReadBuffer", gl_ReadBuffer, 1);
2880
- rb_define_module_function(module, "glCopyPixels", gl_CopyPixels, 5);
2881
- rb_define_module_function(module, "glReadPixels", gl_ReadPixels, -1);
2882
- rb_define_module_function(module, "glDrawPixels", gl_DrawPixels, 5);
2883
- rb_define_module_function(module, "glGetBooleanv", gl_GetBooleanv, 1);
2884
- rb_define_module_function(module, "glGetClipPlane", gl_GetClipPlane, 1);
2885
- rb_define_module_function(module, "glGetDoublev", gl_GetDoublev, 1);
2886
- rb_define_module_function(module, "glGetError", gl_GetError, 0);
2887
- rb_define_module_function(module, "glGetFloatv", gl_GetFloatv, 1);
2888
- rb_define_module_function(module, "glGetIntegerv", gl_GetIntegerv, 1);
2889
- rb_define_module_function(module, "glGetLightfv", gl_GetLightfv, 2);
2890
- rb_define_module_function(module, "glGetLightiv", gl_GetLightiv, 2);
2891
- rb_define_module_function(module, "glGetMapdv", gl_GetMapdv, 2);
2892
- rb_define_module_function(module, "glGetMapfv", gl_GetMapfv, 2);
2893
- rb_define_module_function(module, "glGetMapiv", gl_GetMapiv, 2);
2894
- rb_define_module_function(module, "glGetMaterialfv", gl_GetMaterialfv, 2);
2895
- rb_define_module_function(module, "glGetMaterialiv", gl_GetMaterialiv, 2);
2896
- rb_define_module_function(module, "glGetPixelMapfv", gl_GetPixelMapfv, -1);
2897
- rb_define_module_function(module, "glGetPixelMapuiv", gl_GetPixelMapuiv, -1);
2898
- rb_define_module_function(module, "glGetPixelMapusv", gl_GetPixelMapusv, -1);
2899
- rb_define_module_function(module, "glGetPolygonStipple", gl_GetPolygonStipple, -1);
2900
- rb_define_module_function(module, "glGetString", gl_GetString, 1);
2901
- rb_define_module_function(module, "glGetTexEnvfv", gl_GetTexEnvfv, 2);
2902
- rb_define_module_function(module, "glGetTexEnviv", gl_GetTexEnviv, 2);
2903
- rb_define_module_function(module, "glGetTexGendv", gl_GetTexGendv, 2);
2904
- rb_define_module_function(module, "glGetTexGenfv", gl_GetTexGenfv, 2);
2905
- rb_define_module_function(module, "glGetTexGeniv", gl_GetTexGeniv, 2);
2906
- rb_define_module_function(module, "glGetTexImage", gl_GetTexImage, -1);
2907
- rb_define_module_function(module, "glGetTexParameterfv", gl_GetTexParameterfv, 2);
2908
- rb_define_module_function(module, "glGetTexParameteriv", gl_GetTexParameteriv, 2);
2909
- rb_define_module_function(module, "glGetTexLevelParameterfv", gl_GetTexLevelParameterfv, 3);
2910
- rb_define_module_function(module, "glGetTexLevelParameteriv", gl_GetTexLevelParameteriv, 3);
2911
- rb_define_module_function(module, "glIsEnabled", gl_IsEnabled, 1);
2912
- rb_define_module_function(module, "glIsList", gl_IsList, 1);
2913
- rb_define_module_function(module, "glDepthRange", gl_DepthRange, 2);
2914
- rb_define_module_function(module, "glFrustum", gl_Frustum, 6);
2915
- rb_define_module_function(module, "glLoadIdentity", gl_LoadIdentity, 0);
2916
- rb_define_module_function(module, "glLoadMatrixf", gl_LoadMatrixf, 1);
2917
- rb_define_module_function(module, "glLoadMatrixd", gl_LoadMatrixd, 1);
2918
- rb_define_module_function(module, "glMatrixMode", gl_MatrixMode, 1);
2919
- rb_define_module_function(module, "glMultMatrixf", gl_MultMatrixf, 1);
2920
- rb_define_module_function(module, "glMultMatrixd", gl_MultMatrixd, 1);
2921
- rb_define_module_function(module, "glOrtho", gl_Ortho, 6);
2922
- rb_define_module_function(module, "glPopMatrix", gl_PopMatrix, 0);
2923
- rb_define_module_function(module, "glPushMatrix", gl_PushMatrix, 0);
2924
- rb_define_module_function(module, "glRotated", gl_Rotated, 4);
2925
- rb_define_module_function(module, "glRotatef", gl_Rotatef, 4);
2926
- rb_define_module_function(module, "glScaled", gl_Scaled, 3);
2927
- rb_define_module_function(module, "glScalef", gl_Scalef, 3);
2928
- rb_define_module_function(module, "glTranslated", gl_Translated, 3);
2929
- rb_define_module_function(module, "glTranslatef", gl_Translatef, 3);
2930
- rb_define_module_function(module, "glViewport", gl_Viewport, 4);
2971
+ rb_define_method(klass, "glNewList", gl_NewList, 2);
2972
+ rb_define_method(klass, "glEndList", gl_EndList, 0);
2973
+ rb_define_method(klass, "glCallList", gl_CallList, 1);
2974
+ rb_define_method(klass, "glCallLists", gl_CallLists, 2);
2975
+ rb_define_method(klass, "glDeleteLists", gl_DeleteLists, 2);
2976
+ rb_define_method(klass, "glGenLists", gl_GenLists, 1);
2977
+ rb_define_method(klass, "glListBase", gl_ListBase, 1);
2978
+ rb_define_method(klass, "glBegin", gl_Begin, 1);
2979
+ rb_define_method(klass, "glBitmap", gl_Bitmap, 7);
2980
+ rb_define_method(klass, "glColor3b", gl_Color3b, 3);
2981
+ rb_define_method(klass, "glColor3d", gl_Color3d, 3);
2982
+ rb_define_method(klass, "glColor3f", gl_Color3f, 3);
2983
+ rb_define_method(klass, "glColor3i", gl_Color3i, 3);
2984
+ rb_define_method(klass, "glColor3s", gl_Color3s, 3);
2985
+ rb_define_method(klass, "glColor3ub", gl_Color3ub, 3);
2986
+ rb_define_method(klass, "glColor3ui", gl_Color3ui, 3);
2987
+ rb_define_method(klass, "glColor3us", gl_Color3us, 3);
2988
+ rb_define_method(klass, "glColor4b", gl_Color4b, 4);
2989
+ rb_define_method(klass, "glColor4d", gl_Color4d, 4);
2990
+ rb_define_method(klass, "glColor4f", gl_Color4f, 4);
2991
+ rb_define_method(klass, "glColor4i", gl_Color4i, 4);
2992
+ rb_define_method(klass, "glColor4s", gl_Color4s, 4);
2993
+ rb_define_method(klass, "glColor4ub", gl_Color4ub, 4);
2994
+ rb_define_method(klass, "glColor4ui", gl_Color4ui, 4);
2995
+ rb_define_method(klass, "glColor4us", gl_Color4us, 4);
2996
+ rb_define_method(klass, "glEdgeFlag", gl_EdgeFlag, 1);
2997
+ rb_define_method(klass, "glEdgeFlagv", gl_EdgeFlagv, 1);
2998
+ rb_define_method(klass, "glEnd", gl_End, 0);
2999
+ rb_define_method(klass, "glIndexd", gl_Indexd, 1);
3000
+ rb_define_method(klass, "glIndexdv", gl_Indexdv, 1);
3001
+ rb_define_method(klass, "glIndexf", gl_Indexf, 1);
3002
+ rb_define_method(klass, "glIndexfv", gl_Indexfv, 1);
3003
+ rb_define_method(klass, "glIndexi", gl_Indexi, 1);
3004
+ rb_define_method(klass, "glIndexiv", gl_Indexiv, 1);
3005
+ rb_define_method(klass, "glIndexs", gl_Indexs, 1);
3006
+ rb_define_method(klass, "glIndexsv", gl_Indexsv, 1);
3007
+ rb_define_method(klass, "glNormal3b", gl_Normal3b, 3);
3008
+ rb_define_method(klass, "glNormal3d", gl_Normal3d, 3);
3009
+ rb_define_method(klass, "glNormal3f", gl_Normal3f, 3);
3010
+ rb_define_method(klass, "glNormal3i", gl_Normal3i, 3);
3011
+ rb_define_method(klass, "glNormal3s", gl_Normal3s, 3);
3012
+ rb_define_method(klass, "glRasterPos2d", gl_RasterPos2d, 2);
3013
+ rb_define_method(klass, "glRasterPos2f", gl_RasterPos2f, 2);
3014
+ rb_define_method(klass, "glRasterPos2i", gl_RasterPos2i, 2);
3015
+ rb_define_method(klass, "glRasterPos2s", gl_RasterPos2s, 2);
3016
+ rb_define_method(klass, "glRasterPos3d", gl_RasterPos3d, 3);
3017
+ rb_define_method(klass, "glRasterPos3f", gl_RasterPos3f, 3);
3018
+ rb_define_method(klass, "glRasterPos3i", gl_RasterPos3i, 3);
3019
+ rb_define_method(klass, "glRasterPos3s", gl_RasterPos3s, 3);
3020
+ rb_define_method(klass, "glRasterPos4d", gl_RasterPos4d, 4);
3021
+ rb_define_method(klass, "glRasterPos4f", gl_RasterPos4f, 4);
3022
+ rb_define_method(klass, "glRasterPos4i", gl_RasterPos4i, 4);
3023
+ rb_define_method(klass, "glRasterPos4s", gl_RasterPos4s, 4);
3024
+ rb_define_method(klass, "glRectd", gl_Rectd, 4);
3025
+ rb_define_method(klass, "glRectf", gl_Rectf, 4);
3026
+ rb_define_method(klass, "glRecti", gl_Recti, 4);
3027
+ rb_define_method(klass, "glRects", gl_Rects, 4);
3028
+ rb_define_method(klass, "glTexCoord1d", gl_TexCoord1d, 1);
3029
+ rb_define_method(klass, "glTexCoord1f", gl_TexCoord1f, 1);
3030
+ rb_define_method(klass, "glTexCoord1i", gl_TexCoord1i, 1);
3031
+ rb_define_method(klass, "glTexCoord1s", gl_TexCoord1s, 1);
3032
+ rb_define_method(klass, "glTexCoord2d", gl_TexCoord2d, 2);
3033
+ rb_define_method(klass, "glTexCoord2f", gl_TexCoord2f, 2);
3034
+ rb_define_method(klass, "glTexCoord2i", gl_TexCoord2i, 2);
3035
+ rb_define_method(klass, "glTexCoord2s", gl_TexCoord2s, 2);
3036
+ rb_define_method(klass, "glTexCoord3d", gl_TexCoord3d, 3);
3037
+ rb_define_method(klass, "glTexCoord3f", gl_TexCoord3f, 3);
3038
+ rb_define_method(klass, "glTexCoord3i", gl_TexCoord3i, 3);
3039
+ rb_define_method(klass, "glTexCoord3s", gl_TexCoord3s, 3);
3040
+ rb_define_method(klass, "glTexCoord4d", gl_TexCoord4d, 4);
3041
+ rb_define_method(klass, "glTexCoord4f", gl_TexCoord4f, 4);
3042
+ rb_define_method(klass, "glTexCoord4i", gl_TexCoord4i, 4);
3043
+ rb_define_method(klass, "glTexCoord4s", gl_TexCoord4s, 4);
3044
+ rb_define_method(klass, "glVertex2d", gl_Vertex2d, 2);
3045
+ rb_define_method(klass, "glVertex2f", gl_Vertex2f, 2);
3046
+ rb_define_method(klass, "glVertex2i", gl_Vertex2i, 2);
3047
+ rb_define_method(klass, "glVertex2s", gl_Vertex2s, 2);
3048
+ rb_define_method(klass, "glVertex3d", gl_Vertex3d, 3);
3049
+ rb_define_method(klass, "glVertex3f", gl_Vertex3f, 3);
3050
+ rb_define_method(klass, "glVertex3i", gl_Vertex3i, 3);
3051
+ rb_define_method(klass, "glVertex3s", gl_Vertex3s, 3);
3052
+ rb_define_method(klass, "glVertex4d", gl_Vertex4d, 4);
3053
+ rb_define_method(klass, "glVertex4f", gl_Vertex4f, 4);
3054
+ rb_define_method(klass, "glVertex4i", gl_Vertex4i, 4);
3055
+ rb_define_method(klass, "glVertex4s", gl_Vertex4s, 4);
3056
+ rb_define_method(klass, "glClipPlane", gl_ClipPlane, 2);
3057
+ rb_define_method(klass, "glColorMaterial", gl_ColorMaterial, 2);
3058
+ rb_define_method(klass, "glCullFace", gl_CullFace, 1);
3059
+ rb_define_method(klass, "glFogf", gl_Fogf, 2);
3060
+ rb_define_method(klass, "glFogfv", gl_Fogfv, 2);
3061
+ rb_define_method(klass, "glFogi", gl_Fogi, 2);
3062
+ rb_define_method(klass, "glFogiv", gl_Fogiv, 2);
3063
+ rb_define_method(klass, "glFrontFace", gl_FrontFace, 1);
3064
+ rb_define_method(klass, "glHint", gl_Hint, 2);
3065
+ rb_define_method(klass, "glLightf", gl_Lightf, 3);
3066
+ rb_define_method(klass, "glLightfv", gl_Lightfv, 3);
3067
+ rb_define_method(klass, "glLighti", gl_Lighti, 3);
3068
+ rb_define_method(klass, "glLightiv", gl_Lightiv, 3);
3069
+ rb_define_method(klass, "glLightModelf", gl_LightModelf, 2);
3070
+ rb_define_method(klass, "glLightModelfv", gl_LightModelfv, 2);
3071
+ rb_define_method(klass, "glLightModeli", gl_LightModeli, 2);
3072
+ rb_define_method(klass, "glLightModeliv", gl_LightModeliv, 2);
3073
+ rb_define_method(klass, "glLineStipple", gl_LineStipple, 2);
3074
+ rb_define_method(klass, "glLineWidth", gl_LineWidth, 1);
3075
+ rb_define_method(klass, "glMaterialf", gl_Materialf, 3);
3076
+ rb_define_method(klass, "glMaterialfv", gl_Materialfv, 3);
3077
+ rb_define_method(klass, "glMateriali", gl_Materiali, 3);
3078
+ rb_define_method(klass, "glMaterialiv", gl_Materialiv, 3);
3079
+ rb_define_method(klass, "glPointSize", gl_PointSize, 1);
3080
+ rb_define_method(klass, "glPolygonMode", gl_PolygonMode, 2);
3081
+ rb_define_method(klass, "glPolygonStipple", gl_PolygonStipple, 1);
3082
+ rb_define_method(klass, "glScissor", gl_Scissor, 4);
3083
+ rb_define_method(klass, "glShadeModel", gl_ShadeModel, 1);
3084
+ rb_define_method(klass, "glTexParameterf", gl_TexParameterf, 3);
3085
+ rb_define_method(klass, "glTexParameterfv", gl_TexParameterfv, 3);
3086
+ rb_define_method(klass, "glTexParameteri", gl_TexParameteri, 3);
3087
+ rb_define_method(klass, "glTexParameteriv", gl_TexParameteriv, 3);
3088
+ rb_define_method(klass, "glTexImage1D", gl_TexImage1D, 8);
3089
+ rb_define_method(klass, "glTexImage2D", gl_TexImage2D, 9);
3090
+ rb_define_method(klass, "glTexEnvf", gl_TexEnvf, 3);
3091
+ rb_define_method(klass, "glTexEnvfv", gl_TexEnvfv, 3);
3092
+ rb_define_method(klass, "glTexEnvi", gl_TexEnvi, 3);
3093
+ rb_define_method(klass, "glTexEnviv", gl_TexEnviv, 3);
3094
+ rb_define_method(klass, "glTexGend", gl_TexGend, 3);
3095
+ rb_define_method(klass, "glTexGendv", gl_TexGendv, 3);
3096
+ rb_define_method(klass, "glTexGenf", gl_TexGenf, 3);
3097
+ rb_define_method(klass, "glTexGenfv", gl_TexGenfv, 3);
3098
+ rb_define_method(klass, "glTexGeni", gl_TexGeni, 3);
3099
+ rb_define_method(klass, "glTexGeniv", gl_TexGeniv, 3);
3100
+ rb_define_method(klass, "glFeedbackBuffer", gl_FeedbackBuffer, 2);
3101
+ rb_define_method(klass, "glSelectBuffer", gl_SelectBuffer, 1);
3102
+ rb_define_method(klass, "glRenderMode", gl_RenderMode, 1);
3103
+ rb_define_method(klass, "glInitNames", gl_InitNames, 0);
3104
+ rb_define_method(klass, "glLoadName", gl_LoadName, 1);
3105
+ rb_define_method(klass, "glPassThrough", gl_PassThrough, 1);
3106
+ rb_define_method(klass, "glPopName", gl_PopName, 0);
3107
+ rb_define_method(klass, "glPushName", gl_PushName, 1);
3108
+ rb_define_method(klass, "glDrawBuffer", gl_DrawBuffer, 1);
3109
+ rb_define_method(klass, "glClear", gl_Clear, 1);
3110
+ rb_define_method(klass, "glClearAccum", gl_ClearAccum, 4);
3111
+ rb_define_method(klass, "glClearIndex", gl_ClearIndex, 1);
3112
+ rb_define_method(klass, "glClearColor", gl_ClearColor, 4);
3113
+ rb_define_method(klass, "glClearStencil", gl_ClearStencil, 1);
3114
+ rb_define_method(klass, "glClearDepth", gl_ClearDepth, 1);
3115
+ rb_define_method(klass, "glStencilMask", gl_StencilMask, 1);
3116
+ rb_define_method(klass, "glColorMask", gl_ColorMask, 4);
3117
+ rb_define_method(klass, "glDepthMask", gl_DepthMask, 1);
3118
+ rb_define_method(klass, "glIndexMask", gl_IndexMask, 1);
3119
+ rb_define_method(klass, "glAccum", gl_Accum, 2);
3120
+ rb_define_method(klass, "glDisable", gl_Disable, -1);
3121
+ rb_define_method(klass, "glEnable", gl_Enable, -1);
3122
+ rb_define_method(klass, "glFinish", gl_Finish, 0);
3123
+ rb_define_method(klass, "glFlush", gl_Flush, 0);
3124
+ rb_define_method(klass, "glPopAttrib", gl_PopAttrib, 0);
3125
+ rb_define_method(klass, "glPushAttrib", gl_PushAttrib, 1);
3126
+ rb_define_method(klass, "glMap1d", gl_Map1d, 6);
3127
+ rb_define_method(klass, "glMap1f", gl_Map1f, 6);
3128
+ rb_define_method(klass, "glMap2d", gl_Map2d, 10);
3129
+ rb_define_method(klass, "glMap2f", gl_Map2f, 10);
3130
+ rb_define_method(klass, "glMapGrid1d", gl_MapGrid1d, 3);
3131
+ rb_define_method(klass, "glMapGrid1f", gl_MapGrid1f, 3);
3132
+ rb_define_method(klass, "glMapGrid2d", gl_MapGrid2d, 6);
3133
+ rb_define_method(klass, "glMapGrid2f", gl_MapGrid2f, 6);
3134
+ rb_define_method(klass, "glEvalCoord1d", gl_EvalCoord1d, 1);
3135
+ rb_define_method(klass, "glEvalCoord1dv", gl_EvalCoord1dv, 1);
3136
+ rb_define_method(klass, "glEvalCoord1f", gl_EvalCoord1f, 1);
3137
+ rb_define_method(klass, "glEvalCoord1fv", gl_EvalCoord1fv, 1);
3138
+ rb_define_method(klass, "glEvalCoord2d", gl_EvalCoord2d, 2);
3139
+ rb_define_method(klass, "glEvalCoord2dv", gl_EvalCoord2dv, 1);
3140
+ rb_define_method(klass, "glEvalCoord2f", gl_EvalCoord2f, 2);
3141
+ rb_define_method(klass, "glEvalCoord2fv", gl_EvalCoord2fv, 1);
3142
+ rb_define_method(klass, "glEvalMesh1", gl_EvalMesh1, 3);
3143
+ rb_define_method(klass, "glEvalPoint1", gl_EvalPoint1, 1);
3144
+ rb_define_method(klass, "glEvalMesh2", gl_EvalMesh2, 5);
3145
+ rb_define_method(klass, "glEvalPoint2", gl_EvalPoint2, 2);
3146
+ rb_define_method(klass, "glAlphaFunc", gl_AlphaFunc, 2);
3147
+ rb_define_method(klass, "glBlendFunc", gl_BlendFunc, 2);
3148
+ rb_define_method(klass, "glLogicOp", gl_LogicOp, 1);
3149
+ rb_define_method(klass, "glStencilFunc", gl_StencilFunc, 3);
3150
+ rb_define_method(klass, "glStencilOp", gl_StencilOp, 3);
3151
+ rb_define_method(klass, "glDepthFunc", gl_DepthFunc, 1);
3152
+ rb_define_method(klass, "glPixelZoom", gl_PixelZoom, 2);
3153
+ rb_define_method(klass, "glPixelTransferf", gl_PixelTransferf, 2);
3154
+ rb_define_method(klass, "glPixelTransferi", gl_PixelTransferi, 2);
3155
+ rb_define_method(klass, "glPixelStoref", gl_PixelStoref, 2);
3156
+ rb_define_method(klass, "glPixelStorei", gl_PixelStorei, 2);
3157
+ rb_define_method(klass, "glPixelMapfv", gl_PixelMapfv, -1);
3158
+ rb_define_method(klass, "glPixelMapuiv", gl_PixelMapuiv, -1);
3159
+ rb_define_method(klass, "glPixelMapusv", gl_PixelMapusv, -1);
3160
+ rb_define_method(klass, "glReadBuffer", gl_ReadBuffer, 1);
3161
+ rb_define_method(klass, "glCopyPixels", gl_CopyPixels, 5);
3162
+ rb_define_method(klass, "glReadPixels", gl_ReadPixels, -1);
3163
+ rb_define_method(klass, "glDrawPixels", gl_DrawPixels, 5);
3164
+ rb_define_method(klass, "glGetBooleanv", gl_GetBooleanv, 1);
3165
+ rb_define_method(klass, "glGetClipPlane", gl_GetClipPlane, 1);
3166
+ rb_define_method(klass, "glGetDoublev", gl_GetDoublev, 1);
3167
+ rb_define_method(klass, "glGetError", gl_GetError, 0);
3168
+ rb_define_method(klass, "glGetFloatv", gl_GetFloatv, 1);
3169
+ rb_define_method(klass, "glGetIntegerv", gl_GetIntegerv, 1);
3170
+ rb_define_method(klass, "glGetLightfv", gl_GetLightfv, 2);
3171
+ rb_define_method(klass, "glGetLightiv", gl_GetLightiv, 2);
3172
+ rb_define_method(klass, "glGetMapdv", gl_GetMapdv, 2);
3173
+ rb_define_method(klass, "glGetMapfv", gl_GetMapfv, 2);
3174
+ rb_define_method(klass, "glGetMapiv", gl_GetMapiv, 2);
3175
+ rb_define_method(klass, "glGetMaterialfv", gl_GetMaterialfv, 2);
3176
+ rb_define_method(klass, "glGetMaterialiv", gl_GetMaterialiv, 2);
3177
+ rb_define_method(klass, "glGetPixelMapfv", gl_GetPixelMapfv, -1);
3178
+ rb_define_method(klass, "glGetPixelMapuiv", gl_GetPixelMapuiv, -1);
3179
+ rb_define_method(klass, "glGetPixelMapusv", gl_GetPixelMapusv, -1);
3180
+ rb_define_method(klass, "glGetPolygonStipple", gl_GetPolygonStipple, -1);
3181
+ rb_define_method(klass, "glGetString", gl_GetString, 1);
3182
+ rb_define_method(klass, "glGetTexEnvfv", gl_GetTexEnvfv, 2);
3183
+ rb_define_method(klass, "glGetTexEnviv", gl_GetTexEnviv, 2);
3184
+ rb_define_method(klass, "glGetTexGendv", gl_GetTexGendv, 2);
3185
+ rb_define_method(klass, "glGetTexGenfv", gl_GetTexGenfv, 2);
3186
+ rb_define_method(klass, "glGetTexGeniv", gl_GetTexGeniv, 2);
3187
+ rb_define_method(klass, "glGetTexImage", gl_GetTexImage, -1);
3188
+ rb_define_method(klass, "glGetTexParameterfv", gl_GetTexParameterfv, 2);
3189
+ rb_define_method(klass, "glGetTexParameteriv", gl_GetTexParameteriv, 2);
3190
+ rb_define_method(klass, "glGetTexLevelParameterfv", gl_GetTexLevelParameterfv, 3);
3191
+ rb_define_method(klass, "glGetTexLevelParameteriv", gl_GetTexLevelParameteriv, 3);
3192
+ rb_define_method(klass, "glIsEnabled", gl_IsEnabled, 1);
3193
+ rb_define_method(klass, "glIsList", gl_IsList, 1);
3194
+ rb_define_method(klass, "glDepthRange", gl_DepthRange, 2);
3195
+ rb_define_method(klass, "glFrustum", gl_Frustum, 6);
3196
+ rb_define_method(klass, "glLoadIdentity", gl_LoadIdentity, 0);
3197
+ rb_define_method(klass, "glLoadMatrixf", gl_LoadMatrixf, 1);
3198
+ rb_define_method(klass, "glLoadMatrixd", gl_LoadMatrixd, 1);
3199
+ rb_define_method(klass, "glMatrixMode", gl_MatrixMode, 1);
3200
+ rb_define_method(klass, "glMultMatrixf", gl_MultMatrixf, 1);
3201
+ rb_define_method(klass, "glMultMatrixd", gl_MultMatrixd, 1);
3202
+ rb_define_method(klass, "glOrtho", gl_Ortho, 6);
3203
+ rb_define_method(klass, "glPopMatrix", gl_PopMatrix, 0);
3204
+ rb_define_method(klass, "glPushMatrix", gl_PushMatrix, 0);
3205
+ rb_define_method(klass, "glRotated", gl_Rotated, 4);
3206
+ rb_define_method(klass, "glRotatef", gl_Rotatef, 4);
3207
+ rb_define_method(klass, "glScaled", gl_Scaled, 3);
3208
+ rb_define_method(klass, "glScalef", gl_Scalef, 3);
3209
+ rb_define_method(klass, "glTranslated", gl_Translated, 3);
3210
+ rb_define_method(klass, "glTranslatef", gl_Translatef, 3);
3211
+ rb_define_method(klass, "glViewport", gl_Viewport, 4);
2931
3212
 
2932
3213
  /* OpenGL 1.1 functions */
2933
- rb_define_module_function(module, "glArrayElement", gl_ArrayElement, 1);
2934
- rb_define_module_function(module, "glColorPointer", gl_ColorPointer, 4);
2935
- rb_define_module_function(module, "glDisableClientState", gl_DisableClientState, -1);
2936
- rb_define_module_function(module, "glDrawArrays", gl_DrawArrays, 3);
2937
- rb_define_module_function(module, "glDrawElements", gl_DrawElements, 4);
2938
- rb_define_module_function(module, "glEdgeFlagPointer", gl_EdgeFlagPointer, 2);
2939
- rb_define_module_function(module, "glEnableClientState", gl_EnableClientState, -1);
2940
- rb_define_module_function(module, "glGetPointerv", gl_GetPointerv, 1);
2941
- rb_define_module_function(module, "glIndexPointer", gl_IndexPointer, 3);
2942
- rb_define_module_function(module, "glInterleavedArrays", gl_InterleavedArrays, 3);
2943
- rb_define_module_function(module, "glNormalPointer", gl_NormalPointer, 3);
2944
- rb_define_module_function(module, "glTexCoordPointer", gl_TexCoordPointer, 4);
2945
- rb_define_module_function(module, "glVertexPointer", gl_VertexPointer, 4);
2946
- rb_define_module_function(module, "glPolygonOffset", gl_PolygonOffset, 2);
2947
- rb_define_module_function(module, "glCopyTexImage1D", gl_CopyTexImage1D, 7);
2948
- rb_define_module_function(module, "glCopyTexImage2D", gl_CopyTexImage2D, 8);
2949
- rb_define_module_function(module, "glCopyTexSubImage1D", gl_CopyTexSubImage1D, 6);
2950
- rb_define_module_function(module, "glCopyTexSubImage2D", gl_CopyTexSubImage2D, 8);
2951
- rb_define_module_function(module, "glTexSubImage1D", gl_TexSubImage1D, 7);
2952
- rb_define_module_function(module, "glTexSubImage2D", gl_TexSubImage2D, 9);
2953
- rb_define_module_function(module, "glAreTexturesResident", gl_AreTexturesResident, 1);
2954
- rb_define_module_function(module, "glBindTexture", gl_BindTexture, 2);
2955
- rb_define_module_function(module, "glDeleteTextures", gl_DeleteTextures, 1);
2956
- rb_define_module_function(module, "glGenTextures", gl_GenTextures, 1);
2957
- rb_define_module_function(module, "glIsTexture", gl_IsTexture, 1);
2958
- rb_define_module_function(module, "glPrioritizeTextures", gl_PrioritizeTextures, 2);
2959
- rb_define_module_function(module, "glIndexub", gl_Indexub, 1);
2960
- rb_define_module_function(module, "glIndexubv", gl_Indexubv, 1);
2961
- rb_define_module_function(module, "glPopClientAttrib", gl_PopClientAttrib, 0);
2962
- rb_define_module_function(module, "glPushClientAttrib", gl_PushClientAttrib, 1);
3214
+ rb_define_method(klass, "glArrayElement", gl_ArrayElement, 1);
3215
+ rb_define_method(klass, "glColorPointer", gl_ColorPointer, 4);
3216
+ rb_define_method(klass, "glDisableClientState", gl_DisableClientState, -1);
3217
+ rb_define_method(klass, "glDrawArrays", gl_DrawArrays, 3);
3218
+ rb_define_method(klass, "glDrawElements", gl_DrawElements, 4);
3219
+ rb_define_method(klass, "glEdgeFlagPointer", gl_EdgeFlagPointer, 2);
3220
+ rb_define_method(klass, "glEnableClientState", gl_EnableClientState, -1);
3221
+ rb_define_method(klass, "glGetPointerv", gl_GetPointerv, 1);
3222
+ rb_define_method(klass, "glIndexPointer", gl_IndexPointer, 3);
3223
+ rb_define_method(klass, "glInterleavedArrays", gl_InterleavedArrays, 3);
3224
+ rb_define_method(klass, "glNormalPointer", gl_NormalPointer, 3);
3225
+ rb_define_method(klass, "glTexCoordPointer", gl_TexCoordPointer, 4);
3226
+ rb_define_method(klass, "glVertexPointer", gl_VertexPointer, 4);
3227
+ rb_define_method(klass, "glPolygonOffset", gl_PolygonOffset, 2);
3228
+ rb_define_method(klass, "glCopyTexImage1D", gl_CopyTexImage1D, 7);
3229
+ rb_define_method(klass, "glCopyTexImage2D", gl_CopyTexImage2D, 8);
3230
+ rb_define_method(klass, "glCopyTexSubImage1D", gl_CopyTexSubImage1D, 6);
3231
+ rb_define_method(klass, "glCopyTexSubImage2D", gl_CopyTexSubImage2D, 8);
3232
+ rb_define_method(klass, "glTexSubImage1D", gl_TexSubImage1D, 7);
3233
+ rb_define_method(klass, "glTexSubImage2D", gl_TexSubImage2D, 9);
3234
+ rb_define_method(klass, "glAreTexturesResident", gl_AreTexturesResident, 1);
3235
+ rb_define_method(klass, "glBindTexture", gl_BindTexture, 2);
3236
+ rb_define_method(klass, "glDeleteTextures", gl_DeleteTextures, 1);
3237
+ rb_define_method(klass, "glGenTextures", gl_GenTextures, 1);
3238
+ rb_define_method(klass, "glIsTexture", gl_IsTexture, 1);
3239
+ rb_define_method(klass, "glPrioritizeTextures", gl_PrioritizeTextures, 2);
3240
+ rb_define_method(klass, "glIndexub", gl_Indexub, 1);
3241
+ rb_define_method(klass, "glIndexubv", gl_Indexubv, 1);
3242
+ rb_define_method(klass, "glPopClientAttrib", gl_PopClientAttrib, 0);
3243
+ rb_define_method(klass, "glPushClientAttrib", gl_PushClientAttrib, 1);
2963
3244
 
2964
3245
  /* additional functions */
2965
- rb_define_module_function(module, "glColor", gl_Colordv, -1);
2966
- rb_define_module_function(module, "glColor3bv", gl_Colorbv, -1);
2967
- rb_define_module_function(module, "glColor3dv", gl_Colordv, -1);
2968
- rb_define_module_function(module, "glColor3fv", gl_Colorfv, -1);
2969
- rb_define_module_function(module, "glColor3iv", gl_Coloriv, -1);
2970
- rb_define_module_function(module, "glColor3sv", gl_Colorsv, -1);
2971
- rb_define_module_function(module, "glColor3ubv", gl_Colorubv, -1);
2972
- rb_define_module_function(module, "glColor3uiv", gl_Coloruiv, -1);
2973
- rb_define_module_function(module, "glColor3usv", gl_Colorusv, -1);
2974
- rb_define_module_function(module, "glColor4bv", gl_Colorbv, -1);
2975
- rb_define_module_function(module, "glColor4dv", gl_Colordv, -1);
2976
- rb_define_module_function(module, "glColor4fv", gl_Colorfv, -1);
2977
- rb_define_module_function(module, "glColor4iv", gl_Coloriv, -1);
2978
- rb_define_module_function(module, "glColor4sv", gl_Colorsv, -1);
2979
- rb_define_module_function(module, "glColor4ubv", gl_Colorubv, -1);
2980
- rb_define_module_function(module, "glColor4uiv", gl_Coloruiv, -1);
2981
- rb_define_module_function(module, "glColor4usv", gl_Colorusv, -1);
2982
-
2983
- rb_define_module_function(module, "glNormal", gl_Normaldv, -1);
2984
- rb_define_module_function(module, "glNormal3bv", gl_Normalbv, -1);
2985
- rb_define_module_function(module, "glNormal3dv", gl_Normaldv, -1);
2986
- rb_define_module_function(module, "glNormal3fv", gl_Normalfv, -1);
2987
- rb_define_module_function(module, "glNormal3iv", gl_Normaliv, -1);
2988
- rb_define_module_function(module, "glNormal3sv", gl_Normalsv, -1);
2989
-
2990
- rb_define_module_function(module, "glRasterPos", gl_RasterPosdv, -1);
2991
- rb_define_module_function(module, "glRasterPos2dv", gl_RasterPosdv, -1);
2992
- rb_define_module_function(module, "glRasterPos2fv", gl_RasterPosfv, -1);
2993
- rb_define_module_function(module, "glRasterPos2iv", gl_RasterPosiv, -1);
2994
- rb_define_module_function(module, "glRasterPos2sv", gl_RasterPossv, -1);
2995
- rb_define_module_function(module, "glRasterPos3dv", gl_RasterPosdv, -1);
2996
- rb_define_module_function(module, "glRasterPos3fv", gl_RasterPosfv, -1);
2997
- rb_define_module_function(module, "glRasterPos3iv", gl_RasterPosiv, -1);
2998
- rb_define_module_function(module, "glRasterPos3sv", gl_RasterPossv, -1);
2999
- rb_define_module_function(module, "glRasterPos4dv", gl_RasterPosdv, -1);
3000
- rb_define_module_function(module, "glRasterPos4fv", gl_RasterPosfv, -1);
3001
- rb_define_module_function(module, "glRasterPos4iv", gl_RasterPosiv, -1);
3002
- rb_define_module_function(module, "glRasterPos4sv", gl_RasterPossv, -1);
3003
-
3004
- rb_define_module_function(module, "glRect", gl_Rectdv, -1);
3005
- rb_define_module_function(module, "glRectdv", gl_Rectdv, -1);
3006
- rb_define_module_function(module, "glRectfv", gl_Rectfv, -1);
3007
- rb_define_module_function(module, "glRectiv", gl_Rectiv, -1);
3008
- rb_define_module_function(module, "glRectsv", gl_Rectsv, -1);
3009
-
3010
- rb_define_module_function(module, "glTexCoord", gl_TexCoorddv, -1);
3011
- rb_define_module_function(module, "glTexCoord1dv", gl_TexCoorddv, -1);
3012
- rb_define_module_function(module, "glTexCoord1fv", gl_TexCoordfv, -1);
3013
- rb_define_module_function(module, "glTexCoord1iv", gl_TexCoordiv, -1);
3014
- rb_define_module_function(module, "glTexCoord1sv", gl_TexCoordsv, -1);
3015
- rb_define_module_function(module, "glTexCoord2dv", gl_TexCoorddv, -1);
3016
- rb_define_module_function(module, "glTexCoord2fv", gl_TexCoordfv, -1);
3017
- rb_define_module_function(module, "glTexCoord2iv", gl_TexCoordiv, -1);
3018
- rb_define_module_function(module, "glTexCoord2sv", gl_TexCoordsv, -1);
3019
- rb_define_module_function(module, "glTexCoord3dv", gl_TexCoorddv, -1);
3020
- rb_define_module_function(module, "glTexCoord3fv", gl_TexCoordfv, -1);
3021
- rb_define_module_function(module, "glTexCoord3iv", gl_TexCoordiv, -1);
3022
- rb_define_module_function(module, "glTexCoord3sv", gl_TexCoordsv, -1);
3023
- rb_define_module_function(module, "glTexCoord4dv", gl_TexCoorddv, -1);
3024
- rb_define_module_function(module, "glTexCoord4fv", gl_TexCoordfv, -1);
3025
- rb_define_module_function(module, "glTexCoord4iv", gl_TexCoordiv, -1);
3026
- rb_define_module_function(module, "glTexCoord4sv", gl_TexCoordsv, -1);
3027
-
3028
- rb_define_module_function(module, "glVertex", gl_Vertexdv, -1);
3029
- rb_define_module_function(module, "glVertex2dv", gl_Vertexdv, -1);
3030
- rb_define_module_function(module, "glVertex2fv", gl_Vertexfv, -1);
3031
- rb_define_module_function(module, "glVertex2iv", gl_Vertexiv, -1);
3032
- rb_define_module_function(module, "glVertex2sv", gl_Vertexsv, -1);
3033
- rb_define_module_function(module, "glVertex3dv", gl_Vertexdv, -1);
3034
- rb_define_module_function(module, "glVertex3fv", gl_Vertexfv, -1);
3035
- rb_define_module_function(module, "glVertex3iv", gl_Vertexiv, -1);
3036
- rb_define_module_function(module, "glVertex3sv", gl_Vertexsv, -1);
3037
- rb_define_module_function(module, "glVertex4dv", gl_Vertexdv, -1);
3038
- rb_define_module_function(module, "glVertex4fv", gl_Vertexfv, -1);
3039
- rb_define_module_function(module, "glVertex4iv", gl_Vertexiv, -1);
3040
- rb_define_module_function(module, "glVertex4sv", gl_Vertexsv, -1);
3246
+ rb_define_method(klass, "glColor", gl_Colordv, -1);
3247
+ rb_define_method(klass, "glColor3bv", gl_Colorbv, -1);
3248
+ rb_define_method(klass, "glColor3dv", gl_Colordv, -1);
3249
+ rb_define_method(klass, "glColor3fv", gl_Colorfv, -1);
3250
+ rb_define_method(klass, "glColor3iv", gl_Coloriv, -1);
3251
+ rb_define_method(klass, "glColor3sv", gl_Colorsv, -1);
3252
+ rb_define_method(klass, "glColor3ubv", gl_Colorubv, -1);
3253
+ rb_define_method(klass, "glColor3uiv", gl_Coloruiv, -1);
3254
+ rb_define_method(klass, "glColor3usv", gl_Colorusv, -1);
3255
+ rb_define_method(klass, "glColor4bv", gl_Colorbv, -1);
3256
+ rb_define_method(klass, "glColor4dv", gl_Colordv, -1);
3257
+ rb_define_method(klass, "glColor4fv", gl_Colorfv, -1);
3258
+ rb_define_method(klass, "glColor4iv", gl_Coloriv, -1);
3259
+ rb_define_method(klass, "glColor4sv", gl_Colorsv, -1);
3260
+ rb_define_method(klass, "glColor4ubv", gl_Colorubv, -1);
3261
+ rb_define_method(klass, "glColor4uiv", gl_Coloruiv, -1);
3262
+ rb_define_method(klass, "glColor4usv", gl_Colorusv, -1);
3263
+
3264
+ rb_define_method(klass, "glNormal", gl_Normaldv, -1);
3265
+ rb_define_method(klass, "glNormal3bv", gl_Normalbv, -1);
3266
+ rb_define_method(klass, "glNormal3dv", gl_Normaldv, -1);
3267
+ rb_define_method(klass, "glNormal3fv", gl_Normalfv, -1);
3268
+ rb_define_method(klass, "glNormal3iv", gl_Normaliv, -1);
3269
+ rb_define_method(klass, "glNormal3sv", gl_Normalsv, -1);
3270
+
3271
+ rb_define_method(klass, "glRasterPos", gl_RasterPosdv, -1);
3272
+ rb_define_method(klass, "glRasterPos2dv", gl_RasterPosdv, -1);
3273
+ rb_define_method(klass, "glRasterPos2fv", gl_RasterPosfv, -1);
3274
+ rb_define_method(klass, "glRasterPos2iv", gl_RasterPosiv, -1);
3275
+ rb_define_method(klass, "glRasterPos2sv", gl_RasterPossv, -1);
3276
+ rb_define_method(klass, "glRasterPos3dv", gl_RasterPosdv, -1);
3277
+ rb_define_method(klass, "glRasterPos3fv", gl_RasterPosfv, -1);
3278
+ rb_define_method(klass, "glRasterPos3iv", gl_RasterPosiv, -1);
3279
+ rb_define_method(klass, "glRasterPos3sv", gl_RasterPossv, -1);
3280
+ rb_define_method(klass, "glRasterPos4dv", gl_RasterPosdv, -1);
3281
+ rb_define_method(klass, "glRasterPos4fv", gl_RasterPosfv, -1);
3282
+ rb_define_method(klass, "glRasterPos4iv", gl_RasterPosiv, -1);
3283
+ rb_define_method(klass, "glRasterPos4sv", gl_RasterPossv, -1);
3284
+
3285
+ rb_define_method(klass, "glRect", gl_Rectdv, -1);
3286
+ rb_define_method(klass, "glRectdv", gl_Rectdv, -1);
3287
+ rb_define_method(klass, "glRectfv", gl_Rectfv, -1);
3288
+ rb_define_method(klass, "glRectiv", gl_Rectiv, -1);
3289
+ rb_define_method(klass, "glRectsv", gl_Rectsv, -1);
3290
+
3291
+ rb_define_method(klass, "glTexCoord", gl_TexCoorddv, -1);
3292
+ rb_define_method(klass, "glTexCoord1dv", gl_TexCoorddv, -1);
3293
+ rb_define_method(klass, "glTexCoord1fv", gl_TexCoordfv, -1);
3294
+ rb_define_method(klass, "glTexCoord1iv", gl_TexCoordiv, -1);
3295
+ rb_define_method(klass, "glTexCoord1sv", gl_TexCoordsv, -1);
3296
+ rb_define_method(klass, "glTexCoord2dv", gl_TexCoorddv, -1);
3297
+ rb_define_method(klass, "glTexCoord2fv", gl_TexCoordfv, -1);
3298
+ rb_define_method(klass, "glTexCoord2iv", gl_TexCoordiv, -1);
3299
+ rb_define_method(klass, "glTexCoord2sv", gl_TexCoordsv, -1);
3300
+ rb_define_method(klass, "glTexCoord3dv", gl_TexCoorddv, -1);
3301
+ rb_define_method(klass, "glTexCoord3fv", gl_TexCoordfv, -1);
3302
+ rb_define_method(klass, "glTexCoord3iv", gl_TexCoordiv, -1);
3303
+ rb_define_method(klass, "glTexCoord3sv", gl_TexCoordsv, -1);
3304
+ rb_define_method(klass, "glTexCoord4dv", gl_TexCoorddv, -1);
3305
+ rb_define_method(klass, "glTexCoord4fv", gl_TexCoordfv, -1);
3306
+ rb_define_method(klass, "glTexCoord4iv", gl_TexCoordiv, -1);
3307
+ rb_define_method(klass, "glTexCoord4sv", gl_TexCoordsv, -1);
3308
+
3309
+ rb_define_method(klass, "glVertex", gl_Vertexdv, -1);
3310
+ rb_define_method(klass, "glVertex2dv", gl_Vertexdv, -1);
3311
+ rb_define_method(klass, "glVertex2fv", gl_Vertexfv, -1);
3312
+ rb_define_method(klass, "glVertex2iv", gl_Vertexiv, -1);
3313
+ rb_define_method(klass, "glVertex2sv", gl_Vertexsv, -1);
3314
+ rb_define_method(klass, "glVertex3dv", gl_Vertexdv, -1);
3315
+ rb_define_method(klass, "glVertex3fv", gl_Vertexfv, -1);
3316
+ rb_define_method(klass, "glVertex3iv", gl_Vertexiv, -1);
3317
+ rb_define_method(klass, "glVertex3sv", gl_Vertexsv, -1);
3318
+ rb_define_method(klass, "glVertex4dv", gl_Vertexdv, -1);
3319
+ rb_define_method(klass, "glVertex4fv", gl_Vertexfv, -1);
3320
+ rb_define_method(klass, "glVertex4iv", gl_Vertexiv, -1);
3321
+ rb_define_method(klass, "glVertex4sv", gl_Vertexsv, -1);
3041
3322
 
3042
3323
  /* these simply calls normal or vector (*v) function depending on
3043
3324
  if array or single value is passed to them */
3044
- rb_define_module_function(module, "glLightModel", gl_LightModel, 2);
3045
- rb_define_module_function(module, "glMaterial", gl_Material, 3);
3046
- rb_define_module_function(module, "glFog", gl_Fog, 2);
3047
- rb_define_module_function(module, "glLight", gl_Light, 3);
3048
- rb_define_module_function(module, "glTexParameter", gl_TexParameter, 3);
3049
- rb_define_module_function(module, "glTexEnv", gl_TexEnv, 3);
3050
- rb_define_module_function(module, "glTexGen", gl_TexGen, 3);
3325
+ rb_define_method(klass, "glLightModel", gl_LightModel, 2);
3326
+ rb_define_method(klass, "glMaterial", gl_Material, 3);
3327
+ rb_define_method(klass, "glFog", gl_Fog, 2);
3328
+ rb_define_method(klass, "glLight", gl_Light, 3);
3329
+ rb_define_method(klass, "glTexParameter", gl_TexParameter, 3);
3330
+ rb_define_method(klass, "glTexEnv", gl_TexEnv, 3);
3331
+ rb_define_method(klass, "glTexGen", gl_TexGen, 3);
3051
3332
 
3052
3333
  /* aliases */
3053
- rb_define_module_function(module, "glMultMatrix", gl_MultMatrixd, 1);
3054
- rb_define_module_function(module, "glLoadMatrix", gl_LoadMatrixd, 1);
3055
- rb_define_module_function(module, "glRotate", gl_Rotated, 4);
3056
- rb_define_module_function(module, "glScale", gl_Scaled, 3);
3057
- rb_define_module_function(module, "glTranslate", gl_Translated, 3);
3058
-
3059
- rb_define_module_function(module, "glPixelStore", gl_PixelStoref, 2);
3060
- rb_define_module_function(module, "glPixelTransfer", gl_PixelTransferf, 2);
3061
- rb_define_module_function(module, "glIndex", gl_Indexi, 1);
3062
- rb_define_module_function(module, "glGetMaterial", gl_GetMaterialfv, 2);
3063
- rb_define_module_function(module, "glGetDouble", gl_GetDoublev, 1);
3064
-
3065
- rb_global_variable(&g_current_sel_buffer);
3066
- rb_global_variable(&g_current_feed_buffer);
3067
- rb_global_variable(&g_Vertex_ptr);
3068
- rb_global_variable(&g_Normal_ptr);
3069
- rb_global_variable(&g_Color_ptr);
3070
- rb_global_variable(&g_Index_ptr);
3071
- rb_global_variable(&g_TexCoord_ptr);
3072
- rb_global_variable(&g_EdgeFlag_ptr);
3073
- rb_global_variable(&g_FogCoord_ptr);
3074
- rb_global_variable(&g_SecondaryColor_ptr);
3334
+ rb_define_method(klass, "glMultMatrix", gl_MultMatrixd, 1);
3335
+ rb_define_method(klass, "glLoadMatrix", gl_LoadMatrixd, 1);
3336
+ rb_define_method(klass, "glRotate", gl_Rotated, 4);
3337
+ rb_define_method(klass, "glScale", gl_Scaled, 3);
3338
+ rb_define_method(klass, "glTranslate", gl_Translated, 3);
3339
+
3340
+ rb_define_method(klass, "glPixelStore", gl_PixelStoref, 2);
3341
+ rb_define_method(klass, "glPixelTransfer", gl_PixelTransferf, 2);
3342
+ rb_define_method(klass, "glIndex", gl_Indexi, 1);
3343
+ rb_define_method(klass, "glGetMaterial", gl_GetMaterialfv, 2);
3344
+ rb_define_method(klass, "glGetDouble", gl_GetDoublev, 1);
3075
3345
  }