danabr75-opengl 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/.autotest +29 -0
  3. data/.gemtest +0 -0
  4. data/.gitignore +6 -0
  5. data/.travis.yml +19 -0
  6. data/Gemfile +8 -0
  7. data/History.md +101 -0
  8. data/MIT-LICENSE +18 -0
  9. data/Manifest.txt +142 -0
  10. data/README.rdoc +105 -0
  11. data/Rakefile +170 -0
  12. data/danabr75-opengl.gemspec +32 -0
  13. data/examples/NeHe/NeHe.png +0 -0
  14. data/examples/NeHe/crate.png +0 -0
  15. data/examples/NeHe/glass.png +0 -0
  16. data/examples/NeHe/nehe_lesson02.rb +117 -0
  17. data/examples/NeHe/nehe_lesson03.rb +123 -0
  18. data/examples/NeHe/nehe_lesson04.rb +132 -0
  19. data/examples/NeHe/nehe_lesson05.rb +182 -0
  20. data/examples/NeHe/nehe_lesson06.rb +186 -0
  21. data/examples/NeHe/nehe_lesson07.rb +240 -0
  22. data/examples/NeHe/nehe_lesson08.rb +255 -0
  23. data/examples/NeHe/nehe_lesson09.rb +203 -0
  24. data/examples/NeHe/nehe_lesson11.rb +176 -0
  25. data/examples/NeHe/nehe_lesson12.rb +203 -0
  26. data/examples/NeHe/nehe_lesson16.rb +211 -0
  27. data/examples/NeHe/nehe_lesson19.rb +209 -0
  28. data/examples/NeHe/nehe_lesson36.rb +308 -0
  29. data/examples/NeHe/particle.png +0 -0
  30. data/examples/NeHe/star.png +0 -0
  31. data/examples/NeHe/tim.png +0 -0
  32. data/examples/OrangeBook/3Dlabs-License.txt +33 -0
  33. data/examples/OrangeBook/brick.frag +36 -0
  34. data/examples/OrangeBook/brick.rb +378 -0
  35. data/examples/OrangeBook/brick.vert +41 -0
  36. data/examples/OrangeBook/particle.frag +17 -0
  37. data/examples/OrangeBook/particle.rb +408 -0
  38. data/examples/OrangeBook/particle.vert +38 -0
  39. data/examples/README +16 -0
  40. data/examples/RedBook/aapoly.rb +143 -0
  41. data/examples/RedBook/aargb.rb +121 -0
  42. data/examples/RedBook/accanti.rb +164 -0
  43. data/examples/RedBook/accpersp.rb +217 -0
  44. data/examples/RedBook/alpha.rb +125 -0
  45. data/examples/RedBook/alpha3D.rb +160 -0
  46. data/examples/RedBook/bezcurve.rb +107 -0
  47. data/examples/RedBook/bezmesh.rb +139 -0
  48. data/examples/RedBook/checker.rb +126 -0
  49. data/examples/RedBook/clip.rb +97 -0
  50. data/examples/RedBook/colormat.rb +137 -0
  51. data/examples/RedBook/cube.rb +71 -0
  52. data/examples/RedBook/depthcue.rb +101 -0
  53. data/examples/RedBook/dof.rb +206 -0
  54. data/examples/RedBook/double.rb +107 -0
  55. data/examples/RedBook/drawf.rb +93 -0
  56. data/examples/RedBook/feedback.rb +147 -0
  57. data/examples/RedBook/fog.rb +168 -0
  58. data/examples/RedBook/font.rb +153 -0
  59. data/examples/RedBook/hello.rb +81 -0
  60. data/examples/RedBook/image.rb +139 -0
  61. data/examples/RedBook/jitter.rb +207 -0
  62. data/examples/RedBook/light.rb +157 -0
  63. data/examples/RedBook/lines.rb +130 -0
  64. data/examples/RedBook/list.rb +113 -0
  65. data/examples/RedBook/material.rb +276 -0
  66. data/examples/RedBook/mipmap.rb +158 -0
  67. data/examples/RedBook/model.rb +115 -0
  68. data/examples/RedBook/movelight.rb +134 -0
  69. data/examples/RedBook/pickdepth.rb +181 -0
  70. data/examples/RedBook/planet.rb +110 -0
  71. data/examples/RedBook/quadric.rb +160 -0
  72. data/examples/RedBook/robot.rb +117 -0
  73. data/examples/RedBook/select.rb +198 -0
  74. data/examples/RedBook/smooth.rb +97 -0
  75. data/examples/RedBook/stencil.rb +165 -0
  76. data/examples/RedBook/stroke.rb +169 -0
  77. data/examples/RedBook/surface.rb +168 -0
  78. data/examples/RedBook/teaambient.rb +134 -0
  79. data/examples/RedBook/teapots.rb +184 -0
  80. data/examples/RedBook/tess.rb +185 -0
  81. data/examples/RedBook/texbind.rb +149 -0
  82. data/examples/RedBook/texgen.rb +171 -0
  83. data/examples/RedBook/texturesurf.rb +130 -0
  84. data/examples/RedBook/varray.rb +161 -0
  85. data/examples/RedBook/wrap.rb +150 -0
  86. data/examples/misc/OGLBench.rb +338 -0
  87. data/examples/misc/anisotropic.rb +196 -0
  88. data/examples/misc/fbo_test.rb +357 -0
  89. data/examples/misc/font-glut.rb +47 -0
  90. data/examples/misc/glfwtest.rb +30 -0
  91. data/examples/misc/plane.rb +161 -0
  92. data/examples/misc/readpixel.rb +66 -0
  93. data/examples/misc/sdltest.rb +36 -0
  94. data/examples/misc/trislam.rb +829 -0
  95. data/ext/opengl/GL/gl.h +2115 -0
  96. data/ext/opengl/GL/glext.h +11770 -0
  97. data/ext/opengl/common.h +372 -0
  98. data/ext/opengl/conv.h +247 -0
  99. data/ext/opengl/extconf.rb +19 -0
  100. data/ext/opengl/fptr_struct.h +912 -0
  101. data/ext/opengl/funcdef.h +279 -0
  102. data/ext/opengl/gl-1.0-1.1.c +3345 -0
  103. data/ext/opengl/gl-1.2.c +155 -0
  104. data/ext/opengl/gl-1.3.c +447 -0
  105. data/ext/opengl/gl-1.4.c +346 -0
  106. data/ext/opengl/gl-1.5.c +225 -0
  107. data/ext/opengl/gl-2.0.c +665 -0
  108. data/ext/opengl/gl-2.1.c +57 -0
  109. data/ext/opengl/gl-3.0.c +502 -0
  110. data/ext/opengl/gl-enums.c +4853 -0
  111. data/ext/opengl/gl-enums.h +14528 -0
  112. data/ext/opengl/gl-error.c +110 -0
  113. data/ext/opengl/gl-error.h +25 -0
  114. data/ext/opengl/gl-ext-3dfx.c +27 -0
  115. data/ext/opengl/gl-ext-arb.c +880 -0
  116. data/ext/opengl/gl-ext-ati.c +41 -0
  117. data/ext/opengl/gl-ext-ext.c +885 -0
  118. data/ext/opengl/gl-ext-gremedy.c +41 -0
  119. data/ext/opengl/gl-ext-nv.c +679 -0
  120. data/ext/opengl/gl.c +265 -0
  121. data/ext/opengl/gl_buffer.c +202 -0
  122. data/ext/opengl/glimpl.c +187 -0
  123. data/ext/opengl/glimpl.h +47 -0
  124. data/ext/opengl/opengl.c +9 -0
  125. data/lib/gl.rb +1 -0
  126. data/lib/opengl.rb +79 -0
  127. data/lib/opengl/bindings_version.rb +4 -0
  128. data/lib/opengl/implementation.rb +38 -0
  129. data/lib/opengl/test_case.rb +86 -0
  130. data/test/dummy.xorg.conf +140 -0
  131. data/test/test_gl.rb +45 -0
  132. data/test/test_gl_10_11.rb +1363 -0
  133. data/test/test_gl_12.rb +71 -0
  134. data/test/test_gl_13.rb +221 -0
  135. data/test/test_gl_14.rb +218 -0
  136. data/test/test_gl_15.rb +258 -0
  137. data/test/test_gl_20.rb +417 -0
  138. data/test/test_gl_21.rb +436 -0
  139. data/test/test_gl_ext_arb.rb +508 -0
  140. data/test/test_gl_ext_ati.rb +28 -0
  141. data/test/test_gl_ext_ext.rb +608 -0
  142. data/test/test_gl_ext_gremedy.rb +29 -0
  143. data/test/test_gl_ext_nv.rb +349 -0
  144. data/test/test_glimpl.rb +23 -0
  145. data/test/test_opengl_buffer.rb +122 -0
  146. data/utils/README +6 -0
  147. data/utils/enumgen.rb +108 -0
  148. data/utils/extlistgen.rb +90 -0
  149. metadata +326 -0
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
3
+ *
4
+ * This program is distributed under the terms of the MIT license.
5
+ * See the included MIT-LICENSE file for the terms of this license.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
12
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
13
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ */
15
+
16
+ #include "common.h"
17
+
18
+ VALUE Class_GLError;
19
+
20
+ #define BUFSIZE 256
21
+
22
+ void check_for_glerror(VALUE obj, const char *caller)
23
+ {
24
+ GLenum error;
25
+ DECL_GL_FUNC_PTR(GLenum,glGetError,(void));
26
+
27
+ LOAD_GL_FUNC(glGetError, NULL);
28
+ error = fptr_glGetError();
29
+
30
+ if (error==GL_NO_ERROR) { /* no errors == instant return */
31
+ return;
32
+ } else { /* process errors */
33
+ const char *error_string;
34
+ const char *from = "";
35
+ int queued_errors = 0;
36
+ char message[BUFSIZE];
37
+ VALUE exc;
38
+
39
+ if (caller) {
40
+ from = " for ";
41
+ } else {
42
+ caller = "";
43
+ }
44
+
45
+ /* check for queued errors */
46
+ for(queued_errors = 0;
47
+ fptr_glGetError()!=GL_NO_ERROR;
48
+ queued_errors++)
49
+ ;
50
+
51
+ switch(error) {
52
+ case GL_INVALID_ENUM: error_string = "invalid enumerant"; break;
53
+ case GL_INVALID_VALUE: error_string = "invalid value"; break;
54
+ case GL_INVALID_OPERATION: error_string = "invalid operation"; break;
55
+ case GL_STACK_OVERFLOW: error_string = "stack overflow"; break;
56
+ case GL_STACK_UNDERFLOW: error_string = "stack underflow"; break;
57
+ case GL_OUT_OF_MEMORY: error_string = "out of memory"; break;
58
+ case GL_TABLE_TOO_LARGE: error_string = "table too large"; break;
59
+ case GL_INVALID_FRAMEBUFFER_OPERATION_EXT: error_string = "invalid framebuffer operation"; break;
60
+ default: error_string = "unknown error"; break;
61
+ }
62
+
63
+ if (queued_errors==0) {
64
+ snprintf(message, BUFSIZE, "%s%s%s", error_string, from, caller);
65
+ } else {
66
+ snprintf(message, BUFSIZE, "%s%s%s [%i queued error(s) cleaned]",
67
+ error_string, from, caller, queued_errors);
68
+ }
69
+
70
+ exc = rb_funcall(Class_GLError, rb_intern("new"), 2, rb_str_new2(message), INT2NUM(error));
71
+ rb_funcall(rb_cObject, rb_intern("raise"), 1, exc);
72
+ }
73
+ }
74
+
75
+ VALUE GLError_initialize(VALUE obj,VALUE message, VALUE error_id)
76
+ {
77
+ rb_call_super(1, &message);
78
+ rb_iv_set(obj, "@id", error_id);
79
+
80
+ return obj;
81
+ }
82
+
83
+ static VALUE enable_error_checking(VALUE obj)
84
+ {
85
+ SET_GLIMPL_VARIABLE(error_checking, Qtrue);
86
+ return Qnil;
87
+ }
88
+
89
+ static VALUE disable_error_checking(VALUE obj)
90
+ {
91
+ SET_GLIMPL_VARIABLE(error_checking, Qfalse);
92
+ return Qnil;
93
+ }
94
+
95
+ static VALUE is_error_checking_enabled(VALUE obj)
96
+ {
97
+ return GET_GLIMPL_VARIABLE(error_checking);
98
+ }
99
+
100
+ void gl_init_error(VALUE klass, VALUE module)
101
+ {
102
+ Class_GLError = rb_define_class_under(module, "Error", rb_eStandardError);
103
+
104
+ rb_define_method(Class_GLError, "initialize", GLError_initialize, 2);
105
+ rb_define_attr(Class_GLError, "id", 1, 0);
106
+
107
+ rb_define_method(klass, "enable_error_checking", enable_error_checking, 0);
108
+ rb_define_method(klass, "disable_error_checking", disable_error_checking, 0);
109
+ rb_define_method(klass, "is_error_checking_enabled?", is_error_checking_enabled, 0);
110
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
3
+ *
4
+ * This program is distributed under the terms of the MIT license.
5
+ * See the included MIT-LICENSE file for the terms of this license.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
12
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
13
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ */
15
+
16
+ void gl_init_error(VALUE, VALUE);
17
+
18
+ void check_for_glerror(VALUE self, const char *);
19
+
20
+ #define CHECK_GLERROR_FROM(caller) \
21
+ do { \
22
+ if (GET_GLIMPL_VARIABLE(error_checking) == Qtrue && GET_GLIMPL_VARIABLE(inside_begin_end) == Qfalse) \
23
+ check_for_glerror(obj, caller); \
24
+ } while (0)
25
+
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
3
+ *
4
+ * This program is distributed under the terms of the MIT license.
5
+ * See the included MIT-LICENSE file for the terms of this license.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
12
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
13
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ */
15
+
16
+ #include "common.h"
17
+
18
+ /* OpenGL 3DFX extensions */
19
+
20
+ /* #208 - GL_3DFX_tbuffer */
21
+ GL_FUNC_LOAD_1(TbufferMask3DFX,GLvoid, GLuint, "GL_3DFX_tbuffer")
22
+
23
+ void gl_init_functions_ext_3dfx(VALUE klass)
24
+ {
25
+ /* #208 - GL_3DFX_tbuffer */
26
+ rb_define_method(klass, "glTbufferMask3DFX", gl_TbufferMask3DFX, 1);
27
+ }
@@ -0,0 +1,880 @@
1
+ /*
2
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
3
+ *
4
+ * This program is distributed under the terms of the MIT license.
5
+ * See the included MIT-LICENSE file for the terms of this license.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
8
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
9
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
10
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
11
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
12
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
13
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ */
15
+
16
+ #include "common.h"
17
+
18
+ /* OpenGL ARB extensions */
19
+
20
+ /* #3 GL_ARB_transpose_matrix */
21
+ #define TRANSPOSEMATRIX_FUNC(_name_,_type_,_conv_) \
22
+ static VALUE \
23
+ gl_##_name_(obj,arg1) \
24
+ VALUE obj,arg1; \
25
+ { \
26
+ _type_ m[4*4]; \
27
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(const _type_[])); \
28
+ LOAD_GL_FUNC(gl##_name_, "GL_ARB_transpose_matrix"); \
29
+ _conv_(arg1, m, 4, 4); \
30
+ fptr_gl##_name_(m); \
31
+ CHECK_GLERROR_FROM("gl" #_name_); \
32
+ return Qnil; \
33
+ }
34
+
35
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixfARB,GLfloat,ary2cmatfloat)
36
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixdARB,GLdouble,ary2cmatdouble)
37
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixfARB,GLfloat,ary2cmatfloat)
38
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixdARB,GLdouble,ary2cmatdouble)
39
+
40
+ #undef TRANSPOSEMATRIX_FUNC
41
+
42
+ /* #5 GL_ARB_multisample */
43
+ GL_FUNC_LOAD_2(SampleCoverageARB,GLvoid, GLclampf,GLboolean, "GL_ARB_multisample")
44
+
45
+ /* #14 GL_ARB_point_parameters */
46
+ GL_FUNC_LOAD_2(PointParameterfARB,GLvoid, GLenum,GLfloat, "GL_ARB_point_parameters")
47
+
48
+ static VALUE gl_PointParameterfvARB(VALUE obj,VALUE arg1,VALUE arg2)
49
+ {
50
+ GLfloat params[3] = {(GLfloat)0.0,(GLfloat)0.0,(GLfloat)0.0};
51
+ GLenum pname;
52
+ GLint size;
53
+ DECL_GL_FUNC_PTR(GLvoid,glPointParameterfvARB,(GLenum,GLfloat *));
54
+ LOAD_GL_FUNC(glPointParameterfvARB, "GL_ARB_point_parameters");
55
+ pname = NUM2UINT(arg1);
56
+ Check_Type(arg2,T_ARRAY);
57
+ if (pname==GL_POINT_DISTANCE_ATTENUATION)
58
+ size = 3;
59
+ else
60
+ size = 1;
61
+ ary2cflt(arg2,params,size);
62
+ fptr_glPointParameterfvARB(pname,params);
63
+ CHECK_GLERROR_FROM("glPointParameterfvARB");
64
+ return Qnil;
65
+ }
66
+
67
+ /* #25 GL_ARB_window_pos */
68
+ GL_FUNC_LOAD_2(WindowPos2dARB,GLvoid, GLdouble,GLdouble, "GL_ARB_window_pos")
69
+ GL_FUNC_LOAD_2(WindowPos2fARB,GLvoid, GLfloat,GLfloat, "GL_ARB_window_pos")
70
+ GL_FUNC_LOAD_2(WindowPos2iARB,GLvoid, GLint,GLint, "GL_ARB_window_pos")
71
+ GL_FUNC_LOAD_2(WindowPos2sARB,GLvoid, GLshort,GLshort, "GL_ARB_window_pos")
72
+ GL_FUNC_LOAD_3(WindowPos3dARB,GLvoid, GLdouble,GLdouble,GLdouble, "GL_ARB_window_pos")
73
+ GL_FUNC_LOAD_3(WindowPos3fARB,GLvoid, GLfloat,GLfloat,GLfloat, "GL_ARB_window_pos")
74
+ GL_FUNC_LOAD_3(WindowPos3iARB,GLvoid, GLint,GLint,GLint, "GL_ARB_window_pos")
75
+ GL_FUNC_LOAD_3(WindowPos3sARB,GLvoid, GLshort,GLshort,GLshort, "GL_ARB_window_pos")
76
+
77
+ #define WINDOWPOSFUNCV(_name_,_type_,_conv_,_size_,_ext_) \
78
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1) \
79
+ { \
80
+ _type_ cary[_size_]; \
81
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(const _type_ *)); \
82
+ LOAD_GL_FUNC(gl##_name_, _ext_); \
83
+ Check_Type(arg1,T_ARRAY); \
84
+ if (RARRAY_LEN(arg1) != _size_) \
85
+ rb_raise(rb_eArgError, "Incorrect array length - must have '%i' elements.",_size_); \
86
+ _conv_(arg1,cary,_size_); \
87
+ fptr_gl##_name_(cary); \
88
+ CHECK_GLERROR_FROM("gl" #_name_); \
89
+ return Qnil; \
90
+ }
91
+
92
+ WINDOWPOSFUNCV(WindowPos2dvARB,GLdouble,ary2cdbl,2,"GL_ARB_window_pos")
93
+ WINDOWPOSFUNCV(WindowPos2fvARB,GLfloat,ary2cflt,2,"GL_ARB_window_pos")
94
+ WINDOWPOSFUNCV(WindowPos2ivARB,GLint,ary2cint,2,"GL_ARB_window_pos")
95
+ WINDOWPOSFUNCV(WindowPos2svARB,GLshort,ary2cshort,2,"GL_ARB_window_pos")
96
+ WINDOWPOSFUNCV(WindowPos3dvARB,GLdouble,ary2cdbl,3,"GL_ARB_window_pos")
97
+ WINDOWPOSFUNCV(WindowPos3fvARB,GLfloat,ary2cflt,3,"GL_ARB_window_pos")
98
+ WINDOWPOSFUNCV(WindowPos3ivARB,GLint,ary2cint,3,"GL_ARB_window_pos")
99
+ WINDOWPOSFUNCV(WindowPos3svARB,GLshort,ary2cshort,3,"GL_ARB_window_pos")
100
+ #undef WINDOWPOSFUNCV
101
+
102
+
103
+ /* #26 GL_ARB_vertex_program */
104
+ static VALUE gl_ProgramStringARB(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3)
105
+ {
106
+ DECL_GL_FUNC_PTR(GLvoid,glProgramStringARB,(GLenum,GLenum,GLsizei,const void *));
107
+ LOAD_GL_FUNC(glProgramStringARB, "GL_ARB_vertex_program");
108
+ Check_Type(arg3,T_STRING);
109
+ fptr_glProgramStringARB((GLenum)NUM2INT(arg1),(GLenum)NUM2INT(arg2),(GLsizei)RSTRING_LENINT(arg3),RSTRING_PTR(arg3));
110
+ CHECK_GLERROR_FROM("glProgramStringARB");
111
+ return Qnil;
112
+ }
113
+
114
+ static VALUE gl_GetProgramivARB(VALUE obj,VALUE arg1,VALUE arg2)
115
+ {
116
+ GLint ret = 0;
117
+ DECL_GL_FUNC_PTR(GLvoid,glGetProgramivARB,(GLenum,GLenum,GLint *));
118
+ LOAD_GL_FUNC(glGetProgramivARB, "GL_ARB_vertex_program");
119
+ fptr_glGetProgramivARB(NUM2INT(arg1),NUM2INT(arg2),&ret);
120
+ CHECK_GLERROR_FROM("glGetProgramivARB");
121
+ return cond_GLBOOL2RUBY(NUM2INT(arg2),ret);
122
+ }
123
+
124
+ static VALUE gl_GetProgramStringARB(VALUE obj,VALUE arg1,VALUE arg2)
125
+ {
126
+ GLsizei len = 0;
127
+ char *buffer;
128
+ VALUE ret_buffer;
129
+
130
+ DECL_GL_FUNC_PTR(GLvoid,glGetProgramStringARB,(GLenum,GLenum,void *string));
131
+ DECL_GL_FUNC_PTR(GLvoid,glGetProgramivARB,(GLenum,GLenum,GLint *));
132
+ LOAD_GL_FUNC(glGetProgramStringARB, "GL_ARB_vertex_program");
133
+ LOAD_GL_FUNC(glGetProgramivARB, "GL_ARB_vertex_program");
134
+
135
+ fptr_glGetProgramivARB(NUM2INT(arg1),GL_PROGRAM_LENGTH_ARB,&len);
136
+ CHECK_GLERROR_FROM("glGetProgramivARB");
137
+ if (len<=0)
138
+ return rb_str_new2("");
139
+
140
+ buffer = ALLOC_N(GLchar,len+1);
141
+ memset(buffer,0,sizeof(GLchar) * (len+1));
142
+ fptr_glGetProgramStringARB(NUM2INT(arg1),NUM2INT(arg2),buffer);
143
+ ret_buffer = rb_str_new2(buffer);
144
+ xfree(buffer);
145
+
146
+ CHECK_GLERROR_FROM("glGetProgramStringARB");
147
+ return ret_buffer;
148
+ }
149
+
150
+ GL_FUNC_GENOBJECTS_LOAD(GenProgramsARB,"GL_ARB_vertex_program")
151
+ GL_FUNC_DELETEOBJECTS_LOAD(DeleteProgramsARB,"GL_ARB_vertex_program")
152
+ GL_FUNC_LOAD_2(BindProgramARB,GLvoid, GLenum,GLuint, "GL_ARB_vertex_program")
153
+ GL_FUNC_LOAD_1(IsProgramARB,GLboolean, GLuint, "GL_ARB_vertex_program")
154
+ GL_FUNC_LOAD_1(EnableVertexAttribArrayARB,GLvoid, GLuint, "GL_ARB_vertex_program")
155
+ GL_FUNC_LOAD_1(DisableVertexAttribArrayARB,GLvoid, GLuint, "GL_ARB_vertex_program")
156
+
157
+ static VALUE gl_VertexAttribPointerARB(VALUE obj,VALUE arg1,VALUE arg2,VALUE arg3,VALUE arg4,VALUE arg5,VALUE arg6)
158
+ {
159
+ GLuint index;
160
+ GLuint size;
161
+ GLenum type;
162
+ GLboolean normalized;
163
+ GLsizei stride;
164
+
165
+ DECL_GL_FUNC_PTR(GLvoid,glVertexAttribPointerARB,(GLuint,GLint,GLenum,GLboolean,GLsizei,const GLvoid *));
166
+ LOAD_GL_FUNC(glVertexAttribPointerARB, "GL_ARB_vertex_program");
167
+
168
+ index = (GLuint)NUM2UINT(arg1);
169
+ size = (GLuint)NUM2UINT(arg2);
170
+ type = (GLenum)NUM2INT(arg3);
171
+ normalized = (GLboolean)RUBYBOOL2GL(arg4);
172
+ stride = (GLsizei)NUM2UINT(arg5);
173
+ if (index>_MAX_VERTEX_ATTRIBS)
174
+ rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
175
+
176
+ if (CHECK_BUFFER_BINDING(GL_ARRAY_BUFFER_BINDING)) {
177
+ GET_GLIMPL_VARIABLE(VertexAttrib_ptr)[index] = arg6;
178
+ fptr_glVertexAttribPointerARB(index,size,type,normalized,stride,(GLvoid *)NUM2SIZET(arg6));
179
+ } else {
180
+ VALUE data;
181
+ data = pack_array_or_pass_string(type,arg6);
182
+ rb_str_freeze(data);
183
+ GET_GLIMPL_VARIABLE(VertexAttrib_ptr)[index] = data;
184
+ fptr_glVertexAttribPointerARB(index,size,type,normalized,stride,(GLvoid *)RSTRING_PTR(data));
185
+ }
186
+
187
+ CHECK_GLERROR_FROM("glVertexAttribPointerARB");
188
+ return Qnil;
189
+ }
190
+
191
+
192
+ static VALUE
193
+ gl_GetVertexAttribPointervARB(obj,arg1)
194
+ VALUE obj,arg1;
195
+ {
196
+ GLuint index;
197
+ DECL_GL_FUNC_PTR(GLvoid,glGetVertexAttribPointervARB,(GLuint,GLenum,GLvoid **));
198
+ LOAD_GL_FUNC(glGetVertexAttribPointervARB, "GL_ARB_vertex_program");
199
+ index =(GLuint) NUM2INT(arg1);
200
+ if (index>_MAX_VERTEX_ATTRIBS)
201
+ rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS);
202
+
203
+ return GET_GLIMPL_VARIABLE(VertexAttrib_ptr)[index];
204
+ }
205
+
206
+ GL_FUNC_LOAD_6(ProgramEnvParameter4dARB,GLvoid, GLenum,GLuint,GLdouble,GLdouble,GLdouble,GLdouble, "GL_ARB_vertex_program")
207
+ GL_FUNC_LOAD_6(ProgramEnvParameter4fARB,GLvoid, GLenum,GLuint,GLfloat,GLfloat,GLfloat,GLfloat, "GL_ARB_vertex_program")
208
+ GL_FUNC_LOAD_6(ProgramLocalParameter4dARB,GLvoid, GLenum,GLuint,GLdouble,GLdouble,GLdouble,GLdouble, "GL_ARB_vertex_program")
209
+ GL_FUNC_LOAD_6(ProgramLocalParameter4fARB,GLvoid, GLenum,GLuint,GLfloat,GLfloat,GLfloat,GLfloat, "GL_ARB_vertex_program")
210
+
211
+ #define PROGRAMPARAM_FUNC_V(_name_,_type_,_conv_,_extension_) \
212
+ static VALUE \
213
+ gl_##_name_(obj,arg1,arg2,arg3) \
214
+ VALUE obj,arg1,arg2,arg3; \
215
+ { \
216
+ _type_ cary[4]; \
217
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLenum,GLuint,const _type_ *)); \
218
+ LOAD_GL_FUNC(gl##_name_, _extension_); \
219
+ _conv_(arg3,cary,4); \
220
+ fptr_gl##_name_(NUM2UINT(arg1),NUM2UINT(arg2),cary); \
221
+ CHECK_GLERROR_FROM("gl" #_name_); \
222
+ return Qnil; \
223
+ }
224
+
225
+ PROGRAMPARAM_FUNC_V(ProgramEnvParameter4dvARB,GLdouble,ary2cdbl,"GL_ARB_vertex_program")
226
+ PROGRAMPARAM_FUNC_V(ProgramEnvParameter4fvARB,GLfloat,ary2cflt,"GL_ARB_vertex_program")
227
+ PROGRAMPARAM_FUNC_V(ProgramLocalParameter4dvARB,GLdouble,ary2cdbl,"GL_ARB_vertex_program")
228
+ PROGRAMPARAM_FUNC_V(ProgramLocalParameter4fvARB,GLfloat,ary2cflt,"GL_ARB_vertex_program")
229
+ #undef PROGRAMPARAM_FUNC_V
230
+
231
+ #define GETPROGRAMPARAM_FUNC(_name_,_type_,_extension_) \
232
+ static VALUE \
233
+ gl_##_name_(obj,arg1,arg2) \
234
+ VALUE obj,arg1,arg2; \
235
+ { \
236
+ _type_ cary[4] = {(_type_)0.0,(_type_)0.0,(_type_)0.0,(_type_)0.0}; \
237
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLenum,GLuint,_type_ *)); \
238
+ LOAD_GL_FUNC(gl##_name_, _extension_); \
239
+ fptr_gl##_name_(NUM2UINT(arg1),NUM2UINT(arg2),cary); \
240
+ RET_ARRAY_OR_SINGLE("gl" #_name_, 4, RETCONV_##_type_, cary); \
241
+ }
242
+
243
+ GETPROGRAMPARAM_FUNC(GetProgramEnvParameterdvARB,GLdouble,"GL_ARB_vertex_program")
244
+ GETPROGRAMPARAM_FUNC(GetProgramEnvParameterfvARB,GLfloat,"GL_ARB_vertex_program")
245
+ GETPROGRAMPARAM_FUNC(GetProgramLocalParameterdvARB,GLdouble,"GL_ARB_vertex_program")
246
+ GETPROGRAMPARAM_FUNC(GetProgramLocalParameterfvARB,GLfloat,"GL_ARB_vertex_program")
247
+
248
+ #undef GETPROGRAMPARAM_FUNC
249
+
250
+ GL_FUNC_LOAD_2(VertexAttrib1dARB,GLvoid, GLuint,GLdouble, "GL_ARB_vertex_program")
251
+ GL_FUNC_LOAD_2(VertexAttrib1fARB,GLvoid, GLuint,GLfloat, "GL_ARB_vertex_program")
252
+ GL_FUNC_LOAD_2(VertexAttrib1sARB,GLvoid, GLuint,GLshort, "GL_ARB_vertex_program")
253
+ GL_FUNC_LOAD_3(VertexAttrib2dARB,GLvoid, GLuint,GLdouble,GLdouble, "GL_ARB_vertex_program")
254
+ GL_FUNC_LOAD_3(VertexAttrib2fARB,GLvoid, GLuint,GLfloat,GLfloat, "GL_ARB_vertex_program")
255
+ GL_FUNC_LOAD_3(VertexAttrib2sARB,GLvoid, GLuint,GLshort,GLshort, "GL_ARB_vertex_program")
256
+ GL_FUNC_LOAD_4(VertexAttrib3dARB,GLvoid, GLuint,GLdouble,GLdouble,GLdouble, "GL_ARB_vertex_program")
257
+ GL_FUNC_LOAD_4(VertexAttrib3fARB,GLvoid, GLuint,GLfloat,GLfloat,GLfloat, "GL_ARB_vertex_program")
258
+ GL_FUNC_LOAD_4(VertexAttrib3sARB,GLvoid, GLuint,GLshort,GLshort,GLshort, "GL_ARB_vertex_program")
259
+ GL_FUNC_LOAD_5(VertexAttrib4dARB,GLvoid, GLuint,GLdouble,GLdouble,GLdouble,GLdouble, "GL_ARB_vertex_program")
260
+ GL_FUNC_LOAD_5(VertexAttrib4fARB,GLvoid, GLuint,GLfloat,GLfloat,GLfloat,GLfloat, "GL_ARB_vertex_program")
261
+ GL_FUNC_LOAD_5(VertexAttrib4sARB,GLvoid, GLuint,GLshort,GLshort,GLshort,GLshort, "GL_ARB_vertex_program")
262
+ GL_FUNC_LOAD_5(VertexAttrib4NubARB,GLvoid, GLuint,GLubyte,GLubyte,GLubyte,GLubyte, "GL_ARB_vertex_program")
263
+
264
+ #define VERTEXATTRIB_FUNC_V(_name_,_type_,_conv_,_size_,_extension_) \
265
+ static VALUE \
266
+ gl_##_name_(obj,arg1,arg2) \
267
+ VALUE obj,arg1,arg2; \
268
+ { \
269
+ GLuint index; \
270
+ _type_ v[_size_]; \
271
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLuint,_type_ *)); \
272
+ LOAD_GL_FUNC(gl##_name_, _extension_); \
273
+ index = (GLuint)NUM2UINT(arg1); \
274
+ _conv_(arg2,v,_size_); \
275
+ fptr_gl##_name_(index,v); \
276
+ CHECK_GLERROR_FROM("gl" #_name_); \
277
+ return Qnil; \
278
+ }
279
+
280
+ VERTEXATTRIB_FUNC_V(VertexAttrib4NbvARB,GLbyte,ary2cbyte,4,"GL_ARB_vertex_program")
281
+ VERTEXATTRIB_FUNC_V(VertexAttrib4NivARB,GLint,ary2cint,4,"GL_ARB_vertex_program")
282
+ VERTEXATTRIB_FUNC_V(VertexAttrib4NsvARB,GLshort,ary2cshort,4,"GL_ARB_vertex_program")
283
+ VERTEXATTRIB_FUNC_V(VertexAttrib4NubvARB,GLubyte,ary2cubyte,4,"GL_ARB_vertex_program")
284
+ VERTEXATTRIB_FUNC_V(VertexAttrib4NuivARB,GLuint,ary2cuint,4,"GL_ARB_vertex_program")
285
+ VERTEXATTRIB_FUNC_V(VertexAttrib4NusvARB,GLushort,ary2cushort,4,"GL_ARB_vertex_program")
286
+ VERTEXATTRIB_FUNC_V(VertexAttrib4uivARB,GLuint,ary2cuint,4,"GL_ARB_vertex_program")
287
+ VERTEXATTRIB_FUNC_V(VertexAttrib4ubvARB,GLubyte,ary2cubyte,4,"GL_ARB_vertex_program")
288
+ VERTEXATTRIB_FUNC_V(VertexAttrib4usvARB,GLushort,ary2cushort,4,"GL_ARB_vertex_program")
289
+ VERTEXATTRIB_FUNC_V(VertexAttrib4bvARB,GLbyte,ary2cbyte,4,"GL_ARB_vertex_program")
290
+ VERTEXATTRIB_FUNC_V(VertexAttrib4ivARB,GLint,ary2cint,4,"GL_ARB_vertex_program")
291
+ VERTEXATTRIB_FUNC_V(VertexAttrib4dvARB,GLdouble,ary2cdbl,4,"GL_ARB_vertex_program")
292
+ VERTEXATTRIB_FUNC_V(VertexAttrib4fvARB,GLfloat,ary2cflt,4,"GL_ARB_vertex_program")
293
+ VERTEXATTRIB_FUNC_V(VertexAttrib4svARB,GLshort,ary2cshort,4,"GL_ARB_vertex_program")
294
+ VERTEXATTRIB_FUNC_V(VertexAttrib3dvARB,GLdouble,ary2cdbl,3,"GL_ARB_vertex_program")
295
+ VERTEXATTRIB_FUNC_V(VertexAttrib3fvARB,GLfloat,ary2cflt,3,"GL_ARB_vertex_program")
296
+ VERTEXATTRIB_FUNC_V(VertexAttrib3svARB,GLshort,ary2cshort,3,"GL_ARB_vertex_program")
297
+ VERTEXATTRIB_FUNC_V(VertexAttrib2dvARB,GLdouble,ary2cdbl,2,"GL_ARB_vertex_program")
298
+ VERTEXATTRIB_FUNC_V(VertexAttrib2fvARB,GLfloat,ary2cflt,2,"GL_ARB_vertex_program")
299
+ VERTEXATTRIB_FUNC_V(VertexAttrib2svARB,GLshort,ary2cshort,2,"GL_ARB_vertex_program")
300
+ VERTEXATTRIB_FUNC_V(VertexAttrib1dvARB,GLdouble,ary2cdbl,1,"GL_ARB_vertex_program")
301
+ VERTEXATTRIB_FUNC_V(VertexAttrib1fvARB,GLfloat,ary2cflt,1,"GL_ARB_vertex_program")
302
+ VERTEXATTRIB_FUNC_V(VertexAttrib1svARB,GLshort,ary2cshort,1,"GL_ARB_vertex_program")
303
+ #undef VERTEXATTRIB_FUNC_V
304
+
305
+ #define GETVERTEXATTRIB_FUNC(_name_,_type_,_extension_) \
306
+ static VALUE \
307
+ gl_##_name_(obj,arg1,arg2) \
308
+ VALUE obj,arg1,arg2; \
309
+ { \
310
+ GLuint index; \
311
+ GLenum pname; \
312
+ _type_ params[4] = {0,0,0,0}; \
313
+ GLint size; \
314
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLuint,GLenum,_type_ *)); \
315
+ LOAD_GL_FUNC(gl##_name_, _extension_); \
316
+ index = (GLuint)NUM2UINT(arg1); \
317
+ pname = (GLenum)NUM2INT(arg2); \
318
+ if (pname==GL_CURRENT_VERTEX_ATTRIB_ARB) \
319
+ size = 4; \
320
+ else \
321
+ size = 1; \
322
+ fptr_gl##_name_(index,pname,params); \
323
+ RET_ARRAY_OR_SINGLE("gl" #_name_, size, RETCONV_##_type_, params); \
324
+ }
325
+
326
+ GETVERTEXATTRIB_FUNC(GetVertexAttribdvARB,GLdouble,"GL_ARB_vertex_program")
327
+ GETVERTEXATTRIB_FUNC(GetVertexAttribfvARB,GLfloat,"GL_ARB_vertex_program")
328
+ //GETVERTEXATTRIB_FUNC(GetVertexAttribivARB,GLint,INT2NUM,"GL_ARB_vertex_program")
329
+ #undef GETVERTEXATTRIB_FUNC
330
+
331
+ static VALUE
332
+ gl_GetVertexAttribivARB(obj,arg1,arg2)
333
+ VALUE obj,arg1,arg2;
334
+ {
335
+ GLuint index;
336
+ GLenum pname;
337
+ GLint params[4] = {0,0,0,0};
338
+ GLint size;
339
+ DECL_GL_FUNC_PTR(GLvoid,glGetVertexAttribivARB,(GLuint,GLenum,GLint *));
340
+ LOAD_GL_FUNC(glGetVertexAttribivARB, "GL_ARB_vertex_program");
341
+ index = (GLuint)NUM2UINT(arg1);
342
+ pname = (GLenum)NUM2INT(arg2);
343
+ if (pname==GL_CURRENT_VERTEX_ATTRIB)
344
+ size = 4;
345
+ else
346
+ size = 1;
347
+ fptr_glGetVertexAttribivARB(index,pname,params);
348
+ RET_ARRAY_OR_SINGLE_BOOL("glGetVertexAttribivARB", size, cond_GLBOOL2RUBY,
349
+ pname, params);
350
+ }
351
+
352
+
353
+ /* #29 GL_ARB_occlusion_query */
354
+ GL_FUNC_GENOBJECTS_LOAD(GenQueriesARB,"GL_ARB_occlusion_query")
355
+ GL_FUNC_DELETEOBJECTS_LOAD(DeleteQueriesARB,"GL_ARB_occlusion_query")
356
+ GL_FUNC_LOAD_1(IsQueryARB,GLboolean, GLuint, "GL_ARB_occlusion_query")
357
+ GL_FUNC_LOAD_2(BeginQueryARB,GLvoid, GLuint,GLuint, "GL_ARB_occlusion_query")
358
+ GL_FUNC_LOAD_1(EndQueryARB,GLvoid, GLenum, "GL_ARB_occlusion_query")
359
+
360
+ #define GETQUERY_FUNC(_name_,_type_,_conv_) \
361
+ static VALUE gl_##_name_(VALUE obj,VALUE arg1,VALUE arg2) \
362
+ { \
363
+ _type_ ret = 0; \
364
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLuint,GLenum,_type_ *)); \
365
+ LOAD_GL_FUNC(gl##_name_, "GL_ARB_occlusion_query"); \
366
+ fptr_gl##_name_(NUM2INT(arg1),NUM2INT(arg2),&ret); \
367
+ CHECK_GLERROR_FROM("gl" #_name_); \
368
+ return _conv_(NUM2INT(arg2),ret); \
369
+ }
370
+
371
+ GETQUERY_FUNC(GetQueryivARB,GLint,cond_GLBOOL2RUBY)
372
+ GETQUERY_FUNC(GetQueryObjectivARB,GLint,cond_GLBOOL2RUBY)
373
+ GETQUERY_FUNC(GetQueryObjectuivARB,GLuint,cond_GLBOOL2RUBY_U)
374
+ #undef GETQUERY_FUNC
375
+
376
+ /* #30 GL_ARB_shader_objects */
377
+ GL_FUNC_LOAD_1(DeleteObjectARB,GLvoid, GLuint, "GL_ARB_shader_objects")
378
+ GL_FUNC_LOAD_2(DetachObjectARB,GLvoid, GLuint,GLuint, "GL_ARB_shader_objects")
379
+ GL_FUNC_LOAD_1(CompileShaderARB,GLvoid, GLuint, "GL_ARB_shader_objects")
380
+ GL_FUNC_LOAD_2(AttachObjectARB,GLvoid, GLuint,GLuint, "GL_ARB_shader_objects")
381
+ GL_FUNC_LOAD_1(LinkProgramARB,GLvoid, GLuint, "GL_ARB_shader_objects")
382
+ GL_FUNC_LOAD_1(UseProgramObjectARB,GLvoid, GLuint, "GL_ARB_shader_objects")
383
+ GL_FUNC_LOAD_1(ValidateProgramARB,GLvoid, GLuint, "GL_ARB_shader_objects")
384
+ GL_FUNC_LOAD_1(GetHandleARB,GLuint, GLenum, "GL_ARB_shader_objects")
385
+ GL_FUNC_LOAD_1(CreateShaderObjectARB,GLuint, GLenum, "GL_ARB_shader_objects")
386
+ GL_FUNC_LOAD_0(CreateProgramObjectARB,GLuint, "GL_ARB_shader_objects")
387
+
388
+ static VALUE
389
+ gl_ShaderSourceARB(obj,arg1,arg2)
390
+ VALUE obj,arg1,arg2;
391
+ {
392
+ GLuint shader;
393
+ GLint length;
394
+ GLchar *str;
395
+ DECL_GL_FUNC_PTR(GLvoid,glShaderSourceARB,(GLuint,GLsizei,GLchar**,GLint *));
396
+ LOAD_GL_FUNC(glShaderSourceARB, "GL_ARB_shader_objects");
397
+ shader = (GLuint)NUM2UINT(arg1);
398
+ Check_Type(arg2,T_STRING);
399
+ str = RSTRING_PTR(arg2);
400
+ length = (GLint)RSTRING_LENINT(arg2);
401
+ fptr_glShaderSourceARB(shader,1,&str,&length);
402
+ CHECK_GLERROR_FROM("glShaderSourceARB");
403
+ return Qnil;
404
+ }
405
+
406
+ GL_FUNC_LOAD_2(Uniform1fARB,GLvoid, GLint,GLfloat, "GL_ARB_shader_objects")
407
+ GL_FUNC_LOAD_3(Uniform2fARB,GLvoid, GLint,GLfloat,GLfloat, "GL_ARB_shader_objects")
408
+ GL_FUNC_LOAD_4(Uniform3fARB,GLvoid, GLint,GLfloat,GLfloat,GLfloat, "GL_ARB_shader_objects")
409
+ GL_FUNC_LOAD_5(Uniform4fARB,GLvoid, GLint,GLfloat,GLfloat,GLfloat,GLfloat, "GL_ARB_shader_objects")
410
+ GL_FUNC_LOAD_2(Uniform1iARB,GLvoid, GLint,GLint, "GL_ARB_shader_objects")
411
+ GL_FUNC_LOAD_3(Uniform2iARB,GLvoid, GLint,GLint,GLint, "GL_ARB_shader_objects")
412
+ GL_FUNC_LOAD_4(Uniform3iARB,GLvoid, GLint,GLint,GLint,GLint, "GL_ARB_shader_objects")
413
+ GL_FUNC_LOAD_5(Uniform4iARB,GLvoid, GLint,GLint,GLint,GLint,GLint, "GL_ARB_shader_objects")
414
+
415
+ #define GLUNIFORM_VFUNC(_name_,_type_,_conv_,_size_) \
416
+ static VALUE \
417
+ gl_##_name_(obj,arg1,arg2) \
418
+ VALUE obj,arg1,arg2; \
419
+ { \
420
+ GLint location; \
421
+ GLsizei count; \
422
+ _type_ *value; \
423
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLint,GLsizei,const _type_ *)); \
424
+ LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
425
+ Check_Type(arg2,T_ARRAY); \
426
+ count = (GLsizei)RARRAY_LENINT(arg2); \
427
+ if (count<=0 || (count % _size_) != 0) \
428
+ rb_raise(rb_eArgError, "Parameter array size must be multiplication of %i",_size_); \
429
+ location = (GLint)NUM2INT(arg1); \
430
+ value = ALLOC_N(_type_,count); \
431
+ _conv_(arg2,value,count); \
432
+ fptr_gl##_name_(location,count / _size_,value); \
433
+ xfree(value); \
434
+ CHECK_GLERROR_FROM("gl" #_name_); \
435
+ return Qnil; \
436
+ }
437
+
438
+ GLUNIFORM_VFUNC(Uniform1fvARB,GLfloat,ary2cflt,1)
439
+ GLUNIFORM_VFUNC(Uniform2fvARB,GLfloat,ary2cflt,2)
440
+ GLUNIFORM_VFUNC(Uniform3fvARB,GLfloat,ary2cflt,3)
441
+ GLUNIFORM_VFUNC(Uniform4fvARB,GLfloat,ary2cflt,4)
442
+ GLUNIFORM_VFUNC(Uniform1ivARB,GLint,ary2cint,1)
443
+ GLUNIFORM_VFUNC(Uniform2ivARB,GLint,ary2cint,2)
444
+ GLUNIFORM_VFUNC(Uniform3ivARB,GLint,ary2cint,3)
445
+ GLUNIFORM_VFUNC(Uniform4ivARB,GLint,ary2cint,4)
446
+ #undef GLUNIFORM_VFUNC
447
+
448
+ #define UNIFORMMATRIX_FUNC(_name_,_size_) \
449
+ static VALUE \
450
+ gl_##_name_(obj,arg1,arg2,arg3) \
451
+ VALUE obj,arg1,arg2,arg3; \
452
+ { \
453
+ GLint location; \
454
+ GLsizei count; \
455
+ GLboolean transpose; \
456
+ GLfloat *value; \
457
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLint,GLsizei,GLboolean,GLfloat *)); \
458
+ LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
459
+ location = (GLint)NUM2INT(arg1); \
460
+ count = (GLsizei)RARRAY_LENINT(rb_funcall(rb_Array(arg3),rb_intern("flatten"),0)); \
461
+ transpose = (GLboolean)RUBYBOOL2GL(arg2); \
462
+ value = ALLOC_N(GLfloat, count); \
463
+ ary2cmatfloatcount(arg3,value,_size_,_size_); \
464
+ fptr_gl##_name_(location,count / (_size_*_size_),transpose,value); \
465
+ xfree(value); \
466
+ CHECK_GLERROR_FROM("gl" #_name_); \
467
+ return Qnil; \
468
+ }
469
+
470
+ UNIFORMMATRIX_FUNC(UniformMatrix2fvARB,2)
471
+ UNIFORMMATRIX_FUNC(UniformMatrix3fvARB,3)
472
+ UNIFORMMATRIX_FUNC(UniformMatrix4fvARB,4)
473
+ #undef UNIFORMMATRIX_FUNC
474
+
475
+ #define GETOBJECTPARAMETER_FUNC(_name_,_type_,_conv_) \
476
+ static VALUE \
477
+ gl_##_name_(obj,arg1,arg2) \
478
+ VALUE obj,arg1,arg2; \
479
+ { \
480
+ GLuint program; \
481
+ GLenum pname; \
482
+ _type_ params = 0; \
483
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLuint,GLenum,_type_ *)); \
484
+ LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
485
+ program = (GLuint)NUM2UINT(arg1); \
486
+ pname = (GLenum)NUM2INT(arg2); \
487
+ fptr_gl##_name_(program,pname,&params); \
488
+ CHECK_GLERROR_FROM("gl" #_name_); \
489
+ return _conv_(pname,params); \
490
+ }
491
+
492
+ GETOBJECTPARAMETER_FUNC(GetObjectParameterivARB,GLint,cond_GLBOOL2RUBY)
493
+ GETOBJECTPARAMETER_FUNC(GetObjectParameterfvARB,GLfloat,cond_GLBOOL2RUBY_F)
494
+
495
+ #undef GETOBJECTPARAMETER_FUNC
496
+
497
+ static VALUE
498
+ gl_GetInfoLogARB(obj,arg1)
499
+ VALUE obj,arg1;
500
+ {
501
+ GLuint program;
502
+ GLint max_size = 0;
503
+ GLsizei ret_length = 0;
504
+ VALUE buffer;
505
+ DECL_GL_FUNC_PTR(GLvoid,glGetInfoLogARB,(GLuint,GLsizei,GLsizei *,GLchar *));
506
+ DECL_GL_FUNC_PTR(GLvoid,glGetObjectParameterivARB,(GLuint,GLenum,GLint *));
507
+ LOAD_GL_FUNC(glGetInfoLogARB, "GL_ARB_shader_objects");
508
+ LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
509
+ program = (GLuint)NUM2UINT(arg1);
510
+ fptr_glGetObjectParameterivARB(program,GL_OBJECT_INFO_LOG_LENGTH_ARB,&max_size);
511
+ CHECK_GLERROR_FROM("glGetObjectParameterivARB");
512
+ if (max_size<=0)
513
+ return rb_str_new2("");
514
+ buffer = allocate_buffer_with_string(max_size);
515
+ fptr_glGetInfoLogARB(program,max_size,&ret_length,RSTRING_PTR(buffer));
516
+ CHECK_GLERROR_FROM("glGetInfoLogARB");
517
+ return buffer;
518
+ }
519
+
520
+ static VALUE
521
+ gl_GetShaderSourceARB(obj,arg1)
522
+ VALUE obj,arg1;
523
+ {
524
+ GLuint shader;
525
+ GLint max_size = 0;
526
+ GLsizei ret_length = 0;
527
+ VALUE buffer;
528
+ DECL_GL_FUNC_PTR(GLvoid,glGetShaderSourceARB,(GLuint,GLsizei,GLsizei *,GLchar *));
529
+ DECL_GL_FUNC_PTR(GLvoid,glGetObjectParameterivARB,(GLuint,GLenum,GLint *));
530
+ LOAD_GL_FUNC(glGetShaderSourceARB, "GL_ARB_shader_objects");
531
+ LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
532
+ shader = (GLuint)NUM2UINT(arg1);
533
+ fptr_glGetObjectParameterivARB(shader,GL_OBJECT_SHADER_SOURCE_LENGTH_ARB,&max_size);
534
+ CHECK_GLERROR_FROM("glGetObjectParameterivARB");
535
+ if (max_size==0)
536
+ rb_raise(rb_eTypeError, "Can't determine maximum shader source length");
537
+ buffer = allocate_buffer_with_string(max_size-1);
538
+ fptr_glGetShaderSourceARB(shader,max_size,&ret_length,RSTRING_PTR(buffer));
539
+ CHECK_GLERROR_FROM("glGetShaderSourceARB");
540
+ return buffer;
541
+ }
542
+
543
+ static VALUE
544
+ gl_GetActiveUniformARB(obj,arg1,arg2)
545
+ VALUE obj,arg1,arg2;
546
+ {
547
+ GLuint program;
548
+ GLuint index;
549
+ GLsizei max_size = 0;
550
+ GLsizei written = 0;
551
+ GLint uniform_size = 0;
552
+ GLenum uniform_type = 0;
553
+ VALUE buffer;
554
+ VALUE retary;
555
+ DECL_GL_FUNC_PTR(GLvoid,glGetActiveUniformARB,(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*));
556
+ DECL_GL_FUNC_PTR(GLvoid,glGetObjectParameterivARB,(GLuint,GLenum,GLint *));
557
+ LOAD_GL_FUNC(glGetActiveUniformARB, "GL_ARB_shader_objects");
558
+ LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
559
+ program = (GLuint)NUM2UINT(arg1);
560
+ index = (GLuint)NUM2UINT(arg2);
561
+ fptr_glGetObjectParameterivARB(program,GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB,&max_size);
562
+ CHECK_GLERROR_FROM("glGetObjectParameterivARB");
563
+ /* Can't determine maximum uniform name length, so presume it */
564
+ if (max_size==0) max_size = 256;
565
+ buffer = allocate_buffer_with_string(max_size-1);
566
+
567
+ fptr_glGetActiveUniformARB(program,index,max_size,&written,&uniform_size,&uniform_type,RSTRING_PTR(buffer));
568
+
569
+ rb_str_set_len(buffer, written);
570
+ retary = rb_ary_new2(3);
571
+ rb_ary_push(retary, INT2NUM(uniform_size));
572
+ rb_ary_push(retary, INT2NUM(uniform_type));
573
+ rb_ary_push(retary, buffer);
574
+ CHECK_GLERROR_FROM("glGetACtiveUniformARB");
575
+ return retary;
576
+ }
577
+
578
+ #define GETUNIFORM_FUNC(_name_,_type_) \
579
+ static VALUE \
580
+ gl_##_name_(obj,arg1,arg2) \
581
+ VALUE obj,arg1,arg2; \
582
+ { \
583
+ GLuint program; \
584
+ GLint location; \
585
+ _type_ params[16]; \
586
+ GLint unused = 0; \
587
+ GLenum uniform_type = 0; \
588
+ GLint uniform_size = 0; \
589
+ \
590
+ DECL_GL_FUNC_PTR(GLvoid,gl##_name_,(GLuint,GLint,_type_ *)); \
591
+ DECL_GL_FUNC_PTR(GLvoid,glGetActiveUniformARB,(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*)); \
592
+ LOAD_GL_FUNC(gl##_name_, "GL_ARB_shader_objects"); \
593
+ LOAD_GL_FUNC(glGetActiveUniformARB, "GL_ARB_shader_objects"); \
594
+ program = (GLuint)NUM2UINT(arg1); \
595
+ location = (GLint)NUM2INT(arg2); \
596
+ \
597
+ fptr_glGetActiveUniformARB(program,location,0,NULL,&unused,&uniform_type,NULL); \
598
+ CHECK_GLERROR_FROM("glGetActiveUniformARB"); \
599
+ if (uniform_type==0) \
600
+ rb_raise(rb_eTypeError, "Can't determine the uniform's type"); \
601
+ \
602
+ uniform_size = get_uniform_size(uniform_type); \
603
+ \
604
+ memset(params,0,16*sizeof(_type_)); \
605
+ fptr_gl##_name_(program,location,params); \
606
+ CHECK_GLERROR_FROM("gl" #_name_); \
607
+ RET_ARRAY_OR_SINGLE("gl" #_name_, uniform_size, RETCONV_##_type_, params); \
608
+ }
609
+
610
+ GETUNIFORM_FUNC(GetUniformfvARB,GLfloat)
611
+ GETUNIFORM_FUNC(GetUniformivARB,GLint)
612
+ #undef GETUNIFORM_FUNC
613
+
614
+ static VALUE
615
+ gl_GetUniformLocationARB(obj,arg1,arg2)
616
+ VALUE obj,arg1,arg2;
617
+ {
618
+ GLuint program;
619
+ GLint ret;
620
+ DECL_GL_FUNC_PTR(GLint,glGetUniformLocationARB,(GLuint,const GLchar*));
621
+ LOAD_GL_FUNC(glGetUniformLocationARB, "GL_ARB_shader_objects");
622
+ program=(GLuint)NUM2UINT(arg1);
623
+ Check_Type(arg2,T_STRING);
624
+ ret = fptr_glGetUniformLocationARB(program,RSTRING_PTR(arg2));
625
+ CHECK_GLERROR_FROM("glGetUniformLocationARB");
626
+ return INT2NUM(ret);
627
+ }
628
+
629
+ static VALUE
630
+ gl_GetAttachedObjectsARB(obj,arg1)
631
+ VALUE obj,arg1;
632
+ {
633
+ GLuint program;
634
+ GLint shaders_num = 0;
635
+ GLuint *shaders;
636
+ GLsizei count = 0;
637
+ DECL_GL_FUNC_PTR(GLvoid,glGetAttachedObjectsARB,(GLuint,GLsizei,GLsizei *,GLuint *));
638
+ DECL_GL_FUNC_PTR(GLvoid,glGetObjectParameterivARB,(GLuint,GLenum,GLint *));
639
+ LOAD_GL_FUNC(glGetAttachedObjectsARB, "GL_ARB_shader_objects");
640
+ LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_shader_objects");
641
+ program = (GLuint)NUM2UINT(arg1);
642
+ fptr_glGetObjectParameterivARB(program,GL_OBJECT_ATTACHED_OBJECTS_ARB,&shaders_num);
643
+ CHECK_GLERROR_FROM("glGetObjectParameterivARB");
644
+ if (shaders_num<=0)
645
+ return Qnil;
646
+ shaders = ALLOC_N(GLuint,shaders_num);
647
+ fptr_glGetAttachedObjectsARB(program,shaders_num,&count,shaders);
648
+ RET_ARRAY_OR_SINGLE_FREE("glGetAttachedObjectsARB", count, RETCONV_GLuint,
649
+ shaders);
650
+ }
651
+
652
+ /* #31 GL_ARB_vertex_shader */
653
+
654
+ static VALUE
655
+ gl_BindAttribLocationARB(obj,arg1,arg2,arg3)
656
+ VALUE obj,arg1,arg2,arg3;
657
+ {
658
+ GLuint program;
659
+ GLuint index;
660
+ DECL_GL_FUNC_PTR(GLvoid,glBindAttribLocationARB,(GLuint,GLuint,GLchar *));
661
+ LOAD_GL_FUNC(glBindAttribLocationARB, "GL_ARB_vertex_shader");
662
+ program = (GLuint)NUM2UINT(arg1);
663
+ index = (GLuint)NUM2UINT(arg2);
664
+ Check_Type(arg3, T_STRING);
665
+ fptr_glBindAttribLocationARB(program,index,RSTRING_PTR(arg3));
666
+ CHECK_GLERROR_FROM("glBindAttribLocationARB");
667
+ return Qnil;
668
+ }
669
+
670
+ static VALUE
671
+ gl_GetActiveAttribARB(obj,arg1,arg2)
672
+ VALUE obj,arg1,arg2;
673
+ {
674
+ GLuint program;
675
+ GLuint index;
676
+ GLsizei max_size = 0;
677
+ GLsizei written = 0;
678
+ GLint attrib_size = 0;
679
+ GLenum attrib_type = 0;
680
+ VALUE buffer;
681
+ VALUE retary;
682
+ DECL_GL_FUNC_PTR(GLvoid,glGetActiveAttribARB,(GLuint,GLuint,GLsizei,GLsizei *,GLint *,GLenum *,GLchar *));
683
+ DECL_GL_FUNC_PTR(GLvoid,glGetObjectParameterivARB,(GLuint,GLenum,GLint *));
684
+ LOAD_GL_FUNC(glGetActiveAttribARB, "GL_ARB_vertex_shader");
685
+ LOAD_GL_FUNC(glGetObjectParameterivARB, "GL_ARB_vertex_shader");
686
+ program = (GLuint)NUM2UINT(arg1);
687
+ index = (GLuint)NUM2UINT(arg2);
688
+ fptr_glGetObjectParameterivARB(program,GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB,&max_size);
689
+ CHECK_GLERROR_FROM("glGetObjectParameterivARB");
690
+ /* Can't determine maximum attribute name length, so presume it */
691
+ if (max_size==0) max_size = 256;
692
+ buffer = allocate_buffer_with_string(max_size-1);
693
+
694
+ fptr_glGetActiveAttribARB(program,index,max_size,&written,&attrib_size,&attrib_type,RSTRING_PTR(buffer));
695
+
696
+ rb_str_set_len(buffer, written);
697
+ retary = rb_ary_new2(3);
698
+ rb_ary_push(retary, INT2NUM(attrib_size));
699
+ rb_ary_push(retary, INT2NUM(attrib_type));
700
+ rb_ary_push(retary, buffer);
701
+ CHECK_GLERROR_FROM("glGetActiveAttribARB");
702
+ return retary;
703
+ }
704
+
705
+ static VALUE
706
+ gl_GetAttribLocationARB(obj,arg1,arg2)
707
+ VALUE obj,arg1,arg2;
708
+ {
709
+ GLuint program;
710
+ GLint ret;
711
+ DECL_GL_FUNC_PTR(GLint,glGetAttribLocationARB,(GLuint,const GLchar*));
712
+ LOAD_GL_FUNC(glGetAttribLocationARB, "GL_ARB_shader_objects");
713
+ program=(GLuint)NUM2UINT(arg1);
714
+ Check_Type(arg2,T_STRING);
715
+ ret = fptr_glGetAttribLocationARB(program,RSTRING_PTR(arg2));
716
+ CHECK_GLERROR_FROM("glGetAttribLocationARB");
717
+ return INT2NUM(ret);
718
+ }
719
+
720
+
721
+ /* #39 GL_ARB_color_buffer_float */
722
+ GL_FUNC_LOAD_2(ClampColorARB,GLvoid, GLenum,GLenum, "GL_ARB_color_buffer_float")
723
+
724
+ void gl_init_functions_ext_arb(VALUE klass)
725
+ {
726
+ /* #3 GL_ARB_transpose_matrix */
727
+ rb_define_method(klass, "glLoadTransposeMatrixfARB", gl_LoadTransposeMatrixfARB, 1);
728
+ rb_define_method(klass, "glLoadTransposeMatrixdARB", gl_LoadTransposeMatrixdARB, 1);
729
+ rb_define_method(klass, "glMultTransposeMatrixfARB", gl_MultTransposeMatrixfARB, 1);
730
+ rb_define_method(klass, "glMultTransposeMatrixdARB", gl_MultTransposeMatrixdARB, 1);
731
+
732
+ /* #5 GL_ARB_multisample */
733
+ rb_define_method(klass, "glSampleCoverageARB", gl_SampleCoverageARB, 2);
734
+
735
+ /* #14 GL_ARB_point_parameters */
736
+ rb_define_method(klass, "glPointParameterfARB", gl_PointParameterfARB, 2);
737
+ rb_define_method(klass, "glPointParameterfvARB", gl_PointParameterfvARB, 2);
738
+
739
+ /* #26 GL_ARB_window_pos */
740
+ rb_define_method(klass, "glWindowPos2dARB", gl_WindowPos2dARB, 2);
741
+ rb_define_method(klass, "glWindowPos2fARB", gl_WindowPos2fARB, 2);
742
+ rb_define_method(klass, "glWindowPos2iARB", gl_WindowPos2iARB, 2);
743
+ rb_define_method(klass, "glWindowPos2sARB", gl_WindowPos2sARB, 2);
744
+ rb_define_method(klass, "glWindowPos3dARB", gl_WindowPos3dARB, 3);
745
+ rb_define_method(klass, "glWindowPos3fARB", gl_WindowPos3fARB, 3);
746
+ rb_define_method(klass, "glWindowPos3iARB", gl_WindowPos3iARB, 3);
747
+ rb_define_method(klass, "glWindowPos3sARB", gl_WindowPos3sARB, 3);
748
+
749
+ rb_define_method(klass, "glWindowPos2dvARB", gl_WindowPos2dvARB, 1);
750
+ rb_define_method(klass, "glWindowPos2fvARB", gl_WindowPos2fvARB, 1);
751
+ rb_define_method(klass, "glWindowPos2ivARB", gl_WindowPos2ivARB, 1);
752
+ rb_define_method(klass, "glWindowPos2svARB", gl_WindowPos2svARB, 1);
753
+ rb_define_method(klass, "glWindowPos3dvARB", gl_WindowPos3dvARB, 1);
754
+ rb_define_method(klass, "glWindowPos3fvARB", gl_WindowPos3fvARB, 1);
755
+ rb_define_method(klass, "glWindowPos3ivARB", gl_WindowPos3ivARB, 1);
756
+ rb_define_method(klass, "glWindowPos3svARB", gl_WindowPos3svARB, 1);
757
+
758
+ /* #26 GL_ARB_vertex_program */
759
+ rb_define_method(klass, "glProgramStringARB", gl_ProgramStringARB, 3);
760
+ rb_define_method(klass, "glGetProgramStringARB", gl_GetProgramStringARB, 2);
761
+ rb_define_method(klass, "glGetProgramivARB", gl_GetProgramivARB, 2);
762
+ rb_define_method(klass, "glBindProgramARB", gl_BindProgramARB, 2);
763
+ rb_define_method(klass, "glGenProgramsARB", gl_GenProgramsARB, 1);
764
+ rb_define_method(klass, "glDeleteProgramsARB", gl_DeleteProgramsARB, 1);
765
+ rb_define_method(klass, "glIsProgramARB", gl_IsProgramARB, 1);
766
+ rb_define_method(klass, "glEnableVertexAttribArrayARB", gl_EnableVertexAttribArrayARB, 1);
767
+ rb_define_method(klass, "glDisableVertexAttribArrayARB", gl_DisableVertexAttribArrayARB, 1);
768
+ rb_define_method(klass, "glVertexAttribPointerARB", gl_VertexAttribPointerARB, 6);
769
+ rb_define_method(klass, "glGetVertexAttribPointervARB", gl_GetVertexAttribPointervARB, 1);
770
+ rb_define_method(klass, "glProgramEnvParameter4dARB", gl_ProgramEnvParameter4dARB, 6);
771
+ rb_define_method(klass, "glProgramEnvParameter4fARB", gl_ProgramEnvParameter4fARB, 6);
772
+ rb_define_method(klass, "glProgramLocalParameter4dARB", gl_ProgramLocalParameter4dARB, 6);
773
+ rb_define_method(klass, "glProgramLocalParameter4fARB", gl_ProgramLocalParameter4fARB, 6);
774
+ rb_define_method(klass, "glProgramEnvParameter4dvARB", gl_ProgramEnvParameter4dvARB, 3);
775
+ rb_define_method(klass, "glProgramEnvParameter4fvARB", gl_ProgramEnvParameter4fvARB, 3);
776
+ rb_define_method(klass, "glProgramLocalParameter4dvARB", gl_ProgramLocalParameter4dvARB, 3);
777
+ rb_define_method(klass, "glProgramLocalParameter4fvARB", gl_ProgramLocalParameter4fvARB, 3);
778
+ rb_define_method(klass, "glGetProgramEnvParameterdvARB", gl_GetProgramEnvParameterdvARB, 2);
779
+ rb_define_method(klass, "glGetProgramEnvParameterfvARB", gl_GetProgramEnvParameterfvARB, 2);
780
+ rb_define_method(klass, "glGetProgramLocalParameterdvARB", gl_GetProgramLocalParameterdvARB, 2);
781
+ rb_define_method(klass, "glGetProgramLocalParameterfvARB", gl_GetProgramLocalParameterfvARB, 2);
782
+ rb_define_method(klass, "glVertexAttrib1dARB", gl_VertexAttrib1dARB, 2);
783
+ rb_define_method(klass, "glVertexAttrib1fARB", gl_VertexAttrib1fARB, 2);
784
+ rb_define_method(klass, "glVertexAttrib1sARB", gl_VertexAttrib1sARB, 2);
785
+ rb_define_method(klass, "glVertexAttrib2dARB", gl_VertexAttrib2dARB, 3);
786
+ rb_define_method(klass, "glVertexAttrib2fARB", gl_VertexAttrib2fARB, 3);
787
+ rb_define_method(klass, "glVertexAttrib2sARB", gl_VertexAttrib2sARB, 3);
788
+ rb_define_method(klass, "glVertexAttrib3dARB", gl_VertexAttrib3dARB, 4);
789
+ rb_define_method(klass, "glVertexAttrib3fARB", gl_VertexAttrib3fARB, 4);
790
+ rb_define_method(klass, "glVertexAttrib3sARB", gl_VertexAttrib3sARB, 4);
791
+ rb_define_method(klass, "glVertexAttrib4NbvARB", gl_VertexAttrib4NbvARB, 2);
792
+ rb_define_method(klass, "glVertexAttrib4NivARB", gl_VertexAttrib4NivARB, 2);
793
+ rb_define_method(klass, "glVertexAttrib4NsvARB", gl_VertexAttrib4NsvARB, 2);
794
+ rb_define_method(klass, "glVertexAttrib4NubARB", gl_VertexAttrib4NubARB, 5);
795
+ rb_define_method(klass, "glVertexAttrib4NubvARB", gl_VertexAttrib4NubvARB, 2);
796
+ rb_define_method(klass, "glVertexAttrib4NuivARB", gl_VertexAttrib4NuivARB, 2);
797
+ rb_define_method(klass, "glVertexAttrib4NusvARB", gl_VertexAttrib4NusvARB, 2);
798
+ rb_define_method(klass, "glVertexAttrib4bvARB", gl_VertexAttrib4bvARB, 2);
799
+ rb_define_method(klass, "glVertexAttrib4dARB", gl_VertexAttrib4dARB, 5);
800
+ rb_define_method(klass, "glVertexAttrib4fARB", gl_VertexAttrib4fARB, 5);
801
+ rb_define_method(klass, "glVertexAttrib4ivARB", gl_VertexAttrib4ivARB, 2);
802
+ rb_define_method(klass, "glVertexAttrib4sARB", gl_VertexAttrib4sARB, 5);
803
+ rb_define_method(klass, "glVertexAttrib4ubvARB", gl_VertexAttrib4ubvARB, 2);
804
+ rb_define_method(klass, "glVertexAttrib4uivARB", gl_VertexAttrib4uivARB, 2);
805
+ rb_define_method(klass, "glVertexAttrib4usvARB", gl_VertexAttrib4usvARB, 2);
806
+ rb_define_method(klass, "glVertexAttrib1dvARB", gl_VertexAttrib1dvARB, 2);
807
+ rb_define_method(klass, "glVertexAttrib1fvARB", gl_VertexAttrib1fvARB, 2);
808
+ rb_define_method(klass, "glVertexAttrib1svARB", gl_VertexAttrib1svARB, 2);
809
+ rb_define_method(klass, "glVertexAttrib2dvARB", gl_VertexAttrib2dvARB, 2);
810
+ rb_define_method(klass, "glVertexAttrib2fvARB", gl_VertexAttrib2fvARB, 2);
811
+ rb_define_method(klass, "glVertexAttrib2svARB", gl_VertexAttrib2svARB, 2);
812
+ rb_define_method(klass, "glVertexAttrib3dvARB", gl_VertexAttrib3dvARB, 2);
813
+ rb_define_method(klass, "glVertexAttrib3fvARB", gl_VertexAttrib3fvARB, 2);
814
+ rb_define_method(klass, "glVertexAttrib3svARB", gl_VertexAttrib3svARB, 2);
815
+ rb_define_method(klass, "glVertexAttrib4dvARB", gl_VertexAttrib4dvARB, 2);
816
+ rb_define_method(klass, "glVertexAttrib4fvARB", gl_VertexAttrib4fvARB, 2);
817
+ rb_define_method(klass, "glVertexAttrib4svARB", gl_VertexAttrib4svARB, 2);
818
+ rb_define_method(klass, "glGetVertexAttribdvARB", gl_GetVertexAttribdvARB, 2);
819
+ rb_define_method(klass, "glGetVertexAttribfvARB", gl_GetVertexAttribfvARB, 2);
820
+ rb_define_method(klass, "glGetVertexAttribivARB", gl_GetVertexAttribivARB, 2);
821
+
822
+ /* #29 GL_ARB_occlusion_query */
823
+ rb_define_method(klass, "glGenQueriesARB", gl_GenQueriesARB, 1);
824
+ rb_define_method(klass, "glDeleteQueriesARB", gl_DeleteQueriesARB, 1);
825
+ rb_define_method(klass, "glIsQueryARB", gl_IsQueryARB, 1);
826
+ rb_define_method(klass, "glBeginQueryARB", gl_BeginQueryARB, 2);
827
+ rb_define_method(klass, "glEndQueryARB", gl_EndQueryARB, 1);
828
+ rb_define_method(klass, "glGetQueryivARB", gl_GetQueryivARB, 2);
829
+ rb_define_method(klass, "glGetQueryObjectivARB", gl_GetQueryObjectivARB, 2);
830
+ rb_define_method(klass, "glGetQueryObjectuivARB", gl_GetQueryObjectuivARB, 2);
831
+
832
+ /* #30 GL_ARB_shader_objects */
833
+ rb_define_method(klass, "glDeleteObjectARB", gl_DeleteObjectARB, 1);
834
+ rb_define_method(klass, "glGetHandleARB", gl_GetHandleARB, 1);
835
+ rb_define_method(klass, "glDetachObjectARB", gl_DetachObjectARB, 2);
836
+ rb_define_method(klass, "glCreateShaderObjectARB", gl_CreateShaderObjectARB, 1);
837
+ rb_define_method(klass, "glShaderSourceARB", gl_ShaderSourceARB, 2);
838
+ rb_define_method(klass, "glCompileShaderARB", gl_CompileShaderARB, 1);
839
+ rb_define_method(klass, "glCreateProgramObjectARB", gl_CreateProgramObjectARB, 0);
840
+ rb_define_method(klass, "glAttachObjectARB", gl_AttachObjectARB, 2);
841
+ rb_define_method(klass, "glLinkProgramARB", gl_LinkProgramARB, 1);
842
+ rb_define_method(klass, "glUseProgramObjectARB", gl_UseProgramObjectARB, 1);
843
+ rb_define_method(klass, "glValidateProgramARB", gl_ValidateProgramARB, 1);
844
+ rb_define_method(klass, "glUniform1fARB", gl_Uniform1fARB, 2);
845
+ rb_define_method(klass, "glUniform2fARB", gl_Uniform2fARB, 3);
846
+ rb_define_method(klass, "glUniform3fARB", gl_Uniform3fARB, 4);
847
+ rb_define_method(klass, "glUniform4fARB", gl_Uniform4fARB, 5);
848
+ rb_define_method(klass, "glUniform1iARB", gl_Uniform1iARB, 2);
849
+ rb_define_method(klass, "glUniform2iARB", gl_Uniform2iARB, 3);
850
+ rb_define_method(klass, "glUniform3iARB", gl_Uniform3iARB, 4);
851
+ rb_define_method(klass, "glUniform4iARB", gl_Uniform4iARB, 5);
852
+ rb_define_method(klass, "glUniform1fvARB", gl_Uniform1fvARB, 2);
853
+ rb_define_method(klass, "glUniform2fvARB", gl_Uniform2fvARB, 2);
854
+ rb_define_method(klass, "glUniform3fvARB", gl_Uniform3fvARB, 2);
855
+ rb_define_method(klass, "glUniform4fvARB", gl_Uniform4fvARB, 2);
856
+ rb_define_method(klass, "glUniform1ivARB", gl_Uniform1ivARB, 2);
857
+ rb_define_method(klass, "glUniform2ivARB", gl_Uniform2ivARB, 2);
858
+ rb_define_method(klass, "glUniform3ivARB", gl_Uniform3ivARB, 2);
859
+ rb_define_method(klass, "glUniform4ivARB", gl_Uniform4ivARB, 2);
860
+ rb_define_method(klass, "glUniformMatrix2fvARB", gl_UniformMatrix2fvARB, 3);
861
+ rb_define_method(klass, "glUniformMatrix3fvARB", gl_UniformMatrix3fvARB, 3);
862
+ rb_define_method(klass, "glUniformMatrix4fvARB", gl_UniformMatrix4fvARB, 3);
863
+ rb_define_method(klass, "glGetObjectParameterfvARB", gl_GetObjectParameterfvARB, 2);
864
+ rb_define_method(klass, "glGetObjectParameterivARB", gl_GetObjectParameterivARB, 2);
865
+ rb_define_method(klass, "glGetInfoLogARB", gl_GetInfoLogARB, 1);
866
+ rb_define_method(klass, "glGetShaderSourceARB", gl_GetShaderSourceARB, 1);
867
+ rb_define_method(klass, "glGetAttachedObjectsARB", gl_GetAttachedObjectsARB, 1);
868
+ rb_define_method(klass, "glGetUniformLocationARB", gl_GetUniformLocationARB, 2);
869
+ rb_define_method(klass, "glGetActiveUniformARB", gl_GetActiveUniformARB, 2);
870
+ rb_define_method(klass, "glGetUniformfvARB", gl_GetUniformfvARB, 2);
871
+ rb_define_method(klass, "glGetUniformivARB", gl_GetUniformivARB, 2);
872
+
873
+ /* #31 GL_ARB_vertex_shader */
874
+ rb_define_method(klass, "glBindAttribLocationARB", gl_BindAttribLocationARB, 3);
875
+ rb_define_method(klass, "glGetActiveAttribARB", gl_GetActiveAttribARB, 2);
876
+ rb_define_method(klass, "glGetAttribLocationARB", gl_GetAttribLocationARB, 2);
877
+
878
+ /* #39 GL_ARB_color_buffer_float */
879
+ rb_define_method(klass, "glClampColorARB", gl_ClampColorARB, 2);
880
+ }