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