ruby-opengl 0.33.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/Rakefile +42 -15
  2. data/doc/build_install.txt +70 -25
  3. data/doc/history.txt +4 -0
  4. data/doc/requirements_and_design.txt +2 -3
  5. data/doc/roadmap.txt +15 -2
  6. data/doc/screenshots.txt +23 -0
  7. data/doc/supplies/page_template.html +2 -1
  8. data/doc/thanks.txt +3 -0
  9. data/doc/tutorial.txt +5 -3
  10. data/examples/README +57 -7
  11. data/examples/legacy/COPYRIGHT +8 -0
  12. data/examples/{aaindex.rb → legacy/aaindex.rb} +6 -5
  13. data/examples/legacy/aapoly.rb +153 -0
  14. data/examples/legacy/aargb.rb +139 -0
  15. data/examples/legacy/accanti.rb +159 -0
  16. data/examples/legacy/accpersp.rb +216 -0
  17. data/examples/legacy/alpha.rb +133 -0
  18. data/examples/legacy/alpha3D.rb +165 -0
  19. data/examples/legacy/bezcurve.rb +107 -0
  20. data/examples/legacy/bezmesh.rb +131 -0
  21. data/examples/legacy/checker.rb +121 -0
  22. data/examples/legacy/clip.rb +104 -0
  23. data/examples/legacy/colormat.rb +145 -0
  24. data/examples/legacy/cube.rb +73 -0
  25. data/examples/legacy/depthcue.rb +101 -0
  26. data/examples/legacy/dof.rb +212 -0
  27. data/examples/legacy/double.rb +104 -0
  28. data/examples/legacy/drawf.rb +98 -0
  29. data/examples/legacy/feedback.rb +152 -0
  30. data/examples/legacy/fog.rb +172 -0
  31. data/examples/legacy/font-glut.rb +41 -0
  32. data/examples/legacy/font.rb +158 -0
  33. data/examples/legacy/hello.rb +75 -0
  34. data/examples/legacy/image.rb +145 -0
  35. data/examples/legacy/jitter.rb +209 -0
  36. data/examples/legacy/lines.rb +135 -0
  37. data/examples/legacy/list.rb +120 -0
  38. data/examples/legacy/material.rb +290 -0
  39. data/examples/legacy/mipmap.rb +159 -0
  40. data/examples/legacy/model.rb +119 -0
  41. data/examples/legacy/movelight.rb +140 -0
  42. data/examples/legacy/pickdepth.rb +180 -0
  43. data/examples/legacy/planet.rb +112 -0
  44. data/examples/legacy/quadric.rb +180 -0
  45. data/examples/legacy/readpixel.rb +59 -0
  46. data/examples/legacy/robot.rb +120 -0
  47. data/examples/legacy/select.rb +207 -0
  48. data/examples/{smooth_prev.rb → legacy/smooth.rb} +3 -2
  49. data/examples/legacy/stencil.rb +154 -0
  50. data/examples/legacy/stroke.rb +170 -0
  51. data/examples/legacy/surface.rb +170 -0
  52. data/examples/legacy/teaambient.rb +132 -0
  53. data/examples/legacy/teapots.rb +188 -0
  54. data/examples/legacy/tess.rb +222 -0
  55. data/examples/legacy/texbind.rb +157 -0
  56. data/examples/legacy/texgen.rb +171 -0
  57. data/examples/legacy/texturesurf.rb +128 -0
  58. data/examples/legacy/varray.rb +167 -0
  59. data/examples/legacy/wrap.rb +158 -0
  60. data/examples/nehe_lesson02.rb +117 -0
  61. data/examples/nehe_lesson03.rb +122 -0
  62. data/examples/nehe_lesson04.rb +133 -0
  63. data/examples/nehe_lesson05.rb +186 -0
  64. data/examples/plane.rb +1 -1
  65. data/examples/smooth.rb +4 -2
  66. data/examples/test.rb +3 -2
  67. data/ext/common/{rbogl.c → common.h} +99 -32
  68. data/ext/common/gl-enums.h +39 -1
  69. data/ext/gl/gl-1.0-1.1.c +350 -305
  70. data/ext/gl/gl-1.2.c +933 -38
  71. data/ext/gl/gl-1.3.c +725 -0
  72. data/ext/gl/gl-1.4.c +647 -0
  73. data/ext/gl/gl-1.5.c +362 -0
  74. data/ext/gl/gl-2.0.c +1632 -0
  75. data/ext/gl/gl-2.1.c +154 -0
  76. data/ext/gl/gl-enums.c +1 -2
  77. data/ext/gl/gl.c +58 -2
  78. data/ext/gl/mkrf_conf.rb +4 -1
  79. data/ext/glu/glu.c +5 -4
  80. data/ext/glu/mkrf_conf.rb +4 -1
  81. data/ext/glut/glut.c +7 -1
  82. data/ext/glut/mkrf_conf.rb +5 -0
  83. data/lib/gl_prev.rb +4 -3
  84. data/lib/glu_prev.rb +4 -3
  85. data/lib/glut_prev.rb +3 -3
  86. data/{examples/all_tests.rb → lib/opengl.rb} +9 -12
  87. data/test/README +5 -18
  88. data/test/tc_common.rb +79 -0
  89. data/test/tc_func_10_11.rb +1255 -0
  90. data/test/tc_func_12.rb +186 -0
  91. data/test/tc_func_13.rb +203 -0
  92. data/test/tc_func_14.rb +197 -0
  93. data/test/tc_func_15.rb +82 -0
  94. data/test/tc_func_20.rb +320 -0
  95. data/test/tc_func_21.rb +67 -0
  96. data/test/tc_include_gl.rb +1 -1
  97. data/test/{tc_opengl_namespace.rb → tc_misc.rb} +20 -20
  98. data/test/tc_require_gl.rb +1 -1
  99. metadata +99 -27
  100. data/ext/common/Rakefile +0 -39
  101. data/ext/common/rbogl.h +0 -52
  102. data/test/runtests.sh +0 -7
  103. data/test/tc_gl_vertex.rb +0 -180
data/examples/plane.rb CHANGED
@@ -1,4 +1,4 @@
1
- #
1
+ #!/usr/bin/env ruby -rubygems
2
2
  #/* Copyright (c) Mark J. Kilgard, 1994. */
3
3
  #
4
4
  #/*
data/examples/smooth.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "../lib/gl"
2
- require "../lib/glut"
1
+ #!/usr/bin/env ruby -rubygems
2
+
3
+ require "gl"
4
+ require "glut"
3
5
 
4
6
  STDOUT.sync=TRUE
5
7
  disp = Proc.new {
data/examples/test.rb CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env ruby -rubygems
1
2
  # Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
2
3
  #
3
4
  # This program is distributed under the terms of the MIT license.
@@ -11,8 +12,8 @@
11
12
  # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
12
13
  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
14
 
14
- require '../lib/glut'
15
- require '../lib/gl'
15
+ require 'glut'
16
+ require 'gl'
16
17
 
17
18
  class GlutTest
18
19
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Last edit by previous maintainer:
3
- * 2003/08/17 03:46:15, yoshi
3
+ * 2000/01/06 16:37:43, kusano
4
4
  *
5
5
  * Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
6
6
  * Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
@@ -17,21 +17,55 @@
17
17
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
18
  */
19
19
 
20
+ #ifndef _RBOGL_H_
21
+ #define _RBOGL_H_
22
+
23
+ #include <ruby.h>
24
+
20
25
  #ifdef __APPLE__
21
26
  #include <OpenGL/gl.h>
27
+ #include <mach-o/dyld.h>
28
+ #include <stdlib.h>
29
+ #include <string.h>
22
30
  #elif defined WIN32
23
31
  #include <windows.h>
24
32
  #include <GL/gl.h>
25
33
  #else
26
34
  #include <GL/gl.h>
35
+ #include <GL/glx.h>
27
36
  #endif
28
37
 
29
- #include "rbogl.h"
30
38
  #include "gl-enums.h"
31
39
 
40
+
41
+ typedef struct RArray RArray;
42
+
43
+ extern VALUE cProc;
44
+
45
+ #define LOAD_GL_FUNC(_NAME_) \
46
+ if (fptr_##_NAME_==NULL) \
47
+ fptr_##_NAME_ = load_gl_function(#_NAME_, 1);
48
+
49
+ #define FORCE_PIXEL_STORE_MODE \
50
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); \
51
+ glPixelStorei(GL_PACK_ALIGNMENT, 1); \
52
+ glPixelStorei(GL_PACK_SKIP_PIXELS, 0); \
53
+ glPixelStorei(GL_PACK_SKIP_ROWS, 0); \
54
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0); \
55
+ glPixelStorei(GL_PACK_SKIP_IMAGES, 0); \
56
+ glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
57
+ /* glPixelStorei(GL_PACK_SKIP_VOLUMES_SGIS, 0);
58
+ glPixelStorei(GL_PACK_IMAGE_DEPTH_SGIS, 0); */
59
+
60
+ #define RESTORE_PIXEL_STORE_MODE \
61
+ glPopClientAttrib();
62
+
63
+
32
64
  /* -------------------------------------------------------------------- */
33
- #ifdef _NO_NUM2DBL_
34
- extern double num2double( VALUE val )
65
+ #ifndef NUM2DBL
66
+ #define NUM2DBL(_val) num2double(_val)
67
+
68
+ static inline double num2double( VALUE val )
35
69
  {
36
70
  struct RFloat* flt;
37
71
  if (NIL_P(val)) return 0;
@@ -41,8 +75,8 @@ extern double num2double( VALUE val )
41
75
  #endif
42
76
 
43
77
  /* -------------------------------------------------------------------- */
44
- #define ARY2INTEGRAL(_type_) \
45
- extern int ary2c##_type_( arg, cary, maxlen ) \
78
+ #define ARY2INTEGRAL(_type_,_convert_) \
79
+ static inline int ary2c##_type_( arg, cary, maxlen ) \
46
80
  VALUE arg; \
47
81
  GL##_type_ cary[]; \
48
82
  int maxlen; \
@@ -58,22 +92,22 @@ int maxlen; \
58
92
  for (i=0; i < maxlen; i++) \
59
93
  { \
60
94
  entry = rb_ary_entry((VALUE)ary,i); \
61
- cary[i] = (GL##_type_)NUM2INT(entry); \
95
+ cary[i] = (GL##_type_)_convert_(entry); \
62
96
  } \
63
97
  return i; \
64
98
  }
65
99
 
66
- ARY2INTEGRAL(int)
67
- ARY2INTEGRAL(uint)
68
- ARY2INTEGRAL(byte)
69
- ARY2INTEGRAL(ubyte)
70
- ARY2INTEGRAL(short)
71
- ARY2INTEGRAL(ushort)
72
- ARY2INTEGRAL(boolean)
100
+ ARY2INTEGRAL(int,NUM2INT)
101
+ ARY2INTEGRAL(uint,NUM2UINT)
102
+ ARY2INTEGRAL(byte,NUM2INT)
103
+ ARY2INTEGRAL(ubyte,NUM2INT)
104
+ ARY2INTEGRAL(short,NUM2INT)
105
+ ARY2INTEGRAL(ushort,NUM2INT)
106
+ ARY2INTEGRAL(boolean,NUM2INT)
73
107
  #undef ARY2INTEGRAL
74
108
 
75
109
  /* -------------------------------------------------------------------- */
76
- extern int ary2cflt(arg, cary, maxlen)
110
+ static inline int ary2cflt(arg, cary, maxlen)
77
111
  VALUE arg;
78
112
  float cary[];
79
113
  int maxlen;
@@ -91,7 +125,7 @@ int maxlen;
91
125
  }
92
126
 
93
127
  /* -------------------------------------------------------------------- */
94
- extern int ary2cdbl(arg, cary, maxlen)
128
+ static inline int ary2cdbl(arg, cary, maxlen)
95
129
  VALUE arg;
96
130
  double cary[];
97
131
  int maxlen;
@@ -109,7 +143,7 @@ int maxlen;
109
143
  }
110
144
 
111
145
  /* -------------------------------------------------------------------- */
112
- extern void mary2ary(src, ary)
146
+ static inline void mary2ary(src, ary)
113
147
  VALUE src;
114
148
  VALUE ary;
115
149
  {
@@ -119,14 +153,14 @@ VALUE ary;
119
153
  for (i = 0; i < tmp_ary->len; i++)
120
154
  {
121
155
  if (TYPE(tmp_ary->ptr[i]) == T_ARRAY)
122
- mary2ary((VALUE)tmp_ary, ary);
156
+ mary2ary((VALUE)tmp_ary->ptr[i], ary);
123
157
  else
124
158
  rb_ary_push(ary, tmp_ary->ptr[i]);
125
159
  }
126
160
  }
127
161
 
128
162
  /* -------------------------------------------------------------------- */
129
- extern void ary2cmat4x4dbl(ary, cary)
163
+ static inline void ary2cmat4x4dbl(ary, cary)
130
164
  VALUE ary;
131
165
  double cary[];
132
166
  {
@@ -147,7 +181,7 @@ double cary[];
147
181
  }
148
182
  }
149
183
 
150
- extern void ary2cmat4x4flt(ary, cary)
184
+ static inline void ary2cmat4x4flt(ary, cary)
151
185
  VALUE ary;
152
186
  float cary[];
153
187
  {
@@ -170,7 +204,7 @@ float cary[];
170
204
 
171
205
  /* -------------------------------------------------------------------- */
172
206
  /*Need to find proper size for glReadPixels array*/
173
- int glformat_size(GLenum format)
207
+ static inline int glformat_size(GLenum format)
174
208
  {
175
209
  switch(format)
176
210
  {
@@ -206,7 +240,7 @@ int glformat_size(GLenum format)
206
240
  }
207
241
 
208
242
  /* -------------------------------------------------------------------- */
209
- int gltype_size(GLenum type)
243
+ static inline int gltype_size(GLenum type)
210
244
  {
211
245
  switch(type)
212
246
  {
@@ -214,7 +248,7 @@ int gltype_size(GLenum type)
214
248
  case GL_UNSIGNED_BYTE:
215
249
  case GL_UNSIGNED_BYTE_3_3_2:
216
250
  case GL_UNSIGNED_BYTE_2_3_3_REV:
217
- return 8;
251
+ return 1;
218
252
 
219
253
  case GL_SHORT:
220
254
  case GL_UNSIGNED_SHORT:
@@ -224,7 +258,7 @@ int gltype_size(GLenum type)
224
258
  case GL_UNSIGNED_SHORT_4_4_4_4_REV:
225
259
  case GL_UNSIGNED_SHORT_5_5_5_1:
226
260
  case GL_UNSIGNED_SHORT_1_5_5_5_REV:
227
- return 16;
261
+ return 2;
228
262
 
229
263
  case GL_INT:
230
264
  case GL_UNSIGNED_INT:
@@ -233,10 +267,10 @@ int gltype_size(GLenum type)
233
267
  case GL_UNSIGNED_INT_8_8_8_8_REV:
234
268
  case GL_UNSIGNED_INT_10_10_10_2:
235
269
  case GL_UNSIGNED_INT_2_10_10_10_REV:
236
- return 32;
270
+ return 4;
237
271
 
238
272
  case GL_BITMAP:
239
- return 1;
273
+ return 0;
240
274
 
241
275
  default:
242
276
  return -1;
@@ -244,17 +278,50 @@ int gltype_size(GLenum type)
244
278
  }
245
279
 
246
280
  /* -------------------------------------------------------------------- */
247
- VALUE allocate_buffer_with_string( int size )
281
+ static inline VALUE allocate_buffer_with_string( int size )
248
282
  {
249
283
  return rb_str_new(NULL, size);
250
284
  }
251
285
 
252
286
  /* -------------------------------------------------------------------- */
253
- void Init_gl(void);
254
-
255
- void Init_opengl()
287
+ static inline void *load_gl_function(const char *name,int raise)
256
288
  {
257
- Init_gl(); /* is this needed ? */
258
- /* RxINC: InitializeGLU(); */
289
+ void *func_ptr = NULL;
290
+
291
+ #if defined(__APPLE__)
292
+ static const struct mach_header* library = NULL;
293
+ char* symbolName;
294
+ NSSymbol symbol;
295
+ if (library == NULL)
296
+ library = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL",NSADDIMAGE_OPTION_RETURN_ON_ERROR);
297
+
298
+ if (library == NULL)
299
+ rb_raise(rb_eRuntimeError,"Can't load OpenGL library for dynamic loading");
300
+
301
+ /* prepend a '_' for the Unix C symbol mangling convention */
302
+ symbolName = ALLOC_N(char,strlen(name) + 2);
303
+ symbolName[0] = '_';
304
+ strcpy(symbolName+1, name);
305
+
306
+ symbol = NSLookupSymbolInImage(library,symbolName,NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
307
+ xfree(symbolName);
308
+
309
+ if (symbol == NULL)
310
+ func_ptr = NULL;
311
+ else
312
+ func_ptr = NSAddressOfSymbol(symbol);
313
+ #elif defined(WIN32) || defined(_WIN32)
314
+ func_ptr = wglGetProcAddress((LPCSTR)name);
315
+ #elif defined(GLX_VERSION_1_4)
316
+ func_ptr = glXGetProcAddress((const GLubyte *)name);
317
+ #else
318
+ func_ptr = glXGetProcAddressARB((const GLubyte *)name);
319
+ #endif
320
+
321
+ if (func_ptr == NULL && raise == 1)
322
+ rb_raise(rb_eNotImpError,"Function %s is not available at this machine",name);
323
+
324
+ return func_ptr;
259
325
  }
260
326
 
327
+ #endif /* _RBOGL_H_ */
@@ -1,4 +1,42 @@
1
- /* This file was genereated on Sun Feb 11 01:24:24 +0100 2007 */
1
+ /* GL types - define if system GLheaders are not recent */
2
+
3
+ /* GL base */
4
+ #ifndef GL_VERSION_1_5
5
+ typedef ptrdiff_t GLintptr;
6
+ typedef ptrdiff_t GLsizeiptr;
7
+ #endif
8
+
9
+ #ifndef GL_VERSION_2_0
10
+ typedef char GLchar;
11
+ #endif
12
+
13
+ /* new GL types introduced by ARB extensions */
14
+ #ifndef GL_ARB_half_float_pixel
15
+ typedef unsigned short GLhalfARB;
16
+ #endif
17
+
18
+ #ifndef GL_ARB_shader_objects
19
+ typedef char GLcharARB;
20
+ typedef unsigned int GLhandleARB;
21
+ #endif
22
+
23
+ #ifndef GL_ARB_vertex_buffer_object
24
+ typedef ptrdiff_t GLintptrARB;
25
+ typedef ptrdiff_t GLsizeiptrARB;
26
+ #endif
27
+
28
+ /* new GL types introduced by other extensions */
29
+ #ifndef GL_NV_half_float
30
+ typedef unsigned short GLhalfNV;
31
+ #endif
32
+
33
+ /* List of GL enumerators */
34
+
35
+ /* The code below was genereated on Sun Feb 11 01:24:24 +0100 2007
36
+ source: http://www.opengl.org/registry/api/enum.spec
37
+ http://www.opengl.org/registry/api/enumext.spec
38
+ */
39
+
2
40
  #ifndef _GLENUMS_H_
3
41
  #define _GLENUMS_H_
4
42
 
data/ext/gl/gl-1.0-1.1.c CHANGED
@@ -22,8 +22,7 @@
22
22
  #else
23
23
  #include <GL/gl.h>
24
24
  #endif
25
- #include "../common/rbogl.h"
26
- #include "../common/gl-enums.h"
25
+ #include "../common/common.h"
27
26
 
28
27
  #ifndef MAX
29
28
  #define MAX(a, b) (((a) > (b)) ? (a) : (b))
@@ -37,7 +36,7 @@ VALUE obj,arg1,arg2;
37
36
  {
38
37
  GLuint list;
39
38
  GLenum mode;
40
- list = (GLuint)NUM2INT(arg1);
39
+ list = (GLuint)NUM2UINT(arg1);
41
40
  mode = (GLenum)NUM2INT(arg2);
42
41
  glNewList(list,mode);
43
42
  return Qnil;
@@ -56,7 +55,7 @@ gl_CallList(obj,arg1)
56
55
  VALUE obj,arg1;
57
56
  {
58
57
  GLuint list;
59
- list = (GLuint)NUM2INT(arg1);
58
+ list = (GLuint)NUM2UINT(arg1);
60
59
  glCallList(list);
61
60
  return Qnil;
62
61
  }
@@ -74,10 +73,10 @@ VALUE obj,arg1;
74
73
  n = RSTRING(arg1)->len;
75
74
  } else if (TYPE(arg1) == T_ARRAY) {
76
75
  type = GL_INT;
77
- lists = ALLOC_N(int, RARRAY(arg1)->len);
76
+ lists = ALLOC_N(GLint, RARRAY(arg1)->len);
78
77
  n = ary2cint(arg1,lists,0);
79
78
  } else {
80
- rb_raise(rb_eArgError,"GL.CallLists wrong arguments");
79
+ Check_Type(arg1,T_ARRAY); /* force exception */
81
80
  return Qnil; /* not reached */
82
81
  }
83
82
  glCallLists(n, type, lists);
@@ -91,8 +90,8 @@ VALUE obj,arg1,arg2;
91
90
  {
92
91
  GLuint list;
93
92
  GLsizei range;
94
- list = (GLuint)NUM2INT(arg1);
95
- range = (GLsizei)NUM2INT(arg2);
93
+ list = (GLuint)NUM2UINT(arg1);
94
+ range = (GLsizei)NUM2UINT(arg2);
96
95
  glDeleteLists(list,range);
97
96
  return Qnil;
98
97
  }
@@ -103,7 +102,7 @@ VALUE obj,arg1;
103
102
  {
104
103
  GLsizei range;
105
104
  GLuint ret;
106
- range = (GLsizei)NUM2INT(arg1);
105
+ range = (GLsizei)NUM2UINT(arg1);
107
106
  ret = glGenLists(range);
108
107
  return INT2NUM(ret);
109
108
  }
@@ -113,7 +112,7 @@ gl_ListBase(obj,arg1)
113
112
  VALUE obj,arg1;
114
113
  {
115
114
  GLuint base;
116
- base = (GLuint)NUM2INT(arg1);
115
+ base = (GLuint)NUM2UINT(arg1);
117
116
  glListBase(base);
118
117
  return Qnil;
119
118
  }
@@ -138,19 +137,25 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
138
137
  GLfloat yorig;
139
138
  GLfloat xmove;
140
139
  GLfloat ymove;
141
- const GLubyte *bitmap;
142
- width = (GLsizei)NUM2INT(arg1);
143
- height = (GLsizei)NUM2INT(arg2);
140
+ width = (GLsizei)NUM2UINT(arg1);
141
+ height = (GLsizei)NUM2UINT(arg2);
144
142
  xorig = (GLfloat)NUM2DBL(arg3);
145
143
  yorig = (GLfloat)NUM2DBL(arg4);
146
144
  xmove = (GLfloat)NUM2DBL(arg5);
147
145
  ymove = (GLfloat)NUM2DBL(arg6);
148
- if (TYPE(arg7) != T_STRING)
149
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(arg7)));
150
- if (RSTRING(arg7)->len < (width * height / 8))
151
- rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len);
152
- bitmap = (const GLubyte*)RSTRING(arg7)->ptr;
153
- glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
146
+ if (TYPE(arg7) == T_FIXNUM || TYPE(arg7) == T_BIGNUM) { /* offset to unpack buffer */
147
+ GLuint offset = NUM2UINT(arg7);
148
+ glBitmap(width, height, xorig, yorig, xmove, ymove, (GLvoid *)offset);
149
+ } else if (TYPE(arg7) == T_STRING) {
150
+ const GLubyte *bitmap;
151
+ if (RSTRING(arg7)->len < (width * height / 8))
152
+ rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len);
153
+
154
+ bitmap = (const GLubyte*)RSTRING(arg7)->ptr;
155
+ glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
156
+ } else {
157
+ Check_Type(arg7,T_STRING); /* force exception */
158
+ }
154
159
  return Qnil;
155
160
  }
156
161
 
@@ -245,9 +250,9 @@ VALUE obj,arg1,arg2,arg3;
245
250
  GLuint red;
246
251
  GLuint green;
247
252
  GLuint blue;
248
- red = (GLuint)NUM2INT(arg1);
249
- green = (GLuint)NUM2INT(arg2);
250
- blue = (GLuint)NUM2INT(arg3);
253
+ red = (GLuint)NUM2UINT(arg1);
254
+ green = (GLuint)NUM2UINT(arg2);
255
+ blue = (GLuint)NUM2UINT(arg3);
251
256
  glColor3ui(red,green,blue);
252
257
  return Qnil;
253
258
  }
@@ -370,10 +375,10 @@ VALUE obj,arg1,arg2,arg3,arg4;
370
375
  GLuint green;
371
376
  GLuint blue;
372
377
  GLuint alpha;
373
- red = (GLuint)NUM2INT(arg1);
374
- green = (GLuint)NUM2INT(arg2);
375
- blue = (GLuint)NUM2INT(arg3);
376
- alpha = (GLuint)NUM2INT(arg4);
378
+ red = (GLuint)NUM2UINT(arg1);
379
+ green = (GLuint)NUM2UINT(arg2);
380
+ blue = (GLuint)NUM2UINT(arg3);
381
+ alpha = (GLuint)NUM2UINT(arg4);
377
382
  glColor4ui(red,green,blue,alpha);
378
383
  return Qnil;
379
384
  }
@@ -409,8 +414,7 @@ gl_EdgeFlagv(obj,arg1)
409
414
  VALUE obj,arg1;
410
415
  {
411
416
  GLboolean flag[1] = { GL_FALSE };
412
- if (TYPE(arg1) != T_ARRAY)
413
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
417
+ Check_Type(arg1,T_ARRAY);
414
418
  ary2cboolean(arg1,flag,1);
415
419
  glEdgeFlagv(flag);
416
420
  return Qnil;
@@ -439,8 +443,7 @@ gl_Indexdv(obj,arg1)
439
443
  VALUE obj,arg1;
440
444
  {
441
445
  GLdouble c[1] = {0.0};
442
- if (TYPE(arg1) != T_ARRAY)
443
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
446
+ Check_Type(arg1,T_ARRAY);
444
447
  ary2cdbl(arg1,c,1);
445
448
  glIndexdv(c);
446
449
  return Qnil;
@@ -461,8 +464,7 @@ gl_Indexfv(obj,arg1)
461
464
  VALUE obj,arg1;
462
465
  {
463
466
  GLfloat c[1] = {0.0};
464
- if (TYPE(arg1) != T_ARRAY)
465
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
467
+ Check_Type(arg1,T_ARRAY);
466
468
  ary2cflt(arg1,c,1);
467
469
  glIndexfv(c);
468
470
  return Qnil;
@@ -483,8 +485,7 @@ gl_Indexiv(obj,arg1)
483
485
  VALUE obj,arg1;
484
486
  {
485
487
  GLint c[1] = {0.0};
486
- if (TYPE(arg1) != T_ARRAY)
487
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
488
+ Check_Type(arg1,T_ARRAY);
488
489
  ary2cint(arg1,c,1);
489
490
  glIndexiv(c);
490
491
  return Qnil;
@@ -505,8 +506,7 @@ gl_Indexsv(obj,arg1)
505
506
  VALUE obj,arg1;
506
507
  {
507
508
  GLshort c[1] = {0};
508
- if (TYPE(arg1) != T_ARRAY)
509
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
509
+ Check_Type(arg1,T_ARRAY);
510
510
  ary2cshort(arg1,c,1);
511
511
  glIndexsv(c);
512
512
  return Qnil;
@@ -1197,10 +1197,8 @@ VALUE obj,arg1,arg2;
1197
1197
  GLenum plane;
1198
1198
  GLdouble equation[4];
1199
1199
  plane = (GLenum)NUM2INT(arg1);
1200
- if (TYPE(arg2) == T_ARRAY)
1201
- ary2cdbl(arg2, equation, 4);
1202
- else
1203
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
1200
+ Check_Type(arg2,T_ARRAY);
1201
+ ary2cdbl(arg2, equation, 4);
1204
1202
  glClipPlane(plane,equation);
1205
1203
  return Qnil;
1206
1204
  }
@@ -1246,8 +1244,7 @@ VALUE obj,arg1,arg2;
1246
1244
  GLenum pname;
1247
1245
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1248
1246
  pname = (GLenum)NUM2INT(arg1);
1249
- if (TYPE(arg2) != T_ARRAY)
1250
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg2));
1247
+ Check_Type(arg2,T_ARRAY);
1251
1248
  ary2cflt(arg2,params,4);
1252
1249
  glFogfv(pname,params);
1253
1250
  return Qnil;
@@ -1272,8 +1269,7 @@ VALUE obj,arg1,arg2;
1272
1269
  GLenum pname;
1273
1270
  GLint params[4] = {0,0,0,0};
1274
1271
  pname = (GLenum)NUM2INT(arg1);
1275
- if (TYPE(arg2) != T_ARRAY)
1276
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg2));
1272
+ Check_Type(arg2,T_ARRAY);
1277
1273
  ary2cint(arg2,params,4);
1278
1274
  glFogiv(pname,params);
1279
1275
  return Qnil;
@@ -1295,8 +1291,8 @@ VALUE obj,arg1,arg2;
1295
1291
  {
1296
1292
  GLenum target;
1297
1293
  GLenum mode;
1298
- target = (GLenum)NUM2INT(arg1);
1299
- mode = (GLenum)NUM2INT(arg2);
1294
+ target = (GLenum)NUM2UINT(arg1);
1295
+ mode = (GLenum)NUM2UINT(arg2);
1300
1296
  glHint(target,mode);
1301
1297
  return Qnil;
1302
1298
  }
@@ -1324,8 +1320,7 @@ VALUE obj,arg1,arg2,arg3;
1324
1320
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1325
1321
  light = (GLenum)NUM2INT(arg1);
1326
1322
  pname = (GLenum)NUM2INT(arg2);
1327
- if (TYPE(arg3) != T_ARRAY)
1328
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1323
+ Check_Type(arg3,T_ARRAY);
1329
1324
  ary2cflt(arg3,params,4);
1330
1325
  glLightfv(light,pname,params);
1331
1326
  return Qnil;
@@ -1354,8 +1349,7 @@ VALUE obj,arg1,arg2,arg3;
1354
1349
  GLint params[4]={0,0,0,0};
1355
1350
  light = (GLenum)NUM2INT(arg1);
1356
1351
  pname = (GLenum)NUM2INT(arg2);
1357
- if (TYPE(arg3) != T_ARRAY)
1358
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1352
+ Check_Type(arg3,T_ARRAY);
1359
1353
  ary2cint(arg3,params,4);
1360
1354
  glLightiv(light,pname,params);
1361
1355
  return Qnil;
@@ -1380,8 +1374,7 @@ VALUE obj,arg1,arg2;
1380
1374
  GLenum pname;
1381
1375
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1382
1376
  pname = (GLenum)NUM2INT(arg1);
1383
- if (TYPE(arg2) != T_ARRAY)
1384
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg2));
1377
+ Check_Type(arg2,T_ARRAY);
1385
1378
  ary2cflt(arg2,params,4);
1386
1379
  glLightModelfv(pname,params);
1387
1380
  return Qnil;
@@ -1406,8 +1399,7 @@ VALUE obj,arg1,arg2;
1406
1399
  GLenum pname;
1407
1400
  GLint params[4] = {0,0,0,0};
1408
1401
  pname = (GLenum)NUM2INT(arg1);
1409
- if (TYPE(arg2) != T_ARRAY)
1410
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg2));
1402
+ Check_Type(arg2,T_ARRAY);
1411
1403
  ary2cint(arg2,params,4);
1412
1404
  glLightModeliv(pname,params);
1413
1405
  return Qnil;
@@ -1458,8 +1450,7 @@ VALUE obj,arg1,arg2,arg3;
1458
1450
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1459
1451
  face = (GLenum)NUM2INT(arg1);
1460
1452
  pname = (GLenum)NUM2INT(arg2);
1461
- if (TYPE(arg3) != T_ARRAY)
1462
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg3));
1453
+ Check_Type(arg3,T_ARRAY);
1463
1454
  ary2cflt(arg3,params,4);
1464
1455
  glMaterialfv(face,pname,params);
1465
1456
  return Qnil;
@@ -1488,8 +1479,7 @@ VALUE obj,arg1,arg2,arg3;
1488
1479
  GLint params[4] = {0,0,0,0};
1489
1480
  face = (GLenum)NUM2INT(arg1);
1490
1481
  pname = (GLenum)NUM2INT(arg2);
1491
- if (TYPE(arg3) != T_ARRAY)
1492
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg3));
1482
+ Check_Type(arg3,T_ARRAY);
1493
1483
  ary2cint(arg3,params,4);
1494
1484
  glMaterialiv(face,pname,params);
1495
1485
  return Qnil;
@@ -1522,13 +1512,9 @@ gl_PolygonStipple(obj,arg1)
1522
1512
  VALUE obj,arg1;
1523
1513
  {
1524
1514
  GLubyte mask[128];
1525
- RArray* ary;
1526
- int i;
1527
- memset(mask, 0x0, sizeof(GLubyte[128]));
1515
+ memset(mask, 0x0, sizeof(GLubyte)*128);
1528
1516
  if (TYPE(arg1) == T_ARRAY) {
1529
- ary = RARRAY(arg1);
1530
- for(i = 0; i < ary->len && i < 128; i++)
1531
- mask[i] = (GLubyte)NUM2INT(ary->ptr[i]);
1517
+ ary2cubyte(arg1,mask,128);
1532
1518
  }
1533
1519
  else if (TYPE(arg1) == T_STRING) {
1534
1520
  if (RSTRING(arg1)->len < 128)
@@ -1536,7 +1522,7 @@ VALUE obj,arg1;
1536
1522
  memcpy(mask, RSTRING(arg1)->ptr, 128);
1537
1523
  }
1538
1524
  else
1539
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg1));
1525
+ Check_Type(arg1,T_STRING); /* force exception */
1540
1526
  glPolygonStipple(mask);
1541
1527
  return Qnil;
1542
1528
  }
@@ -1551,8 +1537,8 @@ VALUE obj,arg1,arg2,arg3,arg4;
1551
1537
  GLsizei height;
1552
1538
  x = (GLint)NUM2INT(arg1);
1553
1539
  y = (GLint)NUM2INT(arg2);
1554
- width = (GLsizei)NUM2INT(arg3);
1555
- height = (GLsizei)NUM2INT(arg4);
1540
+ width = (GLsizei)NUM2UINT(arg3);
1541
+ height = (GLsizei)NUM2UINT(arg4);
1556
1542
  glScissor(x,y,width,height);
1557
1543
  return Qnil;
1558
1544
  }
@@ -1590,8 +1576,7 @@ VALUE obj,arg1,arg2,arg3;
1590
1576
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1591
1577
  target = (GLenum)NUM2INT(arg1);
1592
1578
  pname = (GLenum)NUM2INT(arg2);
1593
- if (TYPE(arg3) != T_ARRAY)
1594
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1579
+ Check_Type(arg3,T_ARRAY);
1595
1580
  ary2cflt(arg3,params,4);
1596
1581
  glTexParameterfv(target,pname,params);
1597
1582
  return Qnil;
@@ -1620,8 +1605,7 @@ VALUE obj,arg1,arg2,arg3;
1620
1605
  GLint params[4] = {0,0,0,0};
1621
1606
  target = (GLenum)NUM2INT(arg1);
1622
1607
  pname = (GLenum)NUM2INT(arg2);
1623
- if (TYPE(arg3) != T_ARRAY)
1624
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1608
+ Check_Type(arg3,T_ARRAY);
1625
1609
  ary2cint(arg3,params,4);
1626
1610
  glTexParameteriv(target,pname,params);
1627
1611
  return Qnil;
@@ -1646,28 +1630,34 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
1646
1630
  target = (GLenum)NUM2INT(arg1);
1647
1631
  level = (GLint)NUM2INT(arg2);
1648
1632
  components = (GLint)NUM2INT(arg3);
1649
- width = (GLsizei)NUM2INT(arg4);
1633
+ width = (GLsizei)NUM2UINT(arg4);
1650
1634
  border = (GLint)NUM2INT(arg5);
1651
1635
  format = (GLenum)NUM2INT(arg6);
1652
1636
  type = (GLenum)NUM2INT(arg7);
1653
- if (TYPE(arg8) == T_STRING) {
1654
- type_size = gltype_size(type) / 8;
1655
- format_size = glformat_size(format);
1656
- if (type_size <= 0 || format_size == -1)
1657
- return Qnil;
1658
- size = type_size*format_size*width;
1659
- if (RSTRING(arg8)->len < size)
1660
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len);
1661
- pixels = RSTRING(arg8)->ptr;
1662
- } else if (NIL_P(arg8)) {
1663
- type_size = gltype_size(type) / 8;
1664
- format_size = glformat_size(format);
1665
- if (type_size <= 0 || format_size == -1)
1666
- return Qnil;
1637
+ type_size = gltype_size(type);
1638
+ format_size = glformat_size(format);
1639
+
1640
+ if (type_size == -1 || format_size == -1)
1641
+ return Qnil;
1642
+ if (type==GL_BITMAP)
1643
+ size = format_size*(width/8);
1644
+ else
1667
1645
  size = type_size*format_size*width;
1646
+
1647
+ if (target == GL_PROXY_TEXTURE_1D || NIL_P(arg8)) { /* proxy texture, no data read */
1668
1648
  pixels = NULL;
1669
- } else
1670
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg8));
1649
+ } else {
1650
+ if (TYPE(arg8) == T_FIXNUM || TYPE(arg8) == T_BIGNUM) { /* arg8 is offset to unpack buffer */
1651
+ pixels = (const char *)NUM2UINT(arg8);
1652
+ } else if (TYPE(arg8) == T_STRING) { /* image data */
1653
+ if (RSTRING(arg8)->len < size)
1654
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len);
1655
+ pixels = RSTRING(arg8)->ptr;
1656
+ } else {
1657
+ Check_Type(arg8,T_STRING); /* force exception */
1658
+ return Qnil;
1659
+ }
1660
+ }
1671
1661
  glTexImage1D(target,level,components,width,border,format,type,pixels);
1672
1662
  return Qnil;
1673
1663
  }
@@ -1691,29 +1681,35 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
1691
1681
  target = (GLenum)NUM2INT(arg1);
1692
1682
  level = (GLint)NUM2INT(arg2);
1693
1683
  components = (GLint)NUM2INT(arg3);
1694
- width = (GLsizei)NUM2INT(arg4);
1695
- height = (GLsizei)NUM2INT(arg5);
1684
+ width = (GLsizei)NUM2UINT(arg4);
1685
+ height = (GLsizei)NUM2UINT(arg5);
1696
1686
  border = (GLint)NUM2INT(arg6);
1697
1687
  format = (GLenum)NUM2INT(arg7);
1698
1688
  type = (GLenum)NUM2INT(arg8);
1699
- if (TYPE(arg9) == T_STRING) {
1700
- type_size = gltype_size(type) / 8;
1701
- format_size = glformat_size(format);
1702
- if (type_size <= 0 || format_size == -1)
1703
- return Qnil;
1704
- size = type_size*format_size*height*width;
1705
- if (RSTRING(arg9)->len < size)
1706
- rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
1707
- pixels = RSTRING(arg9)->ptr;
1708
- } else if (NIL_P(arg9)) {
1709
- type_size = gltype_size(type) / 8;
1710
- format_size = glformat_size(format);
1711
- if (type_size <= 0 || format_size == -1)
1712
- return Qnil;
1689
+ type_size = gltype_size(type);
1690
+ format_size = glformat_size(format);
1691
+
1692
+ if (type_size == -1 || format_size == -1)
1693
+ return Qnil;
1694
+ if (type==GL_BITMAP)
1695
+ size = format_size*((height*width)/8);
1696
+ else
1713
1697
  size = type_size*format_size*height*width;
1698
+
1699
+ if (target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_CUBE_MAP || NIL_P(arg9)) { /* proxy texture, no data read */
1714
1700
  pixels = NULL;
1715
- } else
1716
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg9));
1701
+ } else {
1702
+ if (TYPE(arg9) == T_FIXNUM || TYPE(arg9) == T_BIGNUM) { /* arg9 is offset to unpack buffer */
1703
+ pixels = (const char *)NUM2UINT(arg9);
1704
+ } else if (TYPE(arg9) == T_STRING) { /* image data */
1705
+ if (RSTRING(arg9)->len < size)
1706
+ rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
1707
+ pixels = RSTRING(arg9)->ptr;
1708
+ } else {
1709
+ Check_Type(arg9,T_STRING); /* force exception */
1710
+ return Qnil;
1711
+ }
1712
+ }
1717
1713
  glTexImage2D(target,level,components,width,height,border,format,type,pixels);
1718
1714
  return Qnil;
1719
1715
  }
@@ -1741,8 +1737,7 @@ VALUE obj,arg1,arg2,arg3;
1741
1737
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1742
1738
  target = (GLenum)NUM2INT(arg1);
1743
1739
  pname = (GLenum)NUM2INT(arg2);
1744
- if (TYPE(arg3) != T_ARRAY)
1745
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1740
+ Check_Type(arg3,T_ARRAY);
1746
1741
  ary2cflt(arg3,params,4);
1747
1742
  glTexEnvfv(target,pname,params);
1748
1743
  return Qnil;
@@ -1771,8 +1766,7 @@ VALUE obj,arg1,arg2,arg3;
1771
1766
  GLint params[4] = {0,0,0,0};
1772
1767
  target = (GLenum)NUM2INT(arg1);
1773
1768
  pname = (GLenum)NUM2INT(arg2);
1774
- if (TYPE(arg3) != T_ARRAY)
1775
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1769
+ Check_Type(arg3,T_ARRAY);
1776
1770
  ary2cint(arg3,params,4);
1777
1771
  glTexEnviv(target,pname,params);
1778
1772
  return Qnil;
@@ -1801,8 +1795,7 @@ VALUE obj,arg1,arg2,arg3;
1801
1795
  GLdouble params[4] = {0.0,0.0,0.0,0.0};
1802
1796
  coord = (GLenum)NUM2INT(arg1);
1803
1797
  pname = (GLenum)NUM2INT(arg2);
1804
- if (TYPE(arg3) != T_ARRAY)
1805
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1798
+ Check_Type(arg3,T_ARRAY);
1806
1799
  ary2cdbl(arg3,params,4);
1807
1800
  glTexGendv(coord,pname,params);
1808
1801
  return Qnil;
@@ -1832,8 +1825,7 @@ VALUE obj,arg1,arg2,arg3;
1832
1825
  GLfloat params[4] = {0.0,0.0,0.0,0.0};
1833
1826
  coord = (GLenum)NUM2INT(arg1);
1834
1827
  pname = (GLenum)NUM2INT(arg2);
1835
- if (TYPE(arg3) != T_ARRAY)
1836
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1828
+ Check_Type(arg3,T_ARRAY);
1837
1829
  ary2cflt(arg3,params,4);
1838
1830
  glTexGenfv(coord,pname,params);
1839
1831
  return Qnil;
@@ -1862,34 +1854,20 @@ VALUE obj,arg1,arg2,arg3;
1862
1854
  GLint params[4] = {0,0,0,0};
1863
1855
  coord = (GLenum)NUM2INT(arg1);
1864
1856
  pname = (GLenum)NUM2INT(arg2);
1865
- if (TYPE(arg3) != T_ARRAY)
1866
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg3));
1857
+ Check_Type(arg3,T_ARRAY);
1867
1858
  ary2cint(arg3,params,4);
1868
1859
  glTexGeniv(coord,pname,params);
1869
1860
  return Qnil;
1870
1861
  }
1871
-
1872
- #define DEFAULT_BUFFER 512
1873
1862
  static VALUE g_current_feed_buffer;
1874
1863
  static VALUE
1875
- gl_FeedbackBuffer(argc, argv, obj)
1876
- int argc;
1877
- VALUE* argv;
1878
- VALUE obj;
1864
+ gl_FeedbackBuffer(obj,arg1,arg2)
1865
+ VALUE obj,arg1,arg2;
1879
1866
  {
1880
1867
  GLsizei size;
1881
1868
  GLenum type;
1882
- if (argc == 0) {
1883
- size = DEFAULT_BUFFER;
1884
- type = GL_4D_COLOR_TEXTURE;
1885
- }
1886
- else if (argc == 2) {
1887
- size = NUM2INT(argv[0]);
1888
- type = NUM2INT(argv[1]);
1889
- }
1890
- else {
1891
- rb_raise(rb_eTypeError, "GL.FeedbackBuffer");
1892
- }
1869
+ size = (GLsizei)NUM2UINT(arg1);
1870
+ type = (GLenum)NUM2INT(arg2);
1893
1871
  g_current_feed_buffer = allocate_buffer_with_string(sizeof(GLfloat)*size);
1894
1872
  rb_str_freeze(g_current_feed_buffer);
1895
1873
  glFeedbackBuffer(size, type, (GLfloat*)RSTRING(g_current_feed_buffer)->ptr);
@@ -1898,17 +1876,11 @@ VALUE obj;
1898
1876
 
1899
1877
  static VALUE g_current_sel_buffer;
1900
1878
  static VALUE
1901
- gl_SelectBuffer(argc,argv,obj)
1902
- int argc;
1903
- VALUE *argv;
1904
- VALUE obj;
1879
+ gl_SelectBuffer(obj,arg1)
1880
+ VALUE obj,arg1;
1905
1881
  {
1906
- VALUE args;
1907
1882
  GLsizei size;
1908
- size = DEFAULT_BUFFER;
1909
- rb_scan_args(argc, argv, "01", &args);
1910
- if (args != Qnil)
1911
- size = (GLsizei)NUM2INT(args);
1883
+ size = (GLsizei)NUM2UINT(arg1);
1912
1884
  g_current_sel_buffer = allocate_buffer_with_string(sizeof(GLuint)*size);
1913
1885
  rb_str_freeze(g_current_sel_buffer);
1914
1886
  glSelectBuffer(size, (GLuint*)RSTRING(g_current_sel_buffer)->ptr);
@@ -1939,7 +1911,7 @@ gl_LoadName(obj,arg1)
1939
1911
  VALUE obj,arg1;
1940
1912
  {
1941
1913
  GLuint name;
1942
- name = (GLuint)NUM2INT(arg1);
1914
+ name = (GLuint)NUM2UINT(arg1);
1943
1915
  glLoadName(name);
1944
1916
  return Qnil;
1945
1917
  }
@@ -1967,7 +1939,7 @@ gl_PushName(obj,arg1)
1967
1939
  VALUE obj,arg1;
1968
1940
  {
1969
1941
  GLuint name;
1970
- name = (GLuint)NUM2INT(arg1);
1942
+ name = (GLuint)NUM2UINT(arg1);
1971
1943
  glPushName(name);
1972
1944
  return Qnil;
1973
1945
  }
@@ -1987,7 +1959,7 @@ gl_Clear(obj,arg1)
1987
1959
  VALUE obj,arg1;
1988
1960
  {
1989
1961
  GLbitfield mask;
1990
- mask = (GLbitfield)NUM2INT(arg1);
1962
+ mask = (GLbitfield)NUM2UINT(arg1);
1991
1963
  glClear(mask);
1992
1964
  return Qnil;
1993
1965
  }
@@ -2059,7 +2031,7 @@ gl_StencilMask(obj,arg1)
2059
2031
  VALUE obj,arg1;
2060
2032
  {
2061
2033
  GLuint mask;
2062
- mask = (GLuint)NUM2INT(arg1);
2034
+ mask = (GLuint)NUM2UINT(arg1);
2063
2035
  glStencilMask(mask);
2064
2036
  return Qnil;
2065
2037
  }
@@ -2095,7 +2067,7 @@ gl_IndexMask(obj,arg1)
2095
2067
  VALUE obj,arg1;
2096
2068
  {
2097
2069
  GLuint mask;
2098
- mask = (GLuint)NUM2INT(arg1);
2070
+ mask = (GLuint)NUM2UINT(arg1);
2099
2071
  glIndexMask(mask);
2100
2072
  return Qnil;
2101
2073
  }
@@ -2161,7 +2133,7 @@ gl_PushAttrib(obj,arg1)
2161
2133
  VALUE obj,arg1;
2162
2134
  {
2163
2135
  GLbitfield mask;
2164
- mask = (GLbitfield)NUM2INT(arg1);
2136
+ mask = (GLbitfield)NUM2UINT(arg1);
2165
2137
  glPushAttrib(mask);
2166
2138
  return Qnil;
2167
2139
  }
@@ -2373,8 +2345,7 @@ gl_EvalCoord1dv(obj,arg1)
2373
2345
  VALUE obj,arg1;
2374
2346
  {
2375
2347
  GLdouble params[1] = {0.0};
2376
- if (TYPE(arg1) != T_ARRAY)
2377
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
2348
+ Check_Type(arg1,T_ARRAY);
2378
2349
  ary2cdbl(arg1,params,1);
2379
2350
  glEvalCoord1dv(params);
2380
2351
  return Qnil;
@@ -2395,8 +2366,7 @@ gl_EvalCoord1fv(obj,arg1)
2395
2366
  VALUE obj,arg1;
2396
2367
  {
2397
2368
  GLfloat params[1] = {0.0};
2398
- if (TYPE(arg1) != T_ARRAY)
2399
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
2369
+ Check_Type(arg1,T_ARRAY);
2400
2370
  ary2cflt(arg1,params,1);
2401
2371
  glEvalCoord1fv(params);
2402
2372
  return Qnil;
@@ -2419,8 +2389,7 @@ gl_EvalCoord2dv(obj,arg1)
2419
2389
  VALUE obj,arg1;
2420
2390
  {
2421
2391
  GLdouble params[2] = {0.0,0.0};
2422
- if (TYPE(arg1) != T_ARRAY)
2423
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
2392
+ Check_Type(arg1,T_ARRAY);
2424
2393
  ary2cdbl(arg1,params,2);
2425
2394
  glEvalCoord2dv(params);
2426
2395
  return Qnil;
@@ -2443,8 +2412,7 @@ gl_EvalCoord2fv(obj,arg1)
2443
2412
  VALUE obj,arg1;
2444
2413
  {
2445
2414
  GLfloat params[2] = {0.0,0.0};
2446
- if (TYPE(arg1) != T_ARRAY)
2447
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
2415
+ Check_Type(arg1,T_ARRAY);
2448
2416
  ary2cflt(arg1,params,2);
2449
2417
  glEvalCoord2fv(params);
2450
2418
  return Qnil;
@@ -2547,7 +2515,7 @@ VALUE obj,arg1,arg2,arg3;
2547
2515
  GLuint mask;
2548
2516
  func = (GLenum)NUM2INT(arg1);
2549
2517
  ref = (GLint)NUM2INT(arg2);
2550
- mask = (GLuint)NUM2INT(arg3);
2518
+ mask = (GLuint)NUM2UINT(arg3);
2551
2519
  glStencilFunc(func,ref,mask);
2552
2520
  return Qnil;
2553
2521
  }
@@ -2644,8 +2612,7 @@ VALUE obj,arg1,arg2;
2644
2612
  GLfloat *values;
2645
2613
  GLsizei size;
2646
2614
  map = (GLenum)NUM2INT(arg1);
2647
- if (TYPE(arg2) != T_ARRAY)
2648
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg2));
2615
+ Check_Type(arg2,T_ARRAY);
2649
2616
  size = RARRAY(arg2)->len;
2650
2617
  values = ALLOC_N(GLfloat,size);
2651
2618
  ary2cflt(arg2,values,size);
@@ -2662,8 +2629,7 @@ VALUE obj,arg1,arg2;
2662
2629
  GLuint *values;
2663
2630
  GLsizei size;
2664
2631
  map = (GLenum)NUM2INT(arg1);
2665
- if (TYPE(arg2) != T_ARRAY)
2666
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg2));
2632
+ Check_Type(arg2,T_ARRAY);
2667
2633
  size = RARRAY(arg2)->len;
2668
2634
  values = ALLOC_N(GLuint,size);
2669
2635
  ary2cuint(arg2,values,size);
@@ -2680,8 +2646,7 @@ VALUE obj,arg1,arg2;
2680
2646
  GLushort *values;
2681
2647
  GLsizei size;
2682
2648
  map = (GLenum)NUM2INT(arg1);
2683
- if (TYPE(arg2) != T_ARRAY)
2684
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg2));
2649
+ Check_Type(arg2,T_ARRAY);
2685
2650
  size = RARRAY(arg2)->len;
2686
2651
  values = ALLOC_N(GLushort,size);
2687
2652
  ary2cushort(arg2,values,size);
@@ -2711,8 +2676,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5;
2711
2676
  GLenum type;
2712
2677
  x = (GLint)NUM2INT(arg1);
2713
2678
  y = (GLint)NUM2INT(arg2);
2714
- width = (GLsizei)NUM2INT(arg3);
2715
- height = (GLsizei)NUM2INT(arg4);
2679
+ width = (GLsizei)NUM2UINT(arg3);
2680
+ height = (GLsizei)NUM2UINT(arg4);
2716
2681
  type = (GLenum)NUM2INT(arg5);
2717
2682
  glCopyPixels(x,y,width,height,type);
2718
2683
  return Qnil;
@@ -2729,22 +2694,29 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
2729
2694
  int format;
2730
2695
  int type;
2731
2696
  VALUE pixels;
2697
+ GLsizei type_size;
2698
+ GLsizei format_size;
2699
+ GLsizei size;
2732
2700
  x = (GLint)NUM2INT(arg1);
2733
2701
  y = (GLint)NUM2INT(arg2);
2734
- width = (GLsizei)NUM2INT(arg3);
2735
- height = (GLsizei)NUM2INT(arg4);
2702
+ width = (GLsizei)NUM2UINT(arg3);
2703
+ height = (GLsizei)NUM2UINT(arg4);
2736
2704
  format = NUM2INT(arg5);
2737
2705
  type = NUM2INT(arg6);
2738
- if (format != -1 && type != -1) {
2739
- int type_size;
2740
- int format_size;
2741
- type_size = gltype_size(type) / 8;
2742
- format_size = glformat_size(format);
2743
- pixels = allocate_buffer_with_string(width*height*format_size*type_size);
2744
- glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING(pixels)->ptr);
2745
- return pixels;
2746
- }
2747
- return Qnil;
2706
+ type_size = gltype_size(type);
2707
+ format_size = glformat_size(format);
2708
+ if (type_size == -1 || format_size == -1)
2709
+ return Qnil;
2710
+
2711
+ if (type==GL_BITMAP)
2712
+ size = format_size*((width*height)/8);
2713
+ else
2714
+ size = width*height*format_size*type_size;
2715
+ pixels = allocate_buffer_with_string(size);
2716
+ FORCE_PIXEL_STORE_MODE
2717
+ glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING(pixels)->ptr);
2718
+ RESTORE_PIXEL_STORE_MODE
2719
+ return pixels;
2748
2720
  }
2749
2721
 
2750
2722
  static VALUE
@@ -2756,18 +2728,26 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5;
2756
2728
  GLenum format;
2757
2729
  GLenum type;
2758
2730
  const char *pixels;
2759
- width = (GLsizei)NUM2INT(arg1);
2760
- height = (GLsizei)NUM2INT(arg2);
2731
+ GLsizei size;
2732
+ GLsizei type_size;
2733
+ GLsizei format_size;
2734
+ width = (GLsizei)NUM2UINT(arg1);
2735
+ height = (GLsizei)NUM2UINT(arg2);
2761
2736
  format = (GLenum)NUM2INT(arg3);
2762
2737
  type = (GLenum)NUM2INT(arg4);
2763
- if (format != -1 && type != -1) {
2764
- if (TYPE(arg5) != T_STRING)
2765
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg5));
2766
- if (RSTRING(arg5)->len < width * height * glformat_size(format) * gltype_size(type) / 8)
2767
- rb_raise(rb_eArgError, "string length:%d", RSTRING(arg5)->len);
2768
- pixels = RSTRING(arg5)->ptr;
2769
- glDrawPixels(width,height,format,type,pixels);
2770
- }
2738
+ Check_Type(arg5,T_STRING);
2739
+ type_size = gltype_size(type);
2740
+ format_size = glformat_size(format);
2741
+ if (type_size == -1 || format_size == -1)
2742
+ rb_raise(rb_eArgError, "type/format mismatch");
2743
+ if (type==GL_BITMAP)
2744
+ size = format_size*(width/8);
2745
+ else
2746
+ size = type_size*format_size*width*height;
2747
+ if (RSTRING(arg5)->len < size)
2748
+ rb_raise(rb_eArgError, "string length:%d", RSTRING(arg5)->len);
2749
+ pixels = RSTRING(arg5)->ptr;
2750
+ glDrawPixels(width,height,format,type,pixels);
2771
2751
  return Qnil;
2772
2752
  }
2773
2753
 
@@ -2951,7 +2931,7 @@ VALUE obj,arg1,arg2;
2951
2931
  glGetLightiv(light,pname,params);
2952
2932
  retary = rb_ary_new2(size);
2953
2933
  for(i=0;i<size;i++)
2954
- rb_ary_push(retary, INT2FIX(params[i]));
2934
+ rb_ary_push(retary, INT2NUM(params[i]));
2955
2935
  return retary;
2956
2936
  }
2957
2937
 
@@ -3133,7 +3113,7 @@ VALUE obj,arg1,arg2;
3133
3113
  glGetMapiv(target,query,points);
3134
3114
  retary = rb_ary_new2(size);
3135
3115
  for(i=0;i<size;i++)
3136
- rb_ary_push(retary, INT2FIX(points[i]));
3116
+ rb_ary_push(retary, INT2NUM(points[i]));
3137
3117
  xfree(points);
3138
3118
  return retary;
3139
3119
  }
@@ -3170,7 +3150,7 @@ VALUE obj,arg1,arg2;
3170
3150
  glGetMaterialfv(face,pname,params);
3171
3151
  retary = rb_ary_new2(size);
3172
3152
  for(i=0;i<size;i++)
3173
- rb_ary_push(retary, rb_ary_new2(params[i]));
3153
+ rb_ary_push(retary, rb_float_new(params[i]));
3174
3154
  return retary;
3175
3155
  }
3176
3156
 
@@ -3206,7 +3186,7 @@ VALUE obj,arg1,arg2;
3206
3186
  glGetMaterialiv(face,pname,params);
3207
3187
  retary = rb_ary_new2(size);
3208
3188
  for(i=0;i<size;i++)
3209
- rb_ary_push(retary, INT2FIX(params[i]));
3189
+ rb_ary_push(retary, INT2NUM(params[i]));
3210
3190
  return retary;
3211
3191
  }
3212
3192
 
@@ -3216,7 +3196,7 @@ VALUE obj,arg1;
3216
3196
  {
3217
3197
  GLenum map;
3218
3198
  GLenum map_size;
3219
- GLint size;
3199
+ GLint size = 0;
3220
3200
  GLfloat *values;
3221
3201
  VALUE retary;
3222
3202
  int i;
@@ -3252,7 +3232,7 @@ VALUE obj,arg1;
3252
3232
  {
3253
3233
  GLenum map;
3254
3234
  GLenum map_size;
3255
- GLint size;
3235
+ GLint size = 0;
3256
3236
  GLuint *values;
3257
3237
  VALUE retary;
3258
3238
  int i;
@@ -3277,7 +3257,7 @@ VALUE obj,arg1;
3277
3257
  glGetPixelMapuiv(map,values);
3278
3258
  retary = rb_ary_new2(size);
3279
3259
  for(i=0;i<size;i++)
3280
- rb_ary_push(retary, INT2FIX(values[i]));
3260
+ rb_ary_push(retary, INT2NUM(values[i]));
3281
3261
  xfree(values);
3282
3262
  return retary;
3283
3263
  }
@@ -3288,7 +3268,7 @@ VALUE obj,arg1;
3288
3268
  {
3289
3269
  GLenum map;
3290
3270
  GLenum map_size;
3291
- GLint size;
3271
+ GLint size = 0;
3292
3272
  GLushort *values;
3293
3273
  VALUE retary;
3294
3274
  int i;
@@ -3313,17 +3293,20 @@ VALUE obj,arg1;
3313
3293
  glGetPixelMapusv(map,values);
3314
3294
  retary = rb_ary_new2(size);
3315
3295
  for(i=0;i<size;i++)
3316
- rb_ary_push(retary, INT2FIX(values[i]));
3296
+ rb_ary_push(retary, INT2NUM(values[i]));
3317
3297
  xfree(values);
3318
3298
  return retary;
3319
3299
  }
3320
3300
 
3321
3301
  static VALUE
3322
- gl_GetPolygonStipple(obj,arg1)
3323
- VALUE obj,arg1;
3302
+ gl_GetPolygonStipple(obj)
3303
+ VALUE obj;
3324
3304
  {
3325
3305
  GLubyte mask[128];
3306
+ memset(mask, 0x0, sizeof(GLubyte)*128);
3307
+ FORCE_PIXEL_STORE_MODE
3326
3308
  glGetPolygonStipple(mask);
3309
+ RESTORE_PIXEL_STORE_MODE
3327
3310
  return rb_str_new((const char*)mask, 128);
3328
3311
  }
3329
3312
 
@@ -3382,7 +3365,7 @@ VALUE obj,arg1,arg2;
3382
3365
  glGetTexEnvfv(target,pname,params);
3383
3366
  retary = rb_ary_new2(size);
3384
3367
  for(i=0;i<size;i++)
3385
- rb_ary_push(retary, rb_ary_new2(params[i]));
3368
+ rb_ary_push(retary, rb_float_new(params[i]));
3386
3369
  return retary;
3387
3370
  }
3388
3371
 
@@ -3430,7 +3413,7 @@ VALUE obj,arg1,arg2;
3430
3413
  glGetTexEnviv(target,pname,params);
3431
3414
  retary = rb_ary_new2(size);
3432
3415
  for(i=0;i<size;i++)
3433
- rb_ary_push(retary, INT2FIX(params[i]));
3416
+ rb_ary_push(retary, INT2NUM(params[i]));
3434
3417
  return retary;
3435
3418
  }
3436
3419
 
@@ -3461,7 +3444,7 @@ VALUE obj,arg1,arg2;
3461
3444
  glGetTexGendv(coord,pname,params);
3462
3445
  retary = rb_ary_new2(size);
3463
3446
  for(i=0;i<size;i++)
3464
- rb_ary_push(retary, rb_ary_new2(params[i]));
3447
+ rb_ary_push(retary, rb_float_new(params[i]));
3465
3448
  return retary;
3466
3449
  }
3467
3450
 
@@ -3492,7 +3475,7 @@ VALUE obj,arg1,arg2;
3492
3475
  glGetTexGenfv(coord,pname,params);
3493
3476
  retary = rb_ary_new2(size);
3494
3477
  for(i=0;i<size;i++)
3495
- rb_ary_push(retary, rb_ary_new2(params[i]));
3478
+ rb_ary_push(retary, rb_float_new(params[i]));
3496
3479
  return retary;
3497
3480
  }
3498
3481
 
@@ -3523,19 +3506,61 @@ VALUE obj,arg1,arg2;
3523
3506
  glGetTexGeniv(coord,pname,params);
3524
3507
  retary = rb_ary_new2(size);
3525
3508
  for(i=0;i<size;i++)
3526
- rb_ary_push(retary, INT2FIX(params[i]));
3509
+ rb_ary_push(retary, INT2NUM(params[i]));
3527
3510
  return retary;
3528
3511
  }
3529
3512
 
3530
- /*
3513
+
3531
3514
  static VALUE
3532
- gl_GetTexImage(obj,arg1,arg2,arg3,arg4,arg5)
3533
- VALUE obj,arg1,arg2,arg3,arg4,arg5;
3515
+ gl_GetTexImage(obj,arg1,arg2,arg3,arg4)
3516
+ VALUE obj,arg1,arg2,arg3,arg4;
3534
3517
  {
3535
- #warning glGetTexImage not implemented
3536
- return Qnil;
3518
+ GLenum tex;
3519
+ GLint lod;
3520
+ GLenum format;
3521
+ GLenum type;
3522
+ GLint width = 0;
3523
+ GLint height = 0;
3524
+ GLint depth = 0;
3525
+ GLint size;
3526
+ GLint format_size;
3527
+ GLint type_size;
3528
+ VALUE pixels;
3529
+ tex = (GLenum)NUM2INT(arg1);
3530
+ lod = (GLint)NUM2INT(arg2);
3531
+ format = (GLenum)NUM2INT(arg3);
3532
+ type = (GLenum)NUM2INT(arg4);
3533
+ format_size = glformat_size(format);
3534
+ type_size = gltype_size(type);
3535
+ if (type_size == -1 && format_size == -1)
3536
+ return Qnil;
3537
+
3538
+ size = 1;
3539
+ switch(tex) {
3540
+ case GL_TEXTURE_3D:
3541
+ glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_DEPTH,&depth);
3542
+ size *= depth;
3543
+ /* fall through */
3544
+ case GL_TEXTURE_2D:
3545
+ glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_HEIGHT,&height);
3546
+ size *= height;
3547
+ /* fall through */
3548
+ case GL_TEXTURE_1D:
3549
+ glGetTexLevelParameteriv(tex,lod,GL_TEXTURE_WIDTH,&width);
3550
+ size *= width;
3551
+ break;
3552
+ default:
3553
+ return Qnil;
3554
+ }
3555
+ size *= format_size*type_size;
3556
+ pixels = allocate_buffer_with_string(size);
3557
+
3558
+ FORCE_PIXEL_STORE_MODE
3559
+ glGetTexImage(tex,lod,format,type,(GLvoid*)RSTRING(pixels)->ptr);
3560
+ RESTORE_PIXEL_STORE_MODE
3561
+ return pixels;
3537
3562
  }
3538
- */
3563
+
3539
3564
 
3540
3565
  static VALUE
3541
3566
  gl_GetTexParameterfv(obj,arg1,arg2)
@@ -3587,7 +3612,7 @@ VALUE obj,arg1,arg2;
3587
3612
  glGetTexParameteriv(target,pname,params);
3588
3613
  retary = rb_ary_new2(size);
3589
3614
  for(i=0;i<size;i++)
3590
- rb_ary_push(retary, INT2FIX(params[i]));
3615
+ rb_ary_push(retary, INT2NUM(params[i]));
3591
3616
  return retary;
3592
3617
  }
3593
3618
 
@@ -3598,7 +3623,7 @@ VALUE obj,arg1,arg2,arg3;
3598
3623
  GLenum target;
3599
3624
  GLint level;
3600
3625
  GLenum pname;
3601
- GLfloat params;
3626
+ GLfloat params = 0.0;
3602
3627
  VALUE retary;
3603
3628
  target = (GLenum)NUM2INT(arg1);
3604
3629
  level = (GLint)NUM2INT(arg2);
@@ -3616,14 +3641,14 @@ VALUE obj,arg1,arg2,arg3;
3616
3641
  GLenum target;
3617
3642
  GLint level;
3618
3643
  GLenum pname;
3619
- GLint params;
3644
+ GLint params = 0;
3620
3645
  VALUE retary;
3621
3646
  target = (GLenum)NUM2INT(arg1);
3622
3647
  level = (GLint)NUM2INT(arg2);
3623
3648
  pname = (GLenum)NUM2INT(arg3);
3624
3649
  glGetTexLevelParameteriv(target,level,pname,&params);
3625
3650
  retary = rb_ary_new2(1);
3626
- rb_ary_push(retary, INT2FIX(params));
3651
+ rb_ary_push(retary, INT2NUM(params));
3627
3652
  return retary;
3628
3653
  }
3629
3654
 
@@ -3644,7 +3669,7 @@ VALUE obj,arg1;
3644
3669
  {
3645
3670
  GLuint list;
3646
3671
  GLboolean ret;
3647
- list = (GLuint)NUM2INT(arg1);
3672
+ list = (GLuint)NUM2UINT(arg1);
3648
3673
  ret = glIsList(list);
3649
3674
  return INT2NUM(ret);
3650
3675
  }
@@ -3873,8 +3898,8 @@ VALUE obj,arg1,arg2,arg3,arg4;
3873
3898
  GLsizei height;
3874
3899
  x = (GLint)NUM2INT(arg1);
3875
3900
  y = (GLint)NUM2INT(arg2);
3876
- width = (GLsizei)NUM2INT(arg3);
3877
- height = (GLsizei)NUM2INT(arg4);
3901
+ width = (GLsizei)NUM2UINT(arg3);
3902
+ height = (GLsizei)NUM2UINT(arg4);
3878
3903
  glViewport(x,y,width,height);
3879
3904
  return Qnil;
3880
3905
  }
@@ -3891,12 +3916,12 @@ VALUE obj,arg1;
3891
3916
 
3892
3917
  static VALUE g_Vertex_ptr;
3893
3918
  static VALUE g_Normal_ptr;
3894
- static VALUE g_Color_ptr;
3895
- static VALUE g_Index_ptr;
3896
- static VALUE g_TexCoord_ptr;
3897
- static VALUE g_EdgeFlag_ptr;
3898
- VALUE g_FogCoord_ptr = 0;
3899
- VALUE g_SecondaryColor_ptr = 0;
3919
+ static VALUE g_Color_ptr;
3920
+ static VALUE g_Index_ptr;
3921
+ static VALUE g_TexCoord_ptr;
3922
+ static VALUE g_EdgeFlag_ptr;
3923
+ VALUE g_FogCoord_ptr; /* OpenGL 1.4 */
3924
+ VALUE g_SecondaryColor_ptr; /* OpenGL 1.4 */
3900
3925
  #define POINTER_FUNC(_func_) \
3901
3926
  static VALUE \
3902
3927
  gl_##_func_##Pointer(obj, arg1, arg2, arg3, arg4) \
@@ -3907,7 +3932,7 @@ VALUE obj, arg1, arg2, arg3, arg4; \
3907
3932
  GLsizei stride; \
3908
3933
  size = (GLint)NUM2INT(arg1); \
3909
3934
  type = (GLenum)NUM2INT(arg2); \
3910
- stride = (GLsizei)NUM2INT(arg3); \
3935
+ stride = (GLsizei)NUM2UINT(arg3); \
3911
3936
  Check_Type(arg4, T_STRING); \
3912
3937
  rb_str_freeze(arg4); \
3913
3938
  g_##_func_##_ptr = arg4; \
@@ -3940,7 +3965,7 @@ VALUE obj,arg1,arg2,arg3;
3940
3965
  GLsizei count;
3941
3966
  mode = (GLenum)NUM2INT(arg1);
3942
3967
  first = (GLint)NUM2INT(arg2);
3943
- count = (GLsizei)NUM2INT(arg3);
3968
+ count = (GLsizei)NUM2UINT(arg3);
3944
3969
  glDrawArrays(mode,first,count);
3945
3970
  return Qnil;
3946
3971
  }
@@ -3953,7 +3978,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
3953
3978
  GLsizei count;
3954
3979
  GLenum type;
3955
3980
  mode = (GLenum)NUM2INT(arg1);
3956
- count = (GLsizei)NUM2INT(arg2);
3981
+ count = (GLsizei)NUM2UINT(arg2);
3957
3982
  type = (GLenum)NUM2INT(arg3);
3958
3983
  Check_Type(arg4, T_STRING);
3959
3984
  glDrawElements(mode, count, type, (const GLvoid*)RSTRING(arg4)->ptr);
@@ -3965,7 +3990,7 @@ gl_EdgeFlagPointer(obj,arg1,arg2)
3965
3990
  VALUE obj,arg1,arg2;
3966
3991
  {
3967
3992
  GLsizei stride;
3968
- stride = (GLsizei)NUM2INT(arg1);
3993
+ stride = (GLsizei)NUM2UINT(arg1);
3969
3994
  Check_Type(arg2, T_STRING);
3970
3995
  rb_str_freeze(arg2);
3971
3996
  g_EdgeFlag_ptr = arg2;
@@ -3984,8 +4009,8 @@ VALUE obj,arg1;
3984
4009
  }
3985
4010
 
3986
4011
  static VALUE
3987
- gl_GetPointerv(obj,arg1,arg2)
3988
- VALUE obj,arg1,arg2;
4012
+ gl_GetPointerv(obj,arg1)
4013
+ VALUE obj,arg1;
3989
4014
  {
3990
4015
  GLenum pname;
3991
4016
  pname = (GLenum)NUM2INT(arg1);
@@ -4006,6 +4031,10 @@ VALUE obj,arg1,arg2;
4006
4031
  return g_FogCoord_ptr;
4007
4032
  case GL_SECONDARY_COLOR_ARRAY_POINTER:
4008
4033
  return g_SecondaryColor_ptr;
4034
+ case GL_FEEDBACK_BUFFER_POINTER:
4035
+ return g_current_feed_buffer;
4036
+ case GL_SELECTION_BUFFER_POINTER:
4037
+ return g_current_sel_buffer;
4009
4038
  default:
4010
4039
  rb_raise(rb_eArgError, "Invalid pname %d",pname);
4011
4040
  break; /* not reached */
@@ -4020,7 +4049,7 @@ VALUE obj,arg1,arg2,arg3;
4020
4049
  GLenum type;
4021
4050
  GLsizei stride;
4022
4051
  type = (GLenum)NUM2INT(arg1);
4023
- stride = (GLsizei)NUM2INT(arg2);
4052
+ stride = (GLsizei)NUM2UINT(arg2);
4024
4053
  Check_Type(arg3, T_STRING);
4025
4054
  rb_str_freeze(arg3);
4026
4055
  g_Index_ptr = arg3;
@@ -4035,7 +4064,7 @@ VALUE obj,arg1,arg2,arg3;
4035
4064
  GLenum format;
4036
4065
  GLsizei stride;
4037
4066
  format = (GLenum)NUM2INT(arg1);
4038
- stride = (GLsizei)NUM2INT(arg2);
4067
+ stride = (GLsizei)NUM2UINT(arg2);
4039
4068
  Check_Type(arg3, T_STRING);
4040
4069
  glInterleavedArrays(format, stride, (const GLvoid*)RSTRING(arg3)->ptr);
4041
4070
  return Qnil;
@@ -4048,7 +4077,7 @@ VALUE obj,arg1,arg2,arg3;
4048
4077
  GLenum type;
4049
4078
  GLsizei stride;
4050
4079
  type = (GLenum)NUM2INT(arg1);
4051
- stride = (GLsizei)NUM2INT(arg2);
4080
+ stride = (GLsizei)NUM2UINT(arg2);
4052
4081
  Check_Type(arg3, T_STRING);
4053
4082
  rb_str_freeze(arg3);
4054
4083
  g_Normal_ptr = arg3;
@@ -4084,7 +4113,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
4084
4113
  internalformat = (GLenum)NUM2INT(arg3);
4085
4114
  x = (GLint)NUM2INT(arg4);
4086
4115
  y = (GLint)NUM2INT(arg5);
4087
- width = (GLsizei)NUM2INT(arg6);
4116
+ width = (GLsizei)NUM2UINT(arg6);
4088
4117
  border = (GLint)NUM2INT(arg7);
4089
4118
  glCopyTexImage1D(target,level,internalformat,x,y,width,border);
4090
4119
  return Qnil;
@@ -4107,8 +4136,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
4107
4136
  internalformat = (GLenum)NUM2INT(arg3);
4108
4137
  x = (GLint)NUM2INT(arg4);
4109
4138
  y = (GLint)NUM2INT(arg5);
4110
- width = (GLsizei)NUM2INT(arg6);
4111
- height = (GLsizei)NUM2INT(arg7);
4139
+ width = (GLsizei)NUM2UINT(arg6);
4140
+ height = (GLsizei)NUM2UINT(arg7);
4112
4141
  border = (GLint)NUM2INT(arg8);
4113
4142
  glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
4114
4143
  return Qnil;
@@ -4129,7 +4158,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
4129
4158
  xoffset = (GLint)NUM2INT(arg3);
4130
4159
  x = (GLint)NUM2INT(arg4);
4131
4160
  y = (GLint)NUM2INT(arg5);
4132
- width = (GLsizei)NUM2INT(arg6);
4161
+ width = (GLsizei)NUM2UINT(arg6);
4133
4162
  glCopyTexSubImage1D(target,level,xoffset,x,y,width);
4134
4163
  return Qnil;
4135
4164
  }
@@ -4152,8 +4181,8 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
4152
4181
  yoffset = (GLint)NUM2INT(arg4);
4153
4182
  x = (GLint)NUM2INT(arg5);
4154
4183
  y = (GLint)NUM2INT(arg6);
4155
- width = (GLsizei)NUM2INT(arg7);
4156
- height = (GLsizei)NUM2INT(arg8);
4184
+ width = (GLsizei)NUM2UINT(arg7);
4185
+ height = (GLsizei)NUM2UINT(arg8);
4157
4186
  glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
4158
4187
  return Qnil;
4159
4188
  }
@@ -4175,20 +4204,29 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
4175
4204
  target = (GLenum)NUM2INT(arg1);
4176
4205
  level = (GLint)NUM2INT(arg2);
4177
4206
  xoffset = (GLint)NUM2INT(arg3);
4178
- width = (GLsizei)NUM2INT(arg4);
4207
+ width = (GLsizei)NUM2UINT(arg4);
4179
4208
  format = (GLenum)NUM2INT(arg5);
4180
4209
  type = (GLenum)NUM2INT(arg6);
4181
- if (TYPE(arg7) == T_STRING) {
4182
- type_size = gltype_size(type) / 8;
4183
- format_size = glformat_size(format);
4184
- if (type_size < 0 || format_size == -1)
4185
- return Qnil;
4210
+ type_size = gltype_size(type);
4211
+ format_size = glformat_size(format);
4212
+ if (type_size == -1 || format_size == -1)
4213
+ return Qnil;
4214
+
4215
+ if (type==GL_BITMAP)
4216
+ size = format_size*(width/8);
4217
+ else
4186
4218
  size = type_size*format_size*width;
4219
+
4220
+ if (TYPE(arg7) == T_STRING) {
4187
4221
  if (RSTRING(arg7)->len < size)
4188
4222
  rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
4189
4223
  pixels = RSTRING(arg7)->ptr;
4190
- } else
4191
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg7));
4224
+ } else if (TYPE(arg7) == T_FIXNUM || TYPE(arg7) == T_BIGNUM) { /* arg7 is offset to unpack buffer */
4225
+ pixels = (const char *)NUM2UINT(arg7);
4226
+ } else {
4227
+ Check_Type(arg7,T_STRING); /* force exception */
4228
+ return Qnil;
4229
+ }
4192
4230
  glTexSubImage1D(target,level,xoffset,width,format,type,pixels);
4193
4231
  return Qnil;
4194
4232
  }
@@ -4213,21 +4251,28 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
4213
4251
  level = (GLint)NUM2INT(arg2);
4214
4252
  xoffset = (GLint)NUM2INT(arg3);
4215
4253
  yoffset = (GLint)NUM2INT(arg4);
4216
- width = (GLsizei)NUM2INT(arg5);
4217
- height = (GLsizei)NUM2INT(arg6);
4254
+ width = (GLsizei)NUM2UINT(arg5);
4255
+ height = (GLsizei)NUM2UINT(arg6);
4218
4256
  format = (GLenum)NUM2INT(arg7);
4219
4257
  type = (GLenum)NUM2INT(arg8);
4220
- if (TYPE(arg9) == T_STRING) {
4221
- type_size = gltype_size(type) / 8;
4222
- format_size = glformat_size(format);
4223
- if (type_size < 0 || format_size == -1)
4224
- return Qnil;
4258
+ type_size = gltype_size(type);
4259
+ format_size = glformat_size(format);
4260
+ if (type_size == -1 || format_size == -1)
4261
+ return Qnil;
4262
+ if (type==GL_BITMAP)
4263
+ size = format_size*((height*width)/8);
4264
+ else
4225
4265
  size = type_size*format_size*height*width;
4266
+ if (TYPE(arg9) == T_STRING) {
4226
4267
  if (RSTRING(arg9)->len < size)
4227
4268
  rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
4228
4269
  pixels = RSTRING(arg9)->ptr;
4229
- } else
4230
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg9));
4270
+ } else if (TYPE(arg9) == T_FIXNUM || TYPE(arg9) == T_BIGNUM) { /* arg9 is offset to unpack buffer */
4271
+ pixels = (const char *)NUM2UINT(arg9);
4272
+ } else {
4273
+ Check_Type(arg9,T_STRING); /* force exception */
4274
+ return Qnil;
4275
+ }
4231
4276
  glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
4232
4277
  return Qnil;
4233
4278
  }
@@ -4242,8 +4287,7 @@ VALUE obj,arg1;
4242
4287
  GLboolean r;
4243
4288
  VALUE retary;
4244
4289
  int i;
4245
- if (TYPE(arg1) != T_ARRAY)
4246
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg1));
4290
+ Check_Type(arg1,T_ARRAY);
4247
4291
  size = RARRAY(arg1)->len;
4248
4292
  textures = ALLOC_N(GLuint,size);
4249
4293
  residences = ALLOC_N(GLboolean,size);
@@ -4252,10 +4296,10 @@ VALUE obj,arg1;
4252
4296
  retary = rb_ary_new2(size);
4253
4297
  if (r==GL_TRUE) { /* all are resident */
4254
4298
  for(i=0;i<size;i++)
4255
- rb_ary_push(retary, INT2FIX(GL_TRUE));
4299
+ rb_ary_push(retary, INT2NUM(GL_TRUE));
4256
4300
  } else {
4257
4301
  for(i=0;i<size;i++)
4258
- rb_ary_push(retary, INT2FIX(residences[i]));
4302
+ rb_ary_push(retary, INT2NUM(residences[i]));
4259
4303
  }
4260
4304
  xfree(textures);
4261
4305
  xfree(residences);
@@ -4269,7 +4313,7 @@ VALUE obj,arg1,arg2;
4269
4313
  GLenum target;
4270
4314
  GLuint texture;
4271
4315
  target = (GLenum)NUM2INT(arg1);
4272
- texture = (GLuint)NUM2INT(arg2);
4316
+ texture = (GLuint)NUM2UINT(arg2);
4273
4317
  glBindTexture(target,texture);
4274
4318
  return Qnil;
4275
4319
  }
@@ -4280,11 +4324,8 @@ VALUE obj,arg1;
4280
4324
  {
4281
4325
  GLsizei n;
4282
4326
  GLuint *textures;
4283
- RArray *ary;
4284
- if (TYPE(arg1) != T_ARRAY)
4285
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg1));
4286
- ary = RARRAY(arg1);
4287
- n = ary->len;
4327
+ Check_Type(arg1,T_ARRAY);
4328
+ n = RARRAY(arg1)->len;
4288
4329
  textures = ALLOC_N(GLuint,n);
4289
4330
  ary2cuint(arg1,textures,n);
4290
4331
  glDeleteTextures( n, textures);
@@ -4300,7 +4341,7 @@ VALUE obj,arg1;
4300
4341
  GLuint *textures;
4301
4342
  RArray *ret;
4302
4343
  int i;
4303
- n = (GLsizei)NUM2INT(arg1);
4344
+ n = (GLsizei)NUM2UINT(arg1);
4304
4345
  textures = ALLOC_N(GLuint, n);
4305
4346
  glGenTextures(n, textures);
4306
4347
  ret = RARRAY(rb_ary_new2(n));
@@ -4316,7 +4357,7 @@ VALUE obj,arg1;
4316
4357
  {
4317
4358
  GLuint texture;
4318
4359
  GLboolean ret;
4319
- texture = (GLuint)NUM2INT(arg1);
4360
+ texture = (GLuint)NUM2UINT(arg1);
4320
4361
  ret = glIsTexture(texture);
4321
4362
  return INT2NUM(ret);
4322
4363
  }
@@ -4328,10 +4369,8 @@ VALUE obj,arg1,arg2;
4328
4369
  GLuint *textures;
4329
4370
  GLclampf *priorities;
4330
4371
  GLsizei size;
4331
- if (TYPE(arg1) != T_ARRAY)
4332
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg1));
4333
- if (TYPE(arg2) != T_ARRAY)
4334
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(arg2));
4372
+ Check_Type(arg1,T_ARRAY);
4373
+ Check_Type(arg2,T_ARRAY);
4335
4374
  if ((size = RARRAY(arg1)->len) != RARRAY(arg2)->len)
4336
4375
  rb_raise(rb_eArgError, "passed arrays must have the same length");
4337
4376
  textures = ALLOC_N(GLuint,size);
@@ -4359,8 +4398,7 @@ gl_Indexubv(obj,arg1)
4359
4398
  VALUE obj,arg1;
4360
4399
  {
4361
4400
  GLubyte c[1] = {0};
4362
- if (TYPE(arg1) != T_ARRAY)
4363
- rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg1));
4401
+ Check_Type(arg1,T_ARRAY);
4364
4402
  ary2cubyte(arg1,c,1);
4365
4403
  glIndexubv(c);
4366
4404
  return Qnil;
@@ -4379,7 +4417,7 @@ gl_PushClientAttrib(obj,arg1)
4379
4417
  VALUE obj,arg1;
4380
4418
  {
4381
4419
  GLbitfield mask;
4382
- mask = (GLbitfield)NUM2INT(arg1);
4420
+ mask = (GLbitfield)NUM2UINT(arg1);
4383
4421
  glPushClientAttrib(mask);
4384
4422
  return Qnil;
4385
4423
  }
@@ -4412,7 +4450,7 @@ VALUE obj; \
4412
4450
  } \
4413
4451
  } \
4414
4452
  else \
4415
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(args[0]))); \
4453
+ Check_Type(args[0],T_ARRAY); /* force exception */ \
4416
4454
  break; \
4417
4455
  case 3: \
4418
4456
  gl_Color3##_type_(obj,args[0], args[1], args[2]); \
@@ -4459,7 +4497,7 @@ VALUE obj; \
4459
4497
  } \
4460
4498
  } \
4461
4499
  else \
4462
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(args[0]))); \
4500
+ Check_Type(args[0],T_ARRAY); /* force exception */ \
4463
4501
  break; \
4464
4502
  case 3: \
4465
4503
  gl_Normal3##_type_(obj,args[0], args[1], args[2]); \
@@ -4506,7 +4544,7 @@ VALUE obj; \
4506
4544
  } \
4507
4545
  } \
4508
4546
  else \
4509
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(args[0]))); \
4547
+ Check_Type(args[0],T_ARRAY); /* force exception */ \
4510
4548
  break; \
4511
4549
  case 2: \
4512
4550
  gl_RasterPos2##_type_(obj,args[0], args[1]); \
@@ -4538,21 +4576,22 @@ VALUE obj; \
4538
4576
  { \
4539
4577
  int num; \
4540
4578
  VALUE args[4]; \
4541
- RArray *ary; \
4542
- switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \
4543
- case 1: \
4544
- if (TYPE(args[0]) == T_ARRAY) { \
4579
+ RArray *ary,*ary2; \
4580
+ switch (num = rb_scan_args(argc, argv, "22", &args[0], &args[1], &args[2], &args[3])) { \
4581
+ case 2: \
4582
+ if (TYPE(args[0]) == T_ARRAY && TYPE(args[1]) == T_ARRAY) { \
4545
4583
  ary = RARRAY(args[0]); \
4584
+ ary2 = RARRAY(args[1]); \
4546
4585
  switch (ary->len) { \
4547
- case 4: \
4548
- gl_Rect##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \
4586
+ case 2: \
4587
+ gl_Rect##_type_(obj,ary->ptr[0],ary->ptr[1],ary2->ptr[0],ary2->ptr[1]); \
4549
4588
  break; \
4550
4589
  default: \
4551
4590
  rb_raise(rb_eArgError, "array length:%d", ary->len); \
4552
4591
  } \
4553
4592
  } \
4554
4593
  else \
4555
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(args[0]))); \
4594
+ Check_Type(args[0],T_ARRAY); /* force exception */ \
4556
4595
  break; \
4557
4596
  case 4: \
4558
4597
  gl_Rect##_type_(obj,args[0], args[1], args[2], args[3]); \
@@ -4584,6 +4623,9 @@ VALUE obj; \
4584
4623
  if (TYPE(args[0]) == T_ARRAY) { \
4585
4624
  ary = RARRAY(args[0]); \
4586
4625
  switch (ary->len) { \
4626
+ case 1: \
4627
+ gl_TexCoord1##_type_(obj,ary->ptr[0]); \
4628
+ break; \
4587
4629
  case 2: \
4588
4630
  gl_TexCoord2##_type_(obj,ary->ptr[0],ary->ptr[1]); \
4589
4631
  break; \
@@ -4598,7 +4640,7 @@ VALUE obj; \
4598
4640
  } \
4599
4641
  } \
4600
4642
  else \
4601
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(args[0]))); \
4643
+ gl_TexCoord1##_type_(obj,args[0]); \
4602
4644
  break; \
4603
4645
  case 2: \
4604
4646
  gl_TexCoord2##_type_(obj,args[0], args[1]); \
@@ -4650,7 +4692,7 @@ VALUE obj; \
4650
4692
  } \
4651
4693
  } \
4652
4694
  else \
4653
- rb_raise(rb_eTypeError, "type mismatch:%s", rb_class2name(CLASS_OF(args[0]))); \
4695
+ Check_Type(args[0],T_ARRAY); /* force exception */ \
4654
4696
  break; \
4655
4697
  case 2: \
4656
4698
  gl_Vertex2##_type_(obj,args[0], args[1]); \
@@ -4763,6 +4805,9 @@ VALUE obj,arg1,arg2,arg3;
4763
4805
  /* init */
4764
4806
  void gl_init_functions_1_0__1_1(VALUE module)
4765
4807
  {
4808
+ g_FogCoord_ptr = 0; /* for use in gl-1.4.c */
4809
+ g_SecondaryColor_ptr = 0; /* for use in gl-1.4.c */
4810
+
4766
4811
  /* OpenGL 1.0 functions */
4767
4812
  rb_define_module_function(module, "glNewList", gl_NewList, 2);
4768
4813
  rb_define_module_function(module, "glEndList", gl_EndList, 0);
@@ -4893,8 +4938,8 @@ void gl_init_functions_1_0__1_1(VALUE module)
4893
4938
  rb_define_module_function(module, "glTexGenfv", gl_TexGenfv, 3);
4894
4939
  rb_define_module_function(module, "glTexGeni", gl_TexGeni, 3);
4895
4940
  rb_define_module_function(module, "glTexGeniv", gl_TexGeniv, 3);
4896
- rb_define_module_function(module, "glFeedbackBuffer", gl_FeedbackBuffer, -1);
4897
- rb_define_module_function(module, "glSelectBuffer", gl_SelectBuffer, -1);
4941
+ rb_define_module_function(module, "glFeedbackBuffer", gl_FeedbackBuffer, 2);
4942
+ rb_define_module_function(module, "glSelectBuffer", gl_SelectBuffer, 1);
4898
4943
  rb_define_module_function(module, "glRenderMode", gl_RenderMode, 1);
4899
4944
  rb_define_module_function(module, "glInitNames", gl_InitNames, 0);
4900
4945
  rb_define_module_function(module, "glLoadName", gl_LoadName, 1);
@@ -4957,12 +5002,12 @@ void gl_init_functions_1_0__1_1(VALUE module)
4957
5002
  rb_define_module_function(module, "glCopyPixels", gl_CopyPixels, 5);
4958
5003
  rb_define_module_function(module, "glReadPixels", gl_ReadPixels, 6);
4959
5004
  rb_define_module_function(module, "glDrawPixels", gl_DrawPixels, 5);
4960
- rb_define_module_function(module, "glGetBooleanv", gl_GetBooleanv, 2);
5005
+ rb_define_module_function(module, "glGetBooleanv", gl_GetBooleanv, 1);
4961
5006
  rb_define_module_function(module, "glGetClipPlane", gl_GetClipPlane, 1);
4962
5007
  rb_define_module_function(module, "glGetDoublev", gl_GetDoublev, 1);
4963
5008
  rb_define_module_function(module, "glGetError", gl_GetError, 0);
4964
- rb_define_module_function(module, "glGetFloatv", gl_GetFloatv, 2);
4965
- rb_define_module_function(module, "glGetIntegerv", gl_GetIntegerv, 2);
5009
+ rb_define_module_function(module, "glGetFloatv", gl_GetFloatv, 1);
5010
+ rb_define_module_function(module, "glGetIntegerv", gl_GetIntegerv, 1);
4966
5011
  rb_define_module_function(module, "glGetLightfv", gl_GetLightfv, 2);
4967
5012
  rb_define_module_function(module, "glGetLightiv", gl_GetLightiv, 2);
4968
5013
  rb_define_module_function(module, "glGetMapdv", gl_GetMapdv, 2);
@@ -4973,14 +5018,14 @@ void gl_init_functions_1_0__1_1(VALUE module)
4973
5018
  rb_define_module_function(module, "glGetPixelMapfv", gl_GetPixelMapfv, 1);
4974
5019
  rb_define_module_function(module, "glGetPixelMapuiv", gl_GetPixelMapuiv, 1);
4975
5020
  rb_define_module_function(module, "glGetPixelMapusv", gl_GetPixelMapusv, 1);
4976
- rb_define_module_function(module, "glGetPolygonStipple", gl_GetPolygonStipple, 1);
5021
+ rb_define_module_function(module, "glGetPolygonStipple", gl_GetPolygonStipple, 0);
4977
5022
  rb_define_module_function(module, "glGetString", gl_GetString, 1);
4978
5023
  rb_define_module_function(module, "glGetTexEnvfv", gl_GetTexEnvfv, 2);
4979
5024
  rb_define_module_function(module, "glGetTexEnviv", gl_GetTexEnviv, 2);
4980
5025
  rb_define_module_function(module, "glGetTexGendv", gl_GetTexGendv, 2);
4981
5026
  rb_define_module_function(module, "glGetTexGenfv", gl_GetTexGenfv, 2);
4982
5027
  rb_define_module_function(module, "glGetTexGeniv", gl_GetTexGeniv, 2);
4983
- /* rb_define_module_function(module, "glGetTexImage", gl_GetTexImage, 5); */
5028
+ rb_define_module_function(module, "glGetTexImage", gl_GetTexImage, 4);
4984
5029
  rb_define_module_function(module, "glGetTexParameterfv", gl_GetTexParameterfv, 2);
4985
5030
  rb_define_module_function(module, "glGetTexParameteriv", gl_GetTexParameteriv, 2);
4986
5031
  rb_define_module_function(module, "glGetTexLevelParameterfv", gl_GetTexLevelParameterfv, 3);
@@ -5014,7 +5059,7 @@ void gl_init_functions_1_0__1_1(VALUE module)
5014
5059
  rb_define_module_function(module, "glDrawElements", gl_DrawElements, 4);
5015
5060
  rb_define_module_function(module, "glEdgeFlagPointer", gl_EdgeFlagPointer, 2);
5016
5061
  rb_define_module_function(module, "glEnableClientState", gl_EnableClientState, 1);
5017
- rb_define_module_function(module, "glGetPointerv", gl_GetPointerv, 2);
5062
+ rb_define_module_function(module, "glGetPointerv", gl_GetPointerv, 1);
5018
5063
  rb_define_module_function(module, "glIndexPointer", gl_IndexPointer, 3);
5019
5064
  rb_define_module_function(module, "glInterleavedArrays", gl_InterleavedArrays, 3);
5020
5065
  rb_define_module_function(module, "glNormalPointer", gl_NormalPointer, 3);
@@ -5065,18 +5110,18 @@ void gl_init_functions_1_0__1_1(VALUE module)
5065
5110
  rb_define_module_function(module, "glNormal3sv", gl_Normalsv, -1);
5066
5111
 
5067
5112
  rb_define_module_function(module, "glRasterPos", gl_RasterPosdv, -1);
5068
- rb_define_module_function(module, "glRasterPos2d", gl_RasterPosdv, -1);
5069
- rb_define_module_function(module, "glRasterPos2f", gl_RasterPosfv, -1);
5070
- rb_define_module_function(module, "glRasterPos2i", gl_RasterPosiv, -1);
5071
- rb_define_module_function(module, "glRasterPos2s", gl_RasterPossv, -1);
5072
- rb_define_module_function(module, "glRasterPos3d", gl_RasterPosdv, -1);
5073
- rb_define_module_function(module, "glRasterPos3f", gl_RasterPosfv, -1);
5074
- rb_define_module_function(module, "glRasterPos3i", gl_RasterPosiv, -1);
5075
- rb_define_module_function(module, "glRasterPos3s", gl_RasterPossv, -1);
5076
- rb_define_module_function(module, "glRasterPos4d", gl_RasterPosdv, -1);
5077
- rb_define_module_function(module, "glRasterPos4f", gl_RasterPosfv, -1);
5078
- rb_define_module_function(module, "glRasterPos4i", gl_RasterPosiv, -1);
5079
- rb_define_module_function(module, "glRasterPos4s", gl_RasterPossv, -1);
5113
+ rb_define_module_function(module, "glRasterPos2dv", gl_RasterPosdv, -1);
5114
+ rb_define_module_function(module, "glRasterPos2fv", gl_RasterPosfv, -1);
5115
+ rb_define_module_function(module, "glRasterPos2iv", gl_RasterPosiv, -1);
5116
+ rb_define_module_function(module, "glRasterPos2sv", gl_RasterPossv, -1);
5117
+ rb_define_module_function(module, "glRasterPos3dv", gl_RasterPosdv, -1);
5118
+ rb_define_module_function(module, "glRasterPos3fv", gl_RasterPosfv, -1);
5119
+ rb_define_module_function(module, "glRasterPos3iv", gl_RasterPosiv, -1);
5120
+ rb_define_module_function(module, "glRasterPos3sv", gl_RasterPossv, -1);
5121
+ rb_define_module_function(module, "glRasterPos4dv", gl_RasterPosdv, -1);
5122
+ rb_define_module_function(module, "glRasterPos4fv", gl_RasterPosfv, -1);
5123
+ rb_define_module_function(module, "glRasterPos4iv", gl_RasterPosiv, -1);
5124
+ rb_define_module_function(module, "glRasterPos4sv", gl_RasterPossv, -1);
5080
5125
 
5081
5126
  rb_define_module_function(module, "glRect", gl_Rectdv, -1);
5082
5127
  rb_define_module_function(module, "glRectdv", gl_Rectdv, -1);