opengl 0.7.0.pre1-x86-mingw32 → 0.7.0.pre2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.autotest +29 -0
  2. data/.gitignore +5 -8
  3. data/History.rdoc +33 -0
  4. data/Manifest.txt +72 -57
  5. data/README.rdoc +72 -25
  6. data/Rakefile +60 -72
  7. data/Rakefile.cross +5 -2
  8. data/{doc → docs}/build_install.txt +0 -0
  9. data/{doc → docs}/extensions.txt.in +0 -0
  10. data/{doc → docs}/history.txt +0 -0
  11. data/{doc → docs}/requirements_and_design.txt +0 -0
  12. data/{doc → docs}/roadmap.txt +0 -0
  13. data/{doc → docs}/scientific_use.txt +0 -0
  14. data/{doc → docs}/supplies/page_template.html +0 -0
  15. data/{doc → docs}/thanks.txt +0 -0
  16. data/{doc → docs}/tutorial.txt +0 -0
  17. data/examples/NeHe/NeHe.png +0 -0
  18. data/examples/NeHe/crate.png +0 -0
  19. data/examples/NeHe/glass.png +0 -0
  20. data/examples/NeHe/nehe_lesson02.rb +82 -83
  21. data/examples/NeHe/nehe_lesson03.rb +88 -88
  22. data/examples/NeHe/nehe_lesson04.rb +93 -96
  23. data/examples/NeHe/nehe_lesson05.rb +137 -144
  24. data/examples/NeHe/nehe_lesson06.rb +183 -0
  25. data/examples/NeHe/nehe_lesson07.rb +237 -0
  26. data/examples/NeHe/nehe_lesson08.rb +252 -0
  27. data/examples/NeHe/nehe_lesson09.rb +199 -0
  28. data/examples/NeHe/nehe_lesson11.rb +173 -0
  29. data/examples/NeHe/nehe_lesson12.rb +200 -0
  30. data/examples/NeHe/nehe_lesson16.rb +208 -0
  31. data/examples/NeHe/nehe_lesson19.rb +206 -0
  32. data/examples/NeHe/particle.png +0 -0
  33. data/examples/NeHe/star.png +0 -0
  34. data/examples/NeHe/tim.png +0 -0
  35. data/examples/RedBook/light.rb +154 -0
  36. data/examples/misc/OGLBench.rb +2 -2
  37. data/examples/misc/trislam.rb +2 -2
  38. data/ext/{common → opengl}/common.h +2 -11
  39. data/ext/{common → opengl}/conv.h +43 -31
  40. data/ext/{glut → opengl}/extconf.rb +14 -7
  41. data/ext/{common → opengl}/funcdef.h +155 -125
  42. data/ext/{gl → opengl}/gl-1.0-1.1.c +426 -162
  43. data/ext/{gl → opengl}/gl-1.2.c +70 -66
  44. data/ext/{gl → opengl}/gl-1.3.c +19 -19
  45. data/ext/{gl → opengl}/gl-1.4.c +23 -23
  46. data/ext/{gl → opengl}/gl-1.5.c +46 -47
  47. data/ext/{gl → opengl}/gl-2.0.c +66 -60
  48. data/ext/{gl → opengl}/gl-2.1.c +4 -4
  49. data/ext/{gl → opengl}/gl-enums.c +2 -1
  50. data/ext/{common → opengl}/gl-enums.h +0 -0
  51. data/ext/{gl → opengl}/gl-error.c +12 -4
  52. data/ext/{common → opengl}/gl-error.h +7 -2
  53. data/ext/{gl → opengl}/gl-ext-3dfx.c +1 -1
  54. data/ext/{gl → opengl}/gl-ext-arb.c +75 -70
  55. data/ext/{gl → opengl}/gl-ext-ati.c +3 -3
  56. data/ext/{gl → opengl}/gl-ext-ext.c +54 -54
  57. data/ext/{gl → opengl}/gl-ext-gremedy.c +3 -3
  58. data/ext/{gl → opengl}/gl-ext-nv.c +49 -48
  59. data/ext/{common → opengl}/gl-types.h +0 -0
  60. data/ext/{gl → opengl}/gl.c +8 -10
  61. data/ext/{glu → opengl}/glu-enums.c +1 -1
  62. data/ext/{common → opengl}/glu-enums.h +0 -0
  63. data/ext/{glu → opengl}/glu.c +7 -3
  64. data/ext/{glut → opengl}/glut.c +98 -48
  65. data/ext/opengl/opengl.c +11 -0
  66. data/lib/gl.rb +1 -0
  67. data/lib/glu.rb +1 -0
  68. data/lib/glut.rb +1 -0
  69. data/lib/opengl.rb +13 -14
  70. data/lib/opengl/opengl.so +0 -0
  71. data/lib/opengl/test_case.rb +87 -0
  72. data/test/{tc_misc.rb → test_gl.rb} +2 -14
  73. data/test/test_gl_10_11.rb +1363 -0
  74. data/test/test_gl_12.rb +182 -0
  75. data/test/{tc_func_13.rb → test_gl_13.rb} +14 -14
  76. data/test/test_gl_14.rb +221 -0
  77. data/test/test_gl_15.rb +260 -0
  78. data/test/test_gl_20.rb +430 -0
  79. data/test/test_gl_21.rb +553 -0
  80. data/test/test_gl_ext_arb.rb +526 -0
  81. data/test/{tc_ext_ati.rb → test_gl_ext_ati.rb} +11 -14
  82. data/test/test_gl_ext_ext.rb +608 -0
  83. data/test/{tc_ext_gremedy.rb → test_gl_ext_gremedy.rb} +6 -6
  84. data/test/test_gl_ext_nv.rb +352 -0
  85. data/test/test_glu.rb +309 -0
  86. metadata +159 -102
  87. data/History.txt +0 -36
  88. data/ext/gl/extconf.rb +0 -43
  89. data/ext/glu/extconf.rb +0 -51
  90. data/test/README +0 -10
  91. data/test/tc_common.rb +0 -98
  92. data/test/tc_ext_arb.rb +0 -467
  93. data/test/tc_ext_ext.rb +0 -551
  94. data/test/tc_ext_nv.rb +0 -357
  95. data/test/tc_func_10_11.rb +0 -1281
  96. data/test/tc_func_12.rb +0 -186
  97. data/test/tc_func_14.rb +0 -197
  98. data/test/tc_func_15.rb +0 -270
  99. data/test/tc_func_20.rb +0 -346
  100. data/test/tc_func_21.rb +0 -541
  101. data/test/tc_glu.rb +0 -310
  102. data/test/tc_include_gl.rb +0 -35
  103. data/test/tc_require_gl.rb +0 -34
@@ -13,7 +13,7 @@
13
13
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  */
15
15
 
16
- #include "../common/common.h"
16
+ #include "common.h"
17
17
 
18
18
  GL_FUNC_LOAD_2(BlendEquationSeparate,GLvoid, GLenum,GLenum, "2.0")
19
19
  GL_FUNC_LOAD_4(StencilOpSeparate,GLvoid, GLenum,GLenum,GLenum,GLenum, "2.0")
@@ -62,14 +62,14 @@ VALUE obj,arg1;
62
62
  {
63
63
  GLsizei size;
64
64
  GLenum *buffers;
65
- LOAD_GL_FUNC(glDrawBuffers,"2.0")
65
+ LOAD_GL_FUNC(glDrawBuffers, "2.0");
66
66
  Check_Type(arg1,T_ARRAY);
67
67
  size = (GLsizei)RARRAY_LENINT(arg1);
68
68
  buffers = ALLOC_N(GLenum,size);
69
69
  ary2cuint(arg1,buffers,size);
70
70
  fptr_glDrawBuffers(size,buffers);
71
71
  xfree(buffers);
72
- CHECK_GLERROR
72
+ CHECK_GLERROR_FROM("glDrawBuffers");
73
73
  return Qnil;
74
74
  }
75
75
 
@@ -80,12 +80,12 @@ VALUE obj,arg1,arg2,arg3;
80
80
  {
81
81
  GLuint program;
82
82
  GLuint index;
83
- LOAD_GL_FUNC(glBindAttribLocation,"2.0")
83
+ LOAD_GL_FUNC(glBindAttribLocation, "2.0");
84
84
  program = (GLuint)NUM2UINT(arg1);
85
85
  index = (GLuint)NUM2UINT(arg2);
86
86
  Check_Type(arg3, T_STRING);
87
87
  fptr_glBindAttribLocation(program,index,RSTRING_PTR(arg3));
88
- CHECK_GLERROR
88
+ CHECK_GLERROR_FROM("glBindAttribLocation");
89
89
  return Qnil;
90
90
  }
91
91
 
@@ -97,11 +97,11 @@ VALUE obj,arg1,arg2;
97
97
  GLuint program;
98
98
  GLenum pname;
99
99
  GLint params = 0;
100
- LOAD_GL_FUNC(glGetProgramiv,"2.0")
100
+ LOAD_GL_FUNC(glGetProgramiv, "2.0");
101
101
  program = (GLuint)NUM2UINT(arg1);
102
102
  pname = (GLenum)NUM2INT(arg2);
103
103
  fptr_glGetProgramiv(program,pname,&params);
104
- CHECK_GLERROR
104
+ CHECK_GLERROR_FROM("glGetProgramiv");
105
105
  return cond_GLBOOL2RUBY(pname,params);
106
106
  }
107
107
 
@@ -118,12 +118,12 @@ VALUE obj,arg1,arg2;
118
118
  GLenum attrib_type = 0;
119
119
  VALUE buffer;
120
120
  VALUE retary;
121
- LOAD_GL_FUNC(glGetActiveAttrib,"2.0")
122
- LOAD_GL_FUNC(glGetProgramiv,"2.0")
121
+ LOAD_GL_FUNC(glGetActiveAttrib, "2.0");
122
+ LOAD_GL_FUNC(glGetProgramiv, "2.0");
123
123
  program = (GLuint)NUM2UINT(arg1);
124
124
  index = (GLuint)NUM2UINT(arg2);
125
125
  fptr_glGetProgramiv(program,GL_ACTIVE_ATTRIBUTE_MAX_LENGTH,&max_size);
126
- CHECK_GLERROR
126
+ CHECK_GLERROR_FROM("glGetProgramiv");
127
127
  if (max_size==0)
128
128
  rb_raise(rb_eTypeError, "Can't determine maximum attribute name length");
129
129
  buffer = allocate_buffer_with_string(max_size-1);
@@ -132,7 +132,7 @@ VALUE obj,arg1,arg2;
132
132
  rb_ary_push(retary, INT2NUM(attrib_size));
133
133
  rb_ary_push(retary, INT2NUM(attrib_type));
134
134
  rb_ary_push(retary, buffer);
135
- CHECK_GLERROR
135
+ CHECK_GLERROR_FROM("glGetActiveAttrib");
136
136
  return retary;
137
137
  }
138
138
 
@@ -149,21 +149,24 @@ VALUE obj,arg1,arg2;
149
149
  GLenum uniform_type = 0;
150
150
  VALUE buffer;
151
151
  VALUE retary;
152
- LOAD_GL_FUNC(glGetActiveUniform,"2.0")
153
- LOAD_GL_FUNC(glGetProgramiv,"2.0")
152
+ LOAD_GL_FUNC(glGetActiveUniform, "2.0");
153
+ LOAD_GL_FUNC(glGetProgramiv, "2.0");
154
154
  program = (GLuint)NUM2UINT(arg1);
155
155
  index = (GLuint)NUM2UINT(arg2);
156
156
  fptr_glGetProgramiv(program,GL_ACTIVE_UNIFORM_MAX_LENGTH,&max_size);
157
- CHECK_GLERROR
157
+ CHECK_GLERROR_FROM("glGetProgramiv");
158
158
  if (max_size==0)
159
159
  rb_raise(rb_eTypeError, "Can't determine maximum uniform name length");
160
160
  buffer = allocate_buffer_with_string(max_size-1);
161
+
161
162
  fptr_glGetActiveUniform(program,index,max_size,&written,&uniform_size,&uniform_type,RSTRING_PTR(buffer));
163
+
164
+ rb_str_set_len(buffer, strnlen(RSTRING_PTR(buffer), max_size));
162
165
  retary = rb_ary_new2(3);
163
166
  rb_ary_push(retary, INT2NUM(uniform_size));
164
167
  rb_ary_push(retary, INT2NUM(uniform_type));
165
168
  rb_ary_push(retary, buffer);
166
- CHECK_GLERROR
169
+ CHECK_GLERROR_FROM("glGetActiveUniform");
167
170
  return retary;
168
171
  }
169
172
 
@@ -176,16 +179,17 @@ VALUE obj,arg1;
176
179
  GLint shaders_num = 0;
177
180
  GLuint *shaders;
178
181
  GLsizei count = 0;
179
- LOAD_GL_FUNC(glGetAttachedShaders,"2.0")
180
- LOAD_GL_FUNC(glGetProgramiv,"2.0")
182
+ LOAD_GL_FUNC(glGetAttachedShaders, "2.0");
183
+ LOAD_GL_FUNC(glGetProgramiv, "2.0");
181
184
  program = (GLuint)NUM2UINT(arg1);
182
185
  fptr_glGetProgramiv(program,GL_ATTACHED_SHADERS,&shaders_num);
183
- CHECK_GLERROR
186
+ CHECK_GLERROR_FROM("glGetProgramiv");
184
187
  if (shaders_num<=0)
185
188
  return Qnil;
186
189
  shaders = ALLOC_N(GLuint,shaders_num);
187
190
  fptr_glGetAttachedShaders(program,shaders_num,&count,shaders);
188
- RET_ARRAY_OR_SINGLE_FREE(count,RETCONV_GLuint,shaders)
191
+ RET_ARRAY_OR_SINGLE_FREE("glGetAttachedShaders", count, RETCONV_GLuint,
192
+ shaders);
189
193
  }
190
194
 
191
195
  static GLint (APIENTRY * fptr_glGetAttribLocation)(GLuint, GLchar *);
@@ -195,11 +199,11 @@ VALUE obj,arg1,arg2;
195
199
  {
196
200
  GLuint program;
197
201
  GLint ret;
198
- LOAD_GL_FUNC(glGetAttribLocation,"2.0")
202
+ LOAD_GL_FUNC(glGetAttribLocation, "2.0");
199
203
  program=(GLuint)NUM2UINT(arg1);
200
204
  Check_Type(arg2,T_STRING);
201
205
  ret = fptr_glGetAttribLocation(program,RSTRING_PTR(arg2));
202
- CHECK_GLERROR
206
+ CHECK_GLERROR_FROM("glGetAttribLocation");
203
207
  return INT2NUM(ret);
204
208
  }
205
209
 
@@ -212,16 +216,16 @@ VALUE obj,arg1;
212
216
  GLint max_size = 0;
213
217
  GLsizei ret_length = 0;
214
218
  VALUE buffer;
215
- LOAD_GL_FUNC(glGetProgramInfoLog,"2.0")
216
- LOAD_GL_FUNC(glGetProgramiv,"2.0")
219
+ LOAD_GL_FUNC(glGetProgramInfoLog, "2.0");
220
+ LOAD_GL_FUNC(glGetProgramiv, "2.0");
217
221
  program = (GLuint)NUM2UINT(arg1);
218
222
  fptr_glGetProgramiv(program,GL_INFO_LOG_LENGTH,&max_size);
219
- CHECK_GLERROR
223
+ CHECK_GLERROR_FROM("glGetProgramiv");
220
224
  if (max_size<=0)
221
225
  return rb_str_new2("");
222
226
  buffer = allocate_buffer_with_string(max_size);
223
227
  fptr_glGetProgramInfoLog(program,max_size,&ret_length,RSTRING_PTR(buffer));
224
- CHECK_GLERROR
228
+ CHECK_GLERROR_FROM("glGetProgramInfoLog");
225
229
  return buffer;
226
230
  }
227
231
 
@@ -233,11 +237,11 @@ VALUE obj,arg1,arg2;
233
237
  GLuint program;
234
238
  GLenum pname;
235
239
  GLint params = 0;
236
- LOAD_GL_FUNC(glGetShaderiv,"2.0")
240
+ LOAD_GL_FUNC(glGetShaderiv, "2.0");
237
241
  program = (GLuint)NUM2UINT(arg1);
238
242
  pname = (GLenum)NUM2INT(arg2);
239
243
  fptr_glGetShaderiv(program,pname,&params);
240
- CHECK_GLERROR
244
+ CHECK_GLERROR_FROM("glGetShaderiv");
241
245
  return cond_GLBOOL2RUBY(pname,params);
242
246
  }
243
247
 
@@ -251,11 +255,11 @@ VALUE obj,arg1;
251
255
  GLsizei ret_length = 0;
252
256
  VALUE ret_buffer;
253
257
  GLchar *buffer;
254
- LOAD_GL_FUNC(glGetShaderInfoLog,"2.0")
255
- LOAD_GL_FUNC(glGetShaderiv,"2.0")
258
+ LOAD_GL_FUNC(glGetShaderInfoLog, "2.0");
259
+ LOAD_GL_FUNC(glGetShaderiv, "2.0");
256
260
  program = (GLuint)NUM2UINT(arg1);
257
261
  fptr_glGetShaderiv(program,GL_INFO_LOG_LENGTH,&max_size);
258
- CHECK_GLERROR
262
+ CHECK_GLERROR_FROM("glGetShaderiv");
259
263
  if (max_size<=0)
260
264
  return rb_str_new2("");
261
265
  buffer = ALLOC_N(GLchar,max_size+1);
@@ -263,7 +267,7 @@ VALUE obj,arg1;
263
267
  fptr_glGetShaderInfoLog(program,max_size,&ret_length,buffer);
264
268
  ret_buffer = rb_str_new(buffer, ret_length);
265
269
  xfree(buffer);
266
- CHECK_GLERROR
270
+ CHECK_GLERROR_FROM("glGetShaderInfoLog");
267
271
  return ret_buffer;
268
272
  }
269
273
 
@@ -276,16 +280,16 @@ VALUE obj,arg1;
276
280
  GLint max_size = 0;
277
281
  GLsizei ret_length = 0;
278
282
  VALUE buffer;
279
- LOAD_GL_FUNC(glGetShaderSource,"2.0")
280
- LOAD_GL_FUNC(glGetShaderiv,"2.0")
283
+ LOAD_GL_FUNC(glGetShaderSource, "2.0");
284
+ LOAD_GL_FUNC(glGetShaderiv, "2.0");
281
285
  shader = (GLuint)NUM2UINT(arg1);
282
286
  fptr_glGetShaderiv(shader,GL_SHADER_SOURCE_LENGTH,&max_size);
283
- CHECK_GLERROR
287
+ CHECK_GLERROR_FROM("glGetShaderiv");
284
288
  if (max_size==0)
285
289
  rb_raise(rb_eTypeError, "Can't determine maximum shader source length");
286
290
  buffer = allocate_buffer_with_string(max_size-1);
287
291
  fptr_glGetShaderSource(shader,max_size,&ret_length,RSTRING_PTR(buffer));
288
- CHECK_GLERROR
292
+ CHECK_GLERROR_FROM("glGetShaderSource");
289
293
  return buffer;
290
294
  }
291
295
 
@@ -296,11 +300,12 @@ VALUE obj,arg1,arg2;
296
300
  {
297
301
  GLuint program;
298
302
  GLint ret;
299
- LOAD_GL_FUNC(glGetUniformLocation,"2.0")
303
+ LOAD_GL_FUNC(glGetUniformLocation, "2.0");
300
304
  program=(GLuint)NUM2UINT(arg1);
301
305
  Check_Type(arg2,T_STRING);
302
- ret = fptr_glGetUniformLocation(program,RSTRING_PTR(arg2));
303
- CHECK_GLERROR
306
+ ret = fptr_glGetUniformLocation(program, RSTRING_PTR(arg2));
307
+
308
+ CHECK_GLERROR_FROM("glGetUniformLocation");
304
309
  return INT2NUM(ret);
305
310
  }
306
311
 
@@ -317,13 +322,13 @@ VALUE obj,arg1,arg2; \
317
322
  GLenum uniform_type = 0; \
318
323
  GLint uniform_size = 0; \
319
324
  \
320
- LOAD_GL_FUNC(gl##_name_,"2.0") \
321
- LOAD_GL_FUNC(glGetActiveUniform,"2.0") \
325
+ LOAD_GL_FUNC(gl##_name_, "2.0"); \
326
+ LOAD_GL_FUNC(glGetActiveUniform, "2.0"); \
322
327
  program = (GLuint)NUM2UINT(arg1); \
323
328
  location = (GLint)NUM2INT(arg2); \
324
329
  \
325
330
  fptr_glGetActiveUniform(program,location,0,NULL,&unused,&uniform_type,NULL); \
326
- CHECK_GLERROR \
331
+ CHECK_GLERROR_FROM("glGetActiveUniform"); \
327
332
  if (uniform_type==0) \
328
333
  rb_raise(rb_eTypeError, "Can't determine the uniform's type"); \
329
334
  \
@@ -331,7 +336,7 @@ VALUE obj,arg1,arg2; \
331
336
  \
332
337
  memset(params,0,16*sizeof(_type_)); \
333
338
  fptr_gl##_name_(program,location,params); \
334
- RET_ARRAY_OR_SINGLE(uniform_size,RETCONV_##_type_,params) \
339
+ RET_ARRAY_OR_SINGLE("gl" #_name_, uniform_size, RETCONV_##_type_, params); \
335
340
  }
336
341
 
337
342
  GETUNIFORM_FUNC(GetUniformfv,GLfloat)
@@ -348,7 +353,7 @@ VALUE obj,arg1,arg2; \
348
353
  GLenum pname; \
349
354
  _type_ params[4] = {0,0,0,0}; \
350
355
  GLint size; \
351
- LOAD_GL_FUNC(gl##_name_,"2.0") \
356
+ LOAD_GL_FUNC(gl##_name_, "2.0"); \
352
357
  index = (GLuint)NUM2UINT(arg1); \
353
358
  pname = (GLenum)NUM2INT(arg2); \
354
359
  if (pname==GL_CURRENT_VERTEX_ATTRIB) \
@@ -356,7 +361,7 @@ VALUE obj,arg1,arg2; \
356
361
  else \
357
362
  size = 1; \
358
363
  fptr_gl##_name_(index,pname,params); \
359
- RET_ARRAY_OR_SINGLE(size,RETCONV_##_type_,params) \
364
+ RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
360
365
  }
361
366
 
362
367
  GETVERTEXATTRIB_FUNC(GetVertexAttribdv,GLdouble)
@@ -373,7 +378,7 @@ VALUE obj,arg1,arg2;
373
378
  GLenum pname;
374
379
  GLint params[4] = {0,0,0,0};
375
380
  GLint size;
376
- LOAD_GL_FUNC(glGetVertexAttribiv,"2.0")
381
+ LOAD_GL_FUNC(glGetVertexAttribiv, "2.0");
377
382
  index = (GLuint)NUM2UINT(arg1);
378
383
  pname = (GLenum)NUM2INT(arg2);
379
384
  if (pname==GL_CURRENT_VERTEX_ATTRIB)
@@ -381,7 +386,8 @@ VALUE obj,arg1,arg2;
381
386
  else
382
387
  size = 1;
383
388
  fptr_glGetVertexAttribiv(index,pname,params);
384
- RET_ARRAY_OR_SINGLE_BOOL(size,cond_GLBOOL2RUBY,pname,params)
389
+ RET_ARRAY_OR_SINGLE_BOOL("glGetVertexAttribiv", size, cond_GLBOOL2RUBY,
390
+ pname, params);
385
391
  }
386
392
 
387
393
 
@@ -393,7 +399,7 @@ gl_GetVertexAttribPointerv(obj,arg1)
393
399
  VALUE obj,arg1;
394
400
  {
395
401
  GLuint index;
396
- LOAD_GL_FUNC(glGetVertexAttribPointerv,"2.0")
402
+ LOAD_GL_FUNC(glGetVertexAttribPointerv, "2.0");
397
403
  index =(GLuint) NUM2INT(arg1);
398
404
  if (index>_MAX_VERTEX_ATTRIBS)
399
405
  rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
@@ -409,13 +415,13 @@ VALUE obj,arg1,arg2;
409
415
  GLuint shader;
410
416
  GLint length;
411
417
  GLchar *str;
412
- LOAD_GL_FUNC(glShaderSource,"2.0")
418
+ LOAD_GL_FUNC(glShaderSource, "2.0");
413
419
  shader = (GLuint)NUM2UINT(arg1);
414
420
  Check_Type(arg2,T_STRING);
415
421
  str = RSTRING_PTR(arg2);
416
422
  length = (GLint)RSTRING_LENINT(arg2);
417
423
  fptr_glShaderSource(shader,1,&str,&length);
418
- CHECK_GLERROR
424
+ CHECK_GLERROR_FROM("glShaderSource");
419
425
  return Qnil;
420
426
  }
421
427
 
@@ -428,7 +434,7 @@ VALUE obj,arg1,arg2; \
428
434
  GLint location; \
429
435
  GLsizei count; \
430
436
  _type_ *value; \
431
- LOAD_GL_FUNC(gl##_name_,"2.0") \
437
+ LOAD_GL_FUNC(gl##_name_,"2.0"); \
432
438
  Check_Type(arg2,T_ARRAY); \
433
439
  count = (GLsizei)RARRAY_LENINT(arg2); \
434
440
  if (count<=0 || (count % _size_) != 0) \
@@ -438,7 +444,7 @@ VALUE obj,arg1,arg2; \
438
444
  _conv_(arg2,value,count); \
439
445
  fptr_gl##_name_(location,count / _size_,value); \
440
446
  xfree(value); \
441
- CHECK_GLERROR \
447
+ CHECK_GLERROR_FROM("gl" #_name_); \
442
448
  return Qnil; \
443
449
  }
444
450
 
@@ -462,15 +468,15 @@ VALUE obj,arg1,arg2,arg3; \
462
468
  GLsizei count; \
463
469
  GLboolean transpose; \
464
470
  GLfloat *value; \
465
- LOAD_GL_FUNC(gl##_name_,"2.0") \
471
+ LOAD_GL_FUNC(gl##_name_, "2.0"); \
466
472
  location = (GLint)NUM2INT(arg1); \
467
- count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3),rb_intern("flatten"),0)); \
468
- transpose = (GLboolean)NUM2INT(arg2); \
473
+ count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3), rb_intern("flatten"), 0)); \
474
+ transpose = (GLboolean)RUBYBOOL2GL(arg2); \
469
475
  value = ALLOC_N(GLfloat, count); \
470
476
  ary2cmatfloatcount(arg3,value,_size_,_size_); \
471
477
  fptr_gl##_name_(location,count / (_size_*_size_),transpose,value); \
472
478
  xfree(value); \
473
- CHECK_GLERROR \
479
+ CHECK_GLERROR_FROM("gl" #_name_); \
474
480
  return Qnil; \
475
481
  }
476
482
 
@@ -487,11 +493,11 @@ VALUE obj,arg1,arg2; \
487
493
  { \
488
494
  GLuint index; \
489
495
  _type_ v[_size_]; \
490
- LOAD_GL_FUNC(gl##_name_,"2.0") \
496
+ LOAD_GL_FUNC(gl##_name_, "2.0"); \
491
497
  index = (GLuint)NUM2UINT(arg1); \
492
498
  _conv_(arg2,v,_size_); \
493
499
  fptr_gl##_name_(index,v); \
494
- CHECK_GLERROR \
500
+ CHECK_GLERROR_FROM("gl" #_name_); \
495
501
  return Qnil; \
496
502
  }
497
503
 
@@ -530,11 +536,11 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
530
536
  GLenum type;
531
537
  GLboolean normalized;
532
538
  GLsizei stride;
533
- LOAD_GL_FUNC(glVertexAttribPointer,"2.0")
539
+ LOAD_GL_FUNC(glVertexAttribPointer, "2.0");
534
540
  index = (GLuint)NUM2UINT(arg1);
535
541
  size = (GLuint)NUM2UINT(arg2);
536
542
  type = (GLenum)NUM2INT(arg3);
537
- normalized = (GLboolean)NUM2INT(arg4);
543
+ normalized = (GLboolean)RUBYBOOL2GL(arg4);
538
544
  stride = (GLsizei)NUM2UINT(arg5);
539
545
  if (index>_MAX_VERTEX_ATTRIBS)
540
546
  rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
@@ -549,7 +555,7 @@ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
549
555
  g_VertexAttrib_ptr[index] = data;
550
556
  fptr_glVertexAttribPointer(index,size,type,normalized,stride,(GLvoid *)RSTRING_PTR(data));
551
557
  }
552
- CHECK_GLERROR
558
+ CHECK_GLERROR_FROM("glVertexAttribPointer");
553
559
  return Qnil;
554
560
  }
555
561
 
@@ -13,7 +13,7 @@
13
13
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  */
15
15
 
16
- #include "../common/common.h"
16
+ #include "common.h"
17
17
 
18
18
  #define UNIFORMMATRIX_FUNC(_x_,_y_) \
19
19
  static void (APIENTRY * fptr_glUniformMatrix##_x_##x##_y_##fv)(GLint,GLsizei,GLboolean,GLfloat *); \
@@ -25,15 +25,15 @@ VALUE obj,arg1,arg2,arg3; \
25
25
  GLsizei count; \
26
26
  GLboolean transpose; \
27
27
  GLfloat *value; \
28
- LOAD_GL_FUNC(glUniformMatrix##_x_##x##_y_##fv,"2.1") \
28
+ LOAD_GL_FUNC(glUniformMatrix##_x_##x##_y_##fv,"2.1"); \
29
29
  location = (GLint)NUM2INT(arg1); \
30
30
  count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3),rb_intern("flatten"),0)); \
31
- transpose = (GLboolean)NUM2INT(arg2); \
31
+ transpose = (GLboolean)RUBYBOOL2GL(arg2); \
32
32
  value = ALLOC_N(GLfloat, count); \
33
33
  ary2cmatfloatcount(arg3,value, _x_, _y_); \
34
34
  fptr_glUniformMatrix##_x_##x##_y_##fv(location,count /(_x_ * _y_),transpose,value); \
35
35
  xfree(value); \
36
- CHECK_GLERROR \
36
+ CHECK_GLERROR_FROM("glUniformMatrix" #_x_ "x" #_y_ "fv"); \
37
37
  return Qnil; \
38
38
  }
39
39
 
@@ -3,7 +3,8 @@
3
3
  source: http://www.opengl.org/registry/api/enumext.spec
4
4
  */
5
5
 
6
- #include "../common/common.h"
6
+ #include "common.h"
7
+
7
8
  void gl_init_enums(VALUE module)
8
9
  {
9
10
  rb_define_const(module, "GL_TRUE", Qtrue);
File without changes
@@ -13,7 +13,7 @@
13
13
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
14
  */
15
15
 
16
- #include "../common/common.h"
16
+ #include "common.h"
17
17
 
18
18
  VALUE error_checking = Qtrue;
19
19
 
@@ -21,7 +21,7 @@ VALUE Class_GLError;
21
21
 
22
22
  #define BUFSIZE 256
23
23
 
24
- void check_for_glerror(void)
24
+ void check_for_glerror(const char *caller)
25
25
  {
26
26
  GLenum error;
27
27
 
@@ -31,9 +31,16 @@ void check_for_glerror(void)
31
31
  return;
32
32
  } else { /* process errors */
33
33
  const char *error_string;
34
+ const char *from = "";
34
35
  int queued_errors = 0;
35
36
  char message[BUFSIZE];
36
37
  VALUE exc;
38
+
39
+ if (caller) {
40
+ from = " for ";
41
+ } else {
42
+ caller = "";
43
+ }
37
44
 
38
45
  /* check for queued errors */
39
46
  for(queued_errors = 0;
@@ -54,9 +61,10 @@ void check_for_glerror(void)
54
61
  }
55
62
 
56
63
  if (queued_errors==0) {
57
- snprintf(message,BUFSIZE,"%s",error_string);
64
+ snprintf(message, BUFSIZE, "%s%s%s", error_string, from, caller);
58
65
  } else {
59
- snprintf(message,BUFSIZE,"%s [%i queued error(s) cleaned]",error_string,queued_errors);
66
+ snprintf(message, BUFSIZE, "%s%s%s [%i queued error(s) cleaned]",
67
+ error_string, from, caller, queued_errors);
60
68
  }
61
69
 
62
70
  exc = rb_funcall(Class_GLError, rb_intern("new"), 2, rb_str_new2(message), INT2NUM(error));