ruby-opengl 0.50.0 → 0.60.0

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 (118) hide show
  1. data/Rakefile +15 -11
  2. data/doc/build_install.txt +10 -6
  3. data/doc/extensions.txt.in +348 -0
  4. data/doc/history.txt +4 -0
  5. data/doc/roadmap.txt +4 -6
  6. data/doc/scientific_use.txt +7 -0
  7. data/doc/supplies/page_template.html +2 -1
  8. data/doc/thanks.txt +5 -0
  9. data/doc/tutorial.txt +431 -121
  10. data/examples/NeHe/nehe_lesson02.rb +1 -1
  11. data/examples/NeHe/nehe_lesson03.rb +1 -1
  12. data/examples/NeHe/nehe_lesson04.rb +1 -1
  13. data/examples/NeHe/nehe_lesson05.rb +1 -1
  14. data/examples/NeHe/nehe_lesson36.rb +1 -1
  15. data/examples/OrangeBook/brick.rb +3 -15
  16. data/examples/OrangeBook/particle.rb +2 -20
  17. data/examples/RedBook/aapoly.rb +1 -1
  18. data/examples/RedBook/aargb.rb +2 -2
  19. data/examples/RedBook/accanti.rb +1 -1
  20. data/examples/RedBook/accpersp.rb +1 -1
  21. data/examples/RedBook/alpha.rb +2 -2
  22. data/examples/RedBook/alpha3D.rb +1 -1
  23. data/examples/RedBook/bezcurve.rb +1 -1
  24. data/examples/RedBook/bezmesh.rb +1 -1
  25. data/examples/RedBook/checker.rb +1 -1
  26. data/examples/RedBook/clip.rb +1 -1
  27. data/examples/RedBook/colormat.rb +1 -1
  28. data/examples/RedBook/cube.rb +1 -1
  29. data/examples/RedBook/depthcue.rb +1 -1
  30. data/examples/RedBook/dof.rb +1 -1
  31. data/examples/RedBook/double.rb +1 -1
  32. data/examples/RedBook/drawf.rb +1 -1
  33. data/examples/RedBook/feedback.rb +1 -1
  34. data/examples/RedBook/fog.rb +1 -1
  35. data/examples/RedBook/font.rb +2 -2
  36. data/examples/RedBook/hello.rb +1 -1
  37. data/examples/RedBook/image.rb +4 -4
  38. data/examples/RedBook/lines.rb +1 -1
  39. data/examples/RedBook/list.rb +1 -1
  40. data/examples/RedBook/material.rb +1 -1
  41. data/examples/RedBook/mipmap.rb +1 -1
  42. data/examples/RedBook/model.rb +1 -1
  43. data/examples/RedBook/movelight.rb +1 -1
  44. data/examples/RedBook/pickdepth.rb +1 -1
  45. data/examples/RedBook/planet.rb +5 -5
  46. data/examples/RedBook/quadric.rb +1 -1
  47. data/examples/RedBook/robot.rb +5 -5
  48. data/examples/RedBook/select.rb +1 -1
  49. data/examples/RedBook/smooth.rb +1 -1
  50. data/examples/RedBook/stencil.rb +1 -1
  51. data/examples/RedBook/stroke.rb +2 -2
  52. data/examples/RedBook/surface.rb +1 -1
  53. data/examples/RedBook/teaambient.rb +1 -1
  54. data/examples/RedBook/teapots.rb +1 -1
  55. data/examples/RedBook/tess.rb +1 -1
  56. data/examples/RedBook/texbind.rb +1 -1
  57. data/examples/RedBook/texgen.rb +5 -5
  58. data/examples/RedBook/texturesurf.rb +1 -1
  59. data/examples/RedBook/varray.rb +1 -1
  60. data/examples/RedBook/wrap.rb +5 -5
  61. data/examples/misc/OGLBench.rb +337 -0
  62. data/examples/misc/anisotropic.rb +1 -1
  63. data/examples/misc/fbo_test.rb +356 -0
  64. data/examples/misc/font-glut.rb +1 -1
  65. data/examples/misc/glfwtest.rb +30 -0
  66. data/examples/misc/md2model.rb +15 -0
  67. data/examples/misc/plane.rb +1 -1
  68. data/examples/misc/readpixel.rb +1 -1
  69. data/examples/misc/sdltest.rb +34 -0
  70. data/examples/misc/trislam.rb +828 -0
  71. data/ext/common/common.h +126 -218
  72. data/ext/common/conv.h +244 -0
  73. data/ext/common/funcdef.h +280 -0
  74. data/ext/common/gl-error.h +23 -0
  75. data/ext/common/gl-types.h +14 -0
  76. data/ext/gl/gl-1.0-1.1.c +497 -1255
  77. data/ext/gl/gl-1.2.c +121 -304
  78. data/ext/gl/gl-1.3.c +78 -339
  79. data/ext/gl/gl-1.4.c +102 -164
  80. data/ext/gl/gl-1.5.c +42 -173
  81. data/ext/gl/gl-2.0.c +273 -1039
  82. data/ext/gl/gl-2.1.c +15 -19
  83. data/ext/gl/gl-enums.c +3 -2
  84. data/ext/gl/gl-error.c +104 -0
  85. data/ext/gl/gl-ext-3dfx.c +27 -0
  86. data/ext/gl/gl-ext-arb.c +812 -12
  87. data/ext/gl/gl-ext-ati.c +41 -0
  88. data/ext/gl/gl-ext-ext.c +791 -119
  89. data/ext/gl/gl-ext-gremedy.c +41 -0
  90. data/ext/gl/gl-ext-nv.c +679 -0
  91. data/ext/gl/gl.c +48 -28
  92. data/ext/gl/mkrf_conf.rb +13 -10
  93. data/ext/glu/glu-enums.c +3 -2
  94. data/ext/glu/glu.c +136 -41
  95. data/ext/glu/mkrf_conf.rb +15 -12
  96. data/ext/glut/glut.c +37 -80
  97. data/ext/glut/mkrf_conf.rb +17 -13
  98. data/lib/opengl.rb +29 -53
  99. data/test/tc_common.rb +9 -3
  100. data/test/tc_ext_arb.rb +397 -3
  101. data/test/tc_ext_ati.rb +33 -0
  102. data/test/tc_ext_ext.rb +479 -2
  103. data/test/tc_ext_gremedy.rb +36 -0
  104. data/test/tc_ext_nv.rb +357 -0
  105. data/test/tc_func_10_11.rb +93 -67
  106. data/test/tc_func_12.rb +11 -11
  107. data/test/tc_func_13.rb +38 -18
  108. data/test/tc_func_14.rb +2 -2
  109. data/test/tc_func_15.rb +10 -10
  110. data/test/tc_func_20.rb +20 -20
  111. data/test/tc_func_21.rb +53 -22
  112. data/test/tc_glu.rb +9 -4
  113. data/test/tc_misc.rb +15 -2
  114. metadata +22 -8
  115. data/doc/extensions.txt +0 -361
  116. data/examples/RedBook/aaindex.rb +0 -97
  117. data/examples/misc/smooth.rb +0 -42
  118. data/examples/misc/test.rb +0 -65
@@ -27,8 +27,13 @@ void gl_init_functions_1_4(VALUE);
27
27
  void gl_init_functions_1_5(VALUE);
28
28
  void gl_init_functions_2_0(VALUE);
29
29
  void gl_init_functions_2_1(VALUE);
30
+ void gl_init_functions_ext_3dfx(VALUE);
30
31
  void gl_init_functions_ext_arb(VALUE);
32
+ void gl_init_functions_ext_ati(VALUE);
31
33
  void gl_init_functions_ext_ext(VALUE);
34
+ void gl_init_functions_ext_gremedy(VALUE);
35
+ void gl_init_functions_ext_nv(VALUE);
36
+
32
37
 
33
38
  static int opengl_version[2]; /* major, minor */
34
39
  static char *opengl_extensions = NULL;
@@ -41,7 +46,8 @@ const int *GetOpenglVersion(void)
41
46
  {
42
47
  if (opengl_version[0]==0) { /* not cached, query */
43
48
  const char *vstr = (const char *) glGetString(GL_VERSION);
44
- if (vstr)
49
+ CHECK_GLERROR
50
+ if (vstr)
45
51
  sscanf( vstr, "%d.%d", &opengl_version[0], &opengl_version[1] );
46
52
  }
47
53
  return opengl_version;
@@ -70,7 +76,8 @@ const char *GetOpenglExtensions(void)
70
76
  {
71
77
  if (opengl_extensions == NULL) {
72
78
  const char *estr = (const char *) glGetString(GL_EXTENSIONS);
73
- if (estr) {
79
+ CHECK_GLERROR
80
+ if (estr) {
74
81
  int len = strlen(estr);
75
82
  opengl_extensions = ALLOC_N(GLchar,len+1+1); /* terminating null and added space */
76
83
  strcpy(opengl_extensions,estr);
@@ -111,42 +118,38 @@ GLboolean CheckExtension(const char *name)
111
118
  return res;
112
119
  }
113
120
 
121
+ /* wrapper for CheckOpenglVersion and CheckExtension, also used by macros
122
+ */
123
+ GLboolean CheckVersionExtension(const char *name)
124
+ {
125
+ if (name && name[0] && name[0]>='0' && name[0]<='9') { /* GL version query */
126
+ int major,minor;
127
+
128
+ if (sscanf( name, "%d.%d", &major, &minor ) != 2)
129
+ return GL_FALSE;
130
+
131
+ return (CheckOpenglVersion(major,minor));
132
+ } else {
133
+ return (CheckExtension(name));
134
+ }
135
+ }
136
+
137
+ /* Checks if given OpenGL version or extension is available
138
+ */
114
139
  static VALUE
115
140
  IsAvailable(obj,arg1)
116
141
  VALUE obj,arg1;
117
142
  {
118
143
  char *name = NULL;
119
144
  VALUE s;
145
+ GLboolean res;
120
146
 
121
147
  s = rb_funcall(arg1, rb_intern("to_s"),0);
122
- name = RSTRING(s)->ptr;
148
+ name = RSTRING_PTR(s);
123
149
 
124
- if (name && name[0] && name[0]>='0' && name[0]<='9') { /* GL version query */
125
- int major,minor;
150
+ res = CheckVersionExtension(name);
126
151
 
127
- if (sscanf( name, "%d.%d", &major, &minor ) != 2)
128
- return Qfalse;
129
-
130
- if (CheckOpenglVersion(major,minor)==1)
131
- return Qtrue;
132
- else
133
- return Qfalse;
134
- } else if (name && name[0] && (name[0]=='G' || name[0]=='W')) { /* GL_, GLX_, WGL_ extension */
135
- GLboolean res;
136
-
137
- res = CheckExtension(name);
138
- if (res==GL_TRUE)
139
- return Qtrue;
140
- else
141
- return Qfalse;
142
- } else { /* function */
143
- GLvoid *ret;
144
- ret = load_gl_function(name,0); /* won't raise */
145
- if (ret==NULL)
146
- return Qfalse;
147
- else
148
- return Qtrue;
149
- }
152
+ return GLBOOL2RUBY(res);
150
153
  }
151
154
 
152
155
  /* Checks whether non-zero buffer of type $buffer is bound
@@ -173,12 +176,20 @@ GLint CheckBufferBinding(GLint buffer)
173
176
  break;
174
177
  }
175
178
  glGetIntegerv(buffer,&result);
179
+ CHECK_GLERROR
176
180
  return result;
177
181
  }
178
182
 
179
183
  DLLEXPORT void Init_gl()
180
184
  {
185
+ VALUE VERSION = rb_str_new2("0.60");
186
+
181
187
  module = rb_define_module("Gl");
188
+
189
+ rb_define_const(module, "BINDINGS_VERSION", VERSION);
190
+ rb_define_const(module, "RUBY_OPENGL_VERSION", VERSION);
191
+
192
+ gl_init_error(module);
182
193
  gl_init_enums(module);
183
194
  gl_init_functions_1_0__1_1(module);
184
195
  gl_init_functions_1_2(module);
@@ -187,8 +198,17 @@ DLLEXPORT void Init_gl()
187
198
  gl_init_functions_1_5(module);
188
199
  gl_init_functions_2_0(module);
189
200
  gl_init_functions_2_1(module);
201
+ gl_init_functions_ext_3dfx(module);
190
202
  gl_init_functions_ext_arb(module);
203
+ gl_init_functions_ext_ati(module);
191
204
  gl_init_functions_ext_ext(module);
205
+ gl_init_functions_ext_gremedy(module);
206
+ gl_init_functions_ext_nv(module);
192
207
 
193
208
  rb_define_module_function(module, "is_available?", IsAvailable, 1);
209
+ rb_define_module_function(module, "is_supported?", IsAvailable, 1);
210
+ rb_define_module_function(module, "extension_available?", IsAvailable, 1);
211
+ rb_define_module_function(module, "extension_supported?", IsAvailable, 1);
212
+ rb_define_module_function(module, "version_available?", IsAvailable, 1);
213
+ rb_define_module_function(module, "version_supported?", IsAvailable, 1);
194
214
  }
@@ -17,15 +17,18 @@ require 'rubygems'
17
17
  require 'mkrf'
18
18
  require 'rbconfig'
19
19
 
20
+ RUBYVER = " -DRUBY_VERSION=" + RUBY_VERSION.split(".").join
21
+
20
22
  Mkrf::Generator.new( 'gl' ) do |g|
21
- case RUBY_PLATFORM
22
- when /darwin/
23
- g.ldshared << ' -framework OpenGL'
24
- when /mswin32/
25
- g.cflags << ' -DWIN32'
26
- g.include_library( 'opengl32.lib', 'glVertex3d')
27
- else
28
- g.cflags << ' -Wall'
29
- g.include_library( 'GL', 'glVertex3d')
30
- end
23
+ case RUBY_PLATFORM
24
+ when /darwin/
25
+ g.cflags << RUBYVER
26
+ g.ldshared << ' -framework OpenGL'
27
+ when /mswin32/
28
+ g.cflags << ' -DWIN32' + RUBYVER
29
+ g.include_library( 'opengl32.lib', 'glVertex3d')
30
+ else
31
+ g.cflags << ' -Wall' + RUBYVER
32
+ g.include_library( 'GL', 'glVertex3d')
33
+ end
31
34
  end
@@ -5,6 +5,9 @@
5
5
  #include "../common/common.h"
6
6
  void glu_init_enums(VALUE module)
7
7
  {
8
+ rb_define_const(module, "GLU_FALSE", Qfalse);
9
+ rb_define_const(module, "GLU_TRUE", Qtrue);
10
+
8
11
  rb_define_const(module, "GLU_AUTO_LOAD_MATRIX", INT2NUM(GLU_AUTO_LOAD_MATRIX));
9
12
  rb_define_const(module, "GLU_BEGIN", INT2NUM(GLU_BEGIN));
10
13
  rb_define_const(module, "GLU_CCW", INT2NUM(GLU_CCW));
@@ -19,7 +22,6 @@ void glu_init_enums(VALUE module)
19
22
  rb_define_const(module, "GLU_EXTERIOR", INT2NUM(GLU_EXTERIOR));
20
23
  rb_define_const(module, "GLU_EXT_nurbs_tessellator", INT2NUM(GLU_EXT_nurbs_tessellator));
21
24
  rb_define_const(module, "GLU_EXT_object_space_tess", INT2NUM(GLU_EXT_object_space_tess));
22
- rb_define_const(module, "GLU_FALSE", INT2NUM(GLU_FALSE));
23
25
  rb_define_const(module, "GLU_FILL", INT2NUM(GLU_FILL));
24
26
  rb_define_const(module, "GLU_FLAT", INT2NUM(GLU_FLAT));
25
27
  rb_define_const(module, "GLU_INSIDE", INT2NUM(GLU_INSIDE));
@@ -151,7 +153,6 @@ void glu_init_enums(VALUE module)
151
153
  rb_define_const(module, "GLU_TESS_WINDING_ODD", INT2NUM(GLU_TESS_WINDING_ODD));
152
154
  rb_define_const(module, "GLU_TESS_WINDING_POSITIVE", INT2NUM(GLU_TESS_WINDING_POSITIVE));
153
155
  rb_define_const(module, "GLU_TESS_WINDING_RULE", INT2NUM(GLU_TESS_WINDING_RULE));
154
- rb_define_const(module, "GLU_TRUE", INT2NUM(GLU_TRUE));
155
156
  rb_define_const(module, "GLU_UNKNOWN", INT2NUM(GLU_UNKNOWN));
156
157
  rb_define_const(module, "GLU_U_STEP", INT2NUM(GLU_U_STEP));
157
158
  rb_define_const(module, "GLU_VERSION", INT2NUM(GLU_VERSION));
@@ -21,6 +21,8 @@
21
21
 
22
22
  static VALUE module;
23
23
 
24
+ VALUE Class_GLUError;
25
+
24
26
  void glu_init_enums(VALUE);
25
27
 
26
28
  typedef GLUtesselator tesselatorObj;
@@ -124,6 +126,35 @@ get_surface_dim(GLenum type)
124
126
  return 0; /* never gets here */
125
127
  }
126
128
 
129
+ VALUE GLUError_initialize(VALUE obj,VALUE message, VALUE error_id)
130
+ {
131
+ rb_call_super(1, &message);
132
+ rb_iv_set(obj, "@id", error_id);
133
+
134
+ return obj;
135
+ }
136
+
137
+ void check_for_gluerror(GLenum error)
138
+ {
139
+ char *error_string = "";
140
+ VALUE exc;
141
+
142
+ /* no error */
143
+ if (error==0)
144
+ return;
145
+
146
+ switch(error) {
147
+ case GLU_INVALID_ENUM: error_string = "invalid enumerant"; break;
148
+ case GLU_INVALID_VALUE: error_string = "invalid value"; break;
149
+ case GLU_INVALID_OPERATION: error_string = "invalid operation"; break;
150
+ case GLU_OUT_OF_MEMORY: error_string = "out of memory"; break;
151
+ default: error_string = "unknown error"; break;
152
+ }
153
+
154
+ exc = rb_funcall(Class_GLUError, rb_intern("new"), 2, rb_str_new2(error_string), RETCONV_GLenum(error));
155
+ rb_funcall(rb_cObject, rb_intern("raise"), 1, exc);
156
+ }
157
+
127
158
  /*
128
159
  * NURBS API
129
160
  */
@@ -177,7 +208,7 @@ VALUE obj, arg1, arg2, arg3;
177
208
  gluNurbsCallback(ndata->nobj, type, NULL);
178
209
  else
179
210
  gluNurbsCallback(ndata->nobj, type, n_error);
180
-
211
+
181
212
  return Qnil;
182
213
  }
183
214
 
@@ -191,6 +222,7 @@ VALUE obj;
191
222
  ret = Data_Make_Struct(cNurbs, struct nurbsdata, mark_nurbs, free_nurbs, ndata);
192
223
  ndata->nobj = gluNewNurbsRenderer();
193
224
  ndata->n_ref = rb_ary_new2(REF_LAST);
225
+
194
226
  return ret;
195
227
  }
196
228
  static VALUE
@@ -200,6 +232,7 @@ VALUE obj, arg1;
200
232
  struct nurbsdata *ndata;
201
233
  GetNURBS(arg1, ndata);
202
234
  free_nurbs(ndata);
235
+
203
236
  return Qnil;
204
237
  }
205
238
  static VALUE
@@ -213,6 +246,7 @@ VALUE obj, arg1, arg2, arg3;
213
246
  property = (GLenum)NUM2INT(arg2);
214
247
  value = (GLfloat)NUM2DBL(arg3);
215
248
  gluNurbsProperty(ndata->nobj, property, value);
249
+
216
250
  return Qnil;
217
251
  }
218
252
  static VALUE
@@ -225,7 +259,8 @@ VALUE obj, arg1, arg2;
225
259
  GetNURBS(arg1, ndata);
226
260
  property = (GLenum)NUM2INT(arg2);
227
261
  gluGetNurbsProperty(ndata->nobj, property, &value);
228
- return rb_float_new(value);
262
+
263
+ return cond_GLBOOL2RUBY_F(property,value);
229
264
  }
230
265
  static VALUE
231
266
  glu_BeginCurve(obj, arg1)
@@ -235,6 +270,7 @@ VALUE obj, arg1;
235
270
  GetNURBS(arg1, ndata);
236
271
  rb_ary_push(n_current, arg1);
237
272
  gluBeginCurve(ndata->nobj);
273
+
238
274
  return Qnil;
239
275
  }
240
276
  static VALUE
@@ -252,6 +288,7 @@ VALUE obj, arg1;
252
288
 
253
289
  rb_ary_pop(n_current);
254
290
 
291
+
255
292
  return Qnil;
256
293
  }
257
294
  static VALUE
@@ -281,8 +318,7 @@ VALUE obj;
281
318
  uknot = ALLOC_N(GLfloat, uknot_count);
282
319
  ary2cflt(args[1], uknot, uknot_count);
283
320
 
284
- ary_ctl1 = rb_ary_new();
285
- mary2ary(args[2], ary_ctl1); /* flatten */
321
+ ary_ctl1 = rb_funcall(args[2],rb_intern("flatten"),0);
286
322
  break;
287
323
  case 7:
288
324
  uknot_count = (GLint)NUM2INT(args[1]);
@@ -293,11 +329,10 @@ VALUE obj;
293
329
  uknot = ALLOC_N(GLfloat, uknot_count);
294
330
  ary2cflt(args[2], uknot, uknot_count);
295
331
 
296
- ary_ctl1 = rb_ary_new();
297
- mary2ary(args[4], ary_ctl1); /* flatten */
332
+ ary_ctl1 = rb_funcall(args[4],rb_intern("flatten"),0);
298
333
  break;
299
334
  default:
300
- rb_raise(rb_eArgError, "gluNurbsCurve needs 5 or 7 arguments",argc);
335
+ rb_raise(rb_eArgError, "gluNurbsCurve needs 5 or 7 arguments");
301
336
  }
302
337
  ctlarray = ALLOC_N(GLfloat, u_stride*(uknot_count-uorder));
303
338
  ary2cflt((VALUE)ary_ctl1, ctlarray, (uknot_count-uorder)*u_stride);
@@ -309,6 +344,7 @@ VALUE obj;
309
344
  gms.ptr = REALLOC_N(gms.ptr, GLfloat*, gms.len+=2);
310
345
  gms.ptr[gms.len - 2] = uknot;
311
346
  gms.ptr[gms.len - 1] = ctlarray;
347
+
312
348
  return Qnil;
313
349
  }
314
350
  static VALUE
@@ -319,6 +355,7 @@ VALUE obj, arg1;
319
355
  GetNURBS(arg1, ndata);
320
356
  rb_ary_push(n_current, arg1);
321
357
  gluBeginSurface(ndata->nobj);
358
+
322
359
  return Qnil;
323
360
  }
324
361
  static VALUE
@@ -336,6 +373,7 @@ VALUE obj, arg1;
336
373
 
337
374
  rb_ary_pop(n_current);
338
375
 
376
+
339
377
  return Qnil;
340
378
  }
341
379
 
@@ -379,8 +417,7 @@ VALUE obj;
379
417
  s_stride = t_stride * sorder;
380
418
 
381
419
  ctlarray = ALLOC_N(GLfloat, (sknot_count-sorder)*(tknot_count-torder)*t_stride);
382
- ary_ctl1 = rb_ary_new();
383
- mary2ary(args[3], ary_ctl1); /* flatten */
420
+ ary_ctl1 = rb_funcall(args[3],rb_intern("flatten"),0);
384
421
  ary2cflt(ary_ctl1, ctlarray, (sknot_count-sorder)*(tknot_count-torder)*t_stride);
385
422
  break;
386
423
  case 11:
@@ -400,13 +437,11 @@ VALUE obj;
400
437
  type_len = get_surface_dim(type);
401
438
 
402
439
  ctlarray = ALLOC_N(GLfloat, (sknot_count-sorder)*(tknot_count-torder)*type_len);
403
-
404
- ary_ctl1 = rb_ary_new();
405
- mary2ary(args[7], ary_ctl1); /* flatten */
440
+ ary_ctl1 = rb_funcall(args[7],rb_intern("flatten"),0);
406
441
  ary2cflt(ary_ctl1, ctlarray, (sknot_count-sorder)*(tknot_count-torder)*type_len);
407
442
  break;
408
443
  default:
409
- rb_raise(rb_eArgError, "gluNurbsSurface needs 7 or 11 arguments",argc);
444
+ rb_raise(rb_eArgError, "gluNurbsSurface needs 7 or 11 arguments");
410
445
  return Qnil; /* not reached */
411
446
  }
412
447
  GetNURBS(args[0], ndata);
@@ -420,6 +455,7 @@ VALUE obj;
420
455
  gms.ptr[gms.len-2] = tknot;
421
456
  gms.ptr[gms.len-1] = ctlarray;
422
457
 
458
+
423
459
  return Qnil;
424
460
  }
425
461
  static VALUE
@@ -430,6 +466,7 @@ VALUE obj, arg1;
430
466
  GetNURBS(arg1, ndata);
431
467
  rb_ary_push(n_current, arg1);
432
468
  gluBeginTrim(ndata->nobj);
469
+
433
470
  return Qnil;
434
471
  }
435
472
  static VALUE
@@ -440,6 +477,7 @@ VALUE obj, arg1;
440
477
  GetNURBS(arg1, ndata);
441
478
  gluEndTrim(ndata->nobj);
442
479
  rb_ary_pop(n_current);
480
+
443
481
  return Qnil;
444
482
  }
445
483
  static VALUE
@@ -464,8 +502,7 @@ VALUE obj;
464
502
  stride = (type == GLU_MAP1_TRIM_2 ? 2 : 3);
465
503
 
466
504
  array = ALLOC_N(GLfloat, count*stride);
467
- ary_ctl1 = rb_ary_new();
468
- mary2ary(args[1], ary_ctl1); /* flatten */
505
+ ary_ctl1 = rb_funcall(args[1],rb_intern("flatten"),0);
469
506
  ary2cflt(ary_ctl1, array, count*stride);
470
507
  break;
471
508
  case 5:
@@ -474,18 +511,18 @@ VALUE obj;
474
511
  type = NUM2INT(args[4]);
475
512
 
476
513
  array = ALLOC_N(GLfloat, count*stride);
477
- ary_ctl1 = rb_ary_new();
478
- mary2ary(args[2], ary_ctl1); /* flatten */
514
+ ary_ctl1 = rb_funcall(args[2],rb_intern("flatten"),0);
479
515
  ary2cflt(ary_ctl1, array, count*stride);
480
516
  break;
481
517
  default:
482
- rb_raise(rb_eArgError, "gluPwlCurve needs 3 or 5 arguments",argc);
518
+ rb_raise(rb_eArgError, "gluPwlCurve needs 3 or 5 arguments");
483
519
  return Qnil; /* not reached */
484
520
  }
485
521
 
486
522
  GetNURBS(args[0], ndata);
487
523
  gluPwlCurve(ndata->nobj, count, array, stride, type);
488
524
  free(array);
525
+
489
526
  return Qnil;
490
527
  }
491
528
 
@@ -498,12 +535,13 @@ VALUE obj, arg1,arg2,arg3,arg4;
498
535
  GLint viewport[4];
499
536
 
500
537
  GetNURBS(arg1, ndata);
501
- ary2cmat4x4flt(arg2,mdl_mtx);
502
- ary2cmat4x4flt(arg3,persp_mtx);
538
+ ary2cmatfloat(arg2,mdl_mtx,4,4);
539
+ ary2cmatfloat(arg3,persp_mtx,4,4);
503
540
  ary2cint(arg4,viewport,4);
504
541
 
505
542
  gluLoadSamplingMatrices(ndata->nobj,mdl_mtx,persp_mtx,viewport);
506
543
 
544
+
507
545
  return Qnil;
508
546
  }
509
547
 
@@ -552,6 +590,7 @@ VALUE obj;
552
590
  ret = Data_Make_Struct(cTess, struct tessdata, mark_tess, free_tess, tdata);
553
591
  tdata->tobj = gluNewTess();
554
592
  tdata->t_ref = rb_ary_new2(REF_LAST);
593
+
555
594
  return ret;
556
595
  }
557
596
  static VALUE
@@ -561,6 +600,7 @@ VALUE obj, arg1;
561
600
  struct tessdata *tdata;
562
601
  GetTESS(arg1, tdata);
563
602
  free_tess(tdata);
603
+
564
604
  return Qnil;
565
605
  }
566
606
 
@@ -585,7 +625,7 @@ t_edgeFlag(flag)
585
625
  GLboolean flag;
586
626
  {
587
627
  TESS_CALLBACK_COMMON
588
- rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_FLAG), callId, 1, INT2NUM(flag));
628
+ rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_FLAG), callId, 1, GLBOOL2RUBY(flag));
589
629
  }
590
630
  static void CALLBACK
591
631
  t_vertex(data)
@@ -621,7 +661,7 @@ GLboolean flag;
621
661
  void* user_data;
622
662
  {
623
663
  TESS_CALLBACK_COMMON
624
- rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_FLAG_DATA), callId, 2, INT2NUM(flag), user_data);
664
+ rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_FLAG_DATA), callId, 2, GLBOOL2RUBY(flag), user_data);
625
665
  }
626
666
  static void CALLBACK
627
667
  t_vertex_data(data, user_data)
@@ -711,6 +751,7 @@ VALUE obj, arg1, arg2;
711
751
  property = (GLenum)NUM2INT(arg2);
712
752
  value = (GLdouble)NUM2DBL(arg3);
713
753
  gluTessProperty(tdata->tobj, property, value);
754
+
714
755
  return Qnil;
715
756
  }
716
757
  static VALUE
@@ -723,7 +764,8 @@ VALUE obj, arg1, arg2;
723
764
  GetTESS(arg1, tdata);
724
765
  property = (GLenum)NUM2INT(arg2);
725
766
  gluGetTessProperty(tdata->tobj, property, &value);
726
- return rb_float_new(value);
767
+
768
+ return cond_GLBOOL2RUBY_F(property,value);
727
769
  }
728
770
  static VALUE
729
771
  glu_TessNormal(obj, arg1, arg2, arg3, arg4)
@@ -736,6 +778,7 @@ VALUE obj, arg1, arg2, arg3, arg4;
736
778
  y = (GLdouble)NUM2DBL(arg3);
737
779
  z = (GLdouble)NUM2DBL(arg4);
738
780
  gluTessNormal(tdata->tobj, x, y, z);
781
+
739
782
  return Qnil;
740
783
  }
741
784
  static VALUE
@@ -749,6 +792,7 @@ VALUE obj, arg1, arg2;
749
792
  rb_ary_store(tdata->t_ref, TESS_DATA, rb_ary_new());
750
793
  rb_ary_push(t_current, arg1);
751
794
  gluTessBeginPolygon(tdata->tobj, (void*)arg2);
795
+
752
796
  return Qnil;
753
797
  }
754
798
  static VALUE
@@ -762,6 +806,7 @@ VALUE obj, arg1;
762
806
  rb_ary_store(tdata->t_ref, TESS_OUTDATA, Qnil);
763
807
  rb_ary_store(tdata->t_ref, TESS_DATA, Qnil);
764
808
  rb_ary_pop(t_current);
809
+
765
810
  return Qnil;
766
811
  }
767
812
  static VALUE
@@ -771,14 +816,17 @@ VALUE obj, arg1;
771
816
  struct tessdata* tdata;
772
817
  GetTESS(arg1, tdata);
773
818
  gluTessBeginContour(tdata->tobj);
819
+
774
820
  return Qnil;
775
821
  }
776
822
  static VALUE
777
823
  glu_TessEndContour(obj, arg1)
824
+ VALUE obj, arg1;
778
825
  {
779
826
  struct tessdata* tdata;
780
827
  GetTESS(arg1, tdata);
781
828
  gluTessEndContour(tdata->tobj);
829
+
782
830
  return Qnil;
783
831
  }
784
832
 
@@ -816,6 +864,7 @@ VALUE obj, arg1, arg2, arg3;
816
864
  TESS_CALLBACK_CASE(TESS_COMBINE,t_combine)
817
865
  TESS_CALLBACK_CASE(TESS_COMBINE_DATA,t_combine_data)
818
866
  }
867
+
819
868
  return Qnil;
820
869
  }
821
870
  #undef TESS_CALLBACK_CASE
@@ -829,6 +878,7 @@ VALUE obj, arg1;
829
878
  rb_ary_store(tdata->t_ref, TESS_DATA, rb_ary_new());
830
879
  rb_ary_push(t_current, arg1);
831
880
  gluBeginPolygon(tdata->tobj);
881
+
832
882
  return Qnil;
833
883
  }
834
884
  static VALUE
@@ -842,6 +892,7 @@ VALUE obj, arg1, arg2, arg3;
842
892
  Check_Type(arg2,T_ARRAY);
843
893
  ary2cdbl(arg2, v, 3);
844
894
  gluTessVertex(tdata->tobj, v,(void *)arg3);
895
+
845
896
  return Qnil;
846
897
  }
847
898
  static VALUE
@@ -853,6 +904,7 @@ VALUE obj, arg1, arg2;
853
904
  GetTESS(arg1, tdata);
854
905
  type = (GLenum)NUM2INT(arg2);
855
906
  gluNextContour(tdata->tobj, type);
907
+
856
908
  return Qnil;
857
909
  }
858
910
  static VALUE
@@ -864,6 +916,7 @@ VALUE obj, arg1;
864
916
  gluEndPolygon(tdata->tobj);
865
917
  rb_ary_store(tdata->t_ref, TESS_DATA, Qnil);
866
918
  rb_ary_pop(t_current);
919
+
867
920
  return Qnil;
868
921
  }
869
922
 
@@ -896,6 +949,7 @@ VALUE obj, arg1, arg2, arg3;
896
949
  if (!rb_obj_is_kind_of(arg3,rb_cProc) && !NIL_P(arg3))
897
950
  rb_raise(rb_eTypeError, "gluQuadricCallback needs Proc Object:%s",rb_class2name(CLASS_OF(arg3)));
898
951
 
952
+
899
953
  if (type!=GLU_ERROR)
900
954
  return Qnil;
901
955
 
@@ -905,6 +959,7 @@ VALUE obj, arg1, arg2, arg3;
905
959
  else
906
960
  gluQuadricCallback(qdata->qobj, type, q_error);
907
961
 
962
+
908
963
  return Qnil;
909
964
  }
910
965
 
@@ -932,6 +987,7 @@ VALUE obj;
932
987
  ret = Data_Make_Struct(cQuad, struct quaddata, mark_quad, free_quad, qdata);
933
988
  qdata->qobj = gluNewQuadric();
934
989
  qdata->q_ref = rb_ary_new2(REF_LAST);
990
+
935
991
  return ret;
936
992
  }
937
993
  static VALUE
@@ -941,6 +997,7 @@ VALUE obj, arg1;
941
997
  struct quaddata *qdata;
942
998
  GetQUAD(arg1, qdata);
943
999
  free_quad(qdata);
1000
+
944
1001
  return Qnil;
945
1002
  }
946
1003
  static VALUE
@@ -952,6 +1009,7 @@ VALUE obj, arg1, arg2;
952
1009
  GetQUAD(arg1, qdata);
953
1010
  normals = (GLenum)NUM2INT(arg2);
954
1011
  gluQuadricNormals(qdata->qobj, normals);
1012
+
955
1013
  return Qnil;
956
1014
  }
957
1015
  static VALUE
@@ -963,6 +1021,7 @@ VALUE obj, arg1, arg2;
963
1021
  GetQUAD(arg1, qdata);
964
1022
  textureCoords = (GLboolean)NUM2INT(arg2);
965
1023
  gluQuadricTexture(qdata->qobj, textureCoords);
1024
+
966
1025
  return Qnil;
967
1026
  }
968
1027
  static VALUE
@@ -974,6 +1033,7 @@ VALUE obj, arg1, arg2;
974
1033
  GetQUAD(arg1, qdata);
975
1034
  orientation = (GLenum)NUM2INT(arg2);
976
1035
  gluQuadricOrientation(qdata->qobj, orientation);
1036
+
977
1037
  return Qnil;
978
1038
  }
979
1039
  static VALUE
@@ -985,6 +1045,7 @@ VALUE obj, arg1, arg2;
985
1045
  GetQUAD(arg1, qdata);
986
1046
  drawStyle = (GLenum)NUM2INT(arg2);
987
1047
  gluQuadricDrawStyle(qdata->qobj, drawStyle);
1048
+
988
1049
  return Qnil;
989
1050
  }
990
1051
  static VALUE
@@ -1008,6 +1069,7 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6;
1008
1069
  rb_ary_push(q_current, arg1);
1009
1070
  gluCylinder(qdata->qobj, baseRadius, topRadius, height, slices, stacks);
1010
1071
  rb_ary_pop(q_current);
1072
+
1011
1073
  return Qnil;
1012
1074
  }
1013
1075
  static VALUE
@@ -1030,6 +1092,7 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5;
1030
1092
 
1031
1093
  gluDisk(qdata->qobj, innerRadius, outerRadius, slices, loops);
1032
1094
  rb_ary_pop(q_current);
1095
+
1033
1096
  return Qnil;
1034
1097
  }
1035
1098
  static VALUE
@@ -1055,6 +1118,7 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
1055
1118
  rb_ary_push(q_current, arg1);
1056
1119
  gluPartialDisk(qdata->qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle);
1057
1120
  rb_ary_pop(q_current);
1121
+
1058
1122
  return Qnil;
1059
1123
  }
1060
1124
  static VALUE
@@ -1074,6 +1138,7 @@ VALUE obj, arg1, arg2, arg3, arg4;
1074
1138
  rb_ary_push(q_current, arg1);
1075
1139
  gluSphere(qdata->qobj, radius, slices, stacks);
1076
1140
  rb_ary_pop(q_current);
1141
+
1077
1142
  return Qnil;
1078
1143
  }
1079
1144
 
@@ -1102,6 +1167,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
1102
1167
  upy = (GLdouble)NUM2DBL(arg8);
1103
1168
  upz = (GLdouble)NUM2DBL(arg9);
1104
1169
  gluLookAt( eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz );
1170
+
1105
1171
  return Qnil;
1106
1172
  }
1107
1173
  static VALUE
@@ -1117,6 +1183,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
1117
1183
  bottom = (GLdouble)NUM2DBL(arg3);
1118
1184
  top = (GLdouble)NUM2DBL(arg4);
1119
1185
  gluOrtho2D(left,right,bottom,top);
1186
+
1120
1187
  return Qnil;
1121
1188
  }
1122
1189
  static VALUE
@@ -1132,6 +1199,7 @@ VALUE obj,arg1,arg2,arg3,arg4;
1132
1199
  zNear = (GLdouble)NUM2DBL(arg3);
1133
1200
  zFar = (GLdouble)NUM2DBL(arg4);
1134
1201
  gluPerspective(fovy,aspect,zNear,zFar);
1202
+
1135
1203
  return Qnil;
1136
1204
  }
1137
1205
  static VALUE
@@ -1165,11 +1233,12 @@ VALUE obj;
1165
1233
  ary2cint(args[4], viewport, 4);
1166
1234
  break;
1167
1235
  default:
1168
- rb_raise(rb_eArgError, "gluPickMatrix needs 2,4 or 5 parameters",argc);
1236
+ rb_raise(rb_eArgError, "gluPickMatrix needs 2,4 or 5 parameters");
1169
1237
  }
1170
1238
  x = (GLdouble)NUM2DBL(args[0]);
1171
1239
  y = (GLdouble)NUM2DBL(args[1]);
1172
1240
  gluPickMatrix(x, y, width, height, viewport);
1241
+
1173
1242
  return Qnil;
1174
1243
  }
1175
1244
 
@@ -1198,8 +1267,8 @@ VALUE obj;
1198
1267
  glGetIntegerv(GL_VIEWPORT, vport);
1199
1268
  break;
1200
1269
  case 6:
1201
- ary2cmat4x4dbl(args[3], mdl_mtx);
1202
- ary2cmat4x4dbl(args[4], prj_mtx);
1270
+ ary2cmatdouble(args[3], mdl_mtx, 4, 4);
1271
+ ary2cmatdouble(args[4], prj_mtx, 4, 4);
1203
1272
  ary2cint(args[5], vport, 4);
1204
1273
  break;
1205
1274
  default:
@@ -1209,10 +1278,14 @@ VALUE obj;
1209
1278
  oy = (GLdouble)NUM2DBL(args[1]);
1210
1279
  oz = (GLdouble)NUM2DBL(args[2]);
1211
1280
 
1212
- if (gluProject(ox, oy, oz, mdl_mtx, prj_mtx, vport, &wx, &wy, &wz) == GL_TRUE)
1281
+ if (gluProject(ox, oy, oz, mdl_mtx, prj_mtx, vport, &wx, &wy, &wz) == GL_TRUE) {
1282
+
1213
1283
  return rb_ary_new3(3, rb_float_new(wx), rb_float_new(wy), rb_float_new(wz));
1214
- else
1215
- return Qnil;
1284
+ } else {
1285
+
1286
+ check_for_gluerror(GLU_INVALID_VALUE);
1287
+ return Qnil; /* not reached */
1288
+ }
1216
1289
  }
1217
1290
  static VALUE
1218
1291
  glu_UnProject(argc,argv,obj)
@@ -1239,8 +1312,8 @@ VALUE obj;
1239
1312
  glGetIntegerv(GL_VIEWPORT, vport);
1240
1313
  break;
1241
1314
  case 6:
1242
- ary2cmat4x4dbl(args[3], mdl_mtx);
1243
- ary2cmat4x4dbl(args[4], prj_mtx);
1315
+ ary2cmatdouble(args[3], mdl_mtx, 4, 4);
1316
+ ary2cmatdouble(args[4], prj_mtx, 4, 4);
1244
1317
  ary2cint(args[5], vport, 4);
1245
1318
  break;
1246
1319
  default:
@@ -1250,10 +1323,14 @@ VALUE obj;
1250
1323
  wy = (GLdouble)NUM2DBL(args[1]);
1251
1324
  wz = (GLdouble)NUM2DBL(args[2]);
1252
1325
 
1253
- if (gluUnProject(wx, wy, wz, mdl_mtx, prj_mtx, vport, &ox, &oy, &oz) == GL_TRUE)
1326
+ if (gluUnProject(wx, wy, wz, mdl_mtx, prj_mtx, vport, &ox, &oy, &oz) == GL_TRUE) {
1327
+
1254
1328
  return rb_ary_new3(3, rb_float_new(ox), rb_float_new(oy), rb_float_new(oz));
1255
- else
1256
- return Qnil;
1329
+ } else {
1330
+
1331
+ check_for_gluerror(GLU_INVALID_VALUE);
1332
+ return Qnil; /* not reached */
1333
+ }
1257
1334
  }
1258
1335
 
1259
1336
  static VALUE
@@ -1265,6 +1342,7 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6;
1265
1342
  GLint width;
1266
1343
  GLenum format;
1267
1344
  GLenum type;
1345
+ int ret;
1268
1346
 
1269
1347
  target = (GLenum)NUM2INT(arg1);
1270
1348
  components = (GLint)NUM2INT(arg2);
@@ -1274,7 +1352,10 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6;
1274
1352
  Check_Type(arg6,T_STRING);
1275
1353
  CheckDataSize(type,format,width,arg6);
1276
1354
 
1277
- return INT2NUM(gluBuild1DMipmaps(target, components, width, format, type, RSTRING(arg6)->ptr));
1355
+ ret = gluBuild1DMipmaps(target, components, width, format, type, RSTRING_PTR(arg6));
1356
+ check_for_gluerror(ret);
1357
+
1358
+ return INT2NUM(ret);
1278
1359
  }
1279
1360
 
1280
1361
  static VALUE
@@ -1287,6 +1368,7 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
1287
1368
  GLint height;
1288
1369
  GLenum format;
1289
1370
  GLenum type;
1371
+ int ret;
1290
1372
 
1291
1373
  target = (GLenum)NUM2INT(arg1);
1292
1374
  components = (GLint)NUM2INT(arg2);
@@ -1297,7 +1379,10 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
1297
1379
  Check_Type(arg7,T_STRING);
1298
1380
  CheckDataSize(type,format,width*height,arg7);
1299
1381
 
1300
- return INT2NUM(gluBuild2DMipmaps(target, components, width, height, format, type, RSTRING(arg7)->ptr));
1382
+ ret = gluBuild2DMipmaps(target, components, width, height, format, type, RSTRING_PTR(arg7));
1383
+ check_for_gluerror(ret);
1384
+
1385
+ return INT2NUM(ret);
1301
1386
  }
1302
1387
 
1303
1388
  static VALUE
@@ -1313,6 +1398,7 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8;
1313
1398
  GLint heightout;
1314
1399
  GLenum typeout;
1315
1400
  VALUE ret;
1401
+ GLint retcode;
1316
1402
 
1317
1403
  format = (GLenum)NUM2INT(arg1);
1318
1404
  widthin = (GLint)NUM2INT(arg2);
@@ -1320,13 +1406,16 @@ VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8;
1320
1406
  typein = (GLenum)NUM2INT(arg4);
1321
1407
  Check_Type(arg5,T_STRING);
1322
1408
  CheckDataSize(typein,format,heightin*widthin,arg5);
1323
- datain = RSTRING(arg5)->ptr;
1409
+ datain = RSTRING_PTR(arg5);
1324
1410
  widthout = (GLint)NUM2INT(arg6);
1325
1411
  heightout = (GLint)NUM2INT(arg7);
1326
1412
  typeout = (GLenum)NUM2INT(arg8);
1327
1413
  ret = allocate_buffer_with_string(GetDataSize(typeout,format,widthout*heightout));
1328
- gluScaleImage(format, widthin, heightin, typein, datain,
1329
- widthout, heightout, typeout, (GLvoid*)RSTRING(ret)->ptr);
1414
+ retcode = gluScaleImage(format, widthin, heightin, typein, datain,
1415
+ widthout, heightout, typeout, (GLvoid*)RSTRING_PTR(ret));
1416
+
1417
+ check_for_gluerror(retcode);
1418
+
1330
1419
  return ret;
1331
1420
  }
1332
1421
 
@@ -1338,6 +1427,7 @@ VALUE obj, arg1;
1338
1427
  GLubyte* error;
1339
1428
  errorCode = (GLenum)NUM2INT(arg1);
1340
1429
  error = (GLubyte*)gluErrorString(errorCode);
1430
+
1341
1431
  if (error)
1342
1432
  return rb_str_new2((char *)error);
1343
1433
  else
@@ -1351,6 +1441,7 @@ VALUE obj, arg1;
1351
1441
  GLubyte* str;
1352
1442
  name = (GLenum)NUM2INT(arg1);
1353
1443
  str = (GLubyte*)gluGetString(name);
1444
+
1354
1445
  if (str)
1355
1446
  return rb_str_new2((char *)str);
1356
1447
  else
@@ -1364,7 +1455,7 @@ DLLEXPORT void Init_glu()
1364
1455
  callId = rb_intern("call");
1365
1456
  refId = rb_intern("[]");
1366
1457
  module = rb_define_module("Glu");
1367
-
1458
+
1368
1459
  glu_init_enums(module);
1369
1460
 
1370
1461
  rb_define_module_function(module, "gluNewNurbsRenderer", glu_NewNurbsRenderer, 0);
@@ -1421,7 +1512,11 @@ DLLEXPORT void Init_glu()
1421
1512
  rb_define_module_function(module, "gluQuadricCallback", glu_QuadricCallback, 3);
1422
1513
  rb_define_module_function(module, "gluNurbsCallback", glu_NurbsCallback, 3);
1423
1514
 
1424
-
1515
+ Class_GLUError = rb_define_class_under(module, "Error", rb_eStandardError);
1516
+
1517
+ rb_define_method(Class_GLUError, "initialize", GLUError_initialize, 2);
1518
+ rb_define_attr(Class_GLUError, "id", 1, 0);
1519
+
1425
1520
  cNurbs = rb_define_class("Nurbs", rb_cObject);
1426
1521
  cTess = rb_define_class("Tess", rb_cObject);
1427
1522
  cQuad = rb_define_class("Quadric", rb_cObject);