opengl 0.9.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +3 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +29 -0
  5. data/.gemtest +0 -0
  6. data/.gitignore +6 -0
  7. data/.travis.yml +19 -0
  8. data/History.rdoc +77 -0
  9. data/MIT-LICENSE +18 -0
  10. data/Manifest.txt +138 -0
  11. data/README.rdoc +102 -0
  12. data/Rakefile +60 -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 +155 -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/common.h +428 -0
  96. data/ext/opengl/conv.h +244 -0
  97. data/ext/opengl/extconf.rb +47 -0
  98. data/ext/opengl/funcdef.h +313 -0
  99. data/ext/opengl/gl-1.0-1.1.c +3075 -0
  100. data/ext/opengl/gl-1.2.c +155 -0
  101. data/ext/opengl/gl-1.3.c +443 -0
  102. data/ext/opengl/gl-1.4.c +348 -0
  103. data/ext/opengl/gl-1.5.c +224 -0
  104. data/ext/opengl/gl-2.0.c +667 -0
  105. data/ext/opengl/gl-2.1.c +57 -0
  106. data/ext/opengl/gl-3.0.c +493 -0
  107. data/ext/opengl/gl-enums.c +4873 -0
  108. data/ext/opengl/gl-enums.h +14588 -0
  109. data/ext/opengl/gl-error.c +112 -0
  110. data/ext/opengl/gl-error.h +28 -0
  111. data/ext/opengl/gl-ext-3dfx.c +27 -0
  112. data/ext/opengl/gl-ext-arb.c +875 -0
  113. data/ext/opengl/gl-ext-ati.c +41 -0
  114. data/ext/opengl/gl-ext-ext.c +889 -0
  115. data/ext/opengl/gl-ext-gremedy.c +41 -0
  116. data/ext/opengl/gl-ext-nv.c +680 -0
  117. data/ext/opengl/gl-types.h +67 -0
  118. data/ext/opengl/gl.c +220 -0
  119. data/ext/opengl/gl_buffer.c +177 -0
  120. data/ext/opengl/opengl.c +7 -0
  121. data/lib/gl.rb +1 -0
  122. data/lib/opengl.rb +53 -0
  123. data/lib/opengl/2.0/opengl.so +0 -0
  124. data/lib/opengl/2.1/opengl.so +0 -0
  125. data/lib/opengl/test_case.rb +86 -0
  126. data/test/dummy.xorg.conf +140 -0
  127. data/test/test_gl.rb +38 -0
  128. data/test/test_gl_10_11.rb +1363 -0
  129. data/test/test_gl_12.rb +71 -0
  130. data/test/test_gl_13.rb +221 -0
  131. data/test/test_gl_14.rb +218 -0
  132. data/test/test_gl_15.rb +258 -0
  133. data/test/test_gl_20.rb +417 -0
  134. data/test/test_gl_21.rb +436 -0
  135. data/test/test_gl_ext_arb.rb +508 -0
  136. data/test/test_gl_ext_ati.rb +28 -0
  137. data/test/test_gl_ext_ext.rb +608 -0
  138. data/test/test_gl_ext_gremedy.rb +29 -0
  139. data/test/test_gl_ext_nv.rb +349 -0
  140. data/test/test_opengl_buffer.rb +120 -0
  141. data/utils/README +6 -0
  142. data/utils/enumgen.rb +108 -0
  143. data/utils/extlistgen.rb +90 -0
  144. metadata +319 -0
  145. metadata.gz.sig +1 -0
@@ -0,0 +1,155 @@
1
+ /*
2
+ * Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
3
+ * Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
4
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
5
+ *
6
+ * This program is distributed under the terms of the MIT license.
7
+ * See the included MIT-LICENSE file for the terms of this license.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
12
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
13
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
14
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
15
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ */
17
+
18
+ #include "common.h"
19
+
20
+ /* OpenGL 1.2 functions */
21
+
22
+ GL_FUNC_LOAD_4(BlendColor,GLvoid, GLclampf,GLclampf,GLclampf,GLclampf, "1.2")
23
+ GL_FUNC_LOAD_1(BlendEquation,GLvoid, GLenum, "1.2")
24
+ GL_FUNC_LOAD_9(CopyTexSubImage3D,GLvoid, GLenum,GLint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei, "1.2")
25
+
26
+ static void (APIENTRY * fptr_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,GLvoid*);
27
+ static VALUE
28
+ gl_DrawRangeElements(obj,arg1,arg2,arg3,arg4,arg5,arg6)
29
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
30
+ {
31
+ GLenum mode;
32
+ GLuint start;
33
+ GLuint end;
34
+ GLsizei count;
35
+ GLenum type;
36
+ LOAD_GL_FUNC(glDrawRangeElements, "1.2");
37
+ mode = (GLenum)NUM2INT(arg1);
38
+ start = (GLuint)NUM2UINT(arg2);
39
+ end = (GLuint)NUM2UINT(arg3);
40
+ count = (GLsizei)NUM2UINT(arg4);
41
+ type = (GLenum)NUM2INT(arg5);
42
+ if (CheckBufferBinding(GL_ELEMENT_ARRAY_BUFFER_BINDING)) {
43
+ fptr_glDrawRangeElements(mode, start, end, count, type, (GLvoid *)NUM2SIZET(arg6));
44
+ } else {
45
+ VALUE data;
46
+ data = pack_array_or_pass_string(type,arg6);
47
+ fptr_glDrawRangeElements(mode, start, end, count, type, RSTRING_PTR(data));
48
+ }
49
+ CHECK_GLERROR_FROM("glDrawRangeElements");
50
+ return Qnil;
51
+ }
52
+
53
+ static void (APIENTRY * fptr_glTexImage3D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*);
54
+ static VALUE
55
+ gl_TexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
56
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
57
+ {
58
+ GLenum target;
59
+ GLint level;
60
+ GLint internalFormat;
61
+ GLsizei width;
62
+ GLsizei height;
63
+ GLsizei depth;
64
+ GLint border;
65
+ GLenum format;
66
+ GLenum type;
67
+ const char *pixels;
68
+ LOAD_GL_FUNC(glTexImage3D, "1.2");
69
+ target = (GLenum)NUM2INT(arg1);
70
+ level = (GLint)NUM2INT(arg2);
71
+ internalFormat = (GLint)NUM2INT(arg3);
72
+ width = (GLsizei)NUM2UINT(arg4);
73
+ height = (GLsizei)NUM2UINT(arg5);
74
+ depth = (GLsizei)NUM2UINT(arg6);
75
+ border = (GLint)NUM2INT(arg7);
76
+ format = (GLenum)NUM2INT(arg8);
77
+ type = (GLenum)NUM2INT(arg9);
78
+
79
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
80
+ fptr_glTexImage3D( target, level, internalFormat, width, height,
81
+ depth, border, format, type,(GLvoid *)NUM2SIZET(arg10));
82
+ CHECK_GLERROR_FROM("glTexImage3D");
83
+ return Qnil;
84
+ }
85
+
86
+ if (target == GL_PROXY_TEXTURE_3D ||
87
+ target == GL_PROXY_TEXTURE_1D_STACK_MESAX ||
88
+ target == GL_PROXY_TEXTURE_2D_STACK_MESAX ||
89
+ target == GL_PROXY_TEXTURE_2D_ARRAY_EXT ||
90
+ NIL_P(arg10)) { /* proxy texture, no data read */
91
+ pixels = NULL;
92
+ } else {
93
+ VALUE data;
94
+ data = pack_array_or_pass_string(type,arg10);
95
+
96
+ CheckDataSize(type,format,width*height*depth,data);
97
+ pixels = RSTRING_PTR(data);
98
+ }
99
+ fptr_glTexImage3D( target, level, internalFormat, width, height,
100
+ depth, border, format, type,pixels);
101
+ CHECK_GLERROR_FROM("glTexImage3D");
102
+ return Qnil;
103
+ }
104
+
105
+ static void (APIENTRY * fptr_glTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
106
+ static VALUE
107
+ gl_TexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
108
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
109
+ {
110
+ GLenum target;
111
+ GLint level;
112
+ GLint xoffset;
113
+ GLint yoffset;
114
+ GLint zoffset;
115
+ GLsizei width;
116
+ GLsizei height;
117
+ GLsizei depth;
118
+ GLenum format;
119
+ GLenum type;
120
+ LOAD_GL_FUNC(glTexSubImage3D, "1.2");
121
+ target = (GLenum)NUM2INT(arg1);
122
+ level = (GLint)NUM2INT(arg2);
123
+ xoffset = (GLint)NUM2INT(arg3);
124
+ yoffset = (GLint)NUM2INT(arg4);
125
+ zoffset = (GLint)NUM2INT(arg5);
126
+ width = (GLsizei)NUM2UINT(arg6);
127
+ height = (GLsizei)NUM2UINT(arg7);
128
+ depth = (GLsizei)NUM2UINT(arg8);
129
+ format = (GLenum)NUM2INT(arg9);
130
+ type = (GLenum)NUM2INT(arg10);
131
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
132
+ fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
133
+ width, height, depth,
134
+ format, type, (GLvoid *)NUM2SIZET(arg11));
135
+ } else {
136
+ VALUE data;
137
+ data = pack_array_or_pass_string(type,arg11);
138
+ CheckDataSize(type,format,height*width*depth,data);
139
+ fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
140
+ width, height, depth,
141
+ format, type, RSTRING_PTR(data));
142
+ }
143
+ CHECK_GLERROR_FROM("glTexSubImage3D");
144
+ return Qnil;
145
+ }
146
+
147
+ void gl_init_functions_1_2(VALUE module)
148
+ {
149
+ rb_define_module_function(module, "glBlendColor", gl_BlendColor, 4);
150
+ rb_define_module_function(module, "glBlendEquation", gl_BlendEquation, 1);
151
+ rb_define_module_function(module, "glDrawRangeElements", gl_DrawRangeElements, 6);
152
+ rb_define_module_function(module, "glTexImage3D", gl_TexImage3D, 10);
153
+ rb_define_module_function(module, "glTexSubImage3D", gl_TexSubImage3D, 11);
154
+ rb_define_module_function(module, "glCopyTexSubImage3D", gl_CopyTexSubImage3D, 9);
155
+ }
@@ -0,0 +1,443 @@
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 1.3 functions */
19
+
20
+ GL_FUNC_LOAD_1(ActiveTexture,GLvoid, GLenum, "1.3")
21
+ GL_FUNC_LOAD_1(ClientActiveTexture,GLvoid, GLenum, "1.3")
22
+ GL_FUNC_LOAD_2(MultiTexCoord1d,GLvoid, GLenum,GLdouble, "1.3")
23
+ GL_FUNC_LOAD_2(MultiTexCoord1f,GLvoid, GLenum,GLfloat, "1.3")
24
+ GL_FUNC_LOAD_2(MultiTexCoord1i,GLvoid, GLenum,GLint, "1.3")
25
+ GL_FUNC_LOAD_2(MultiTexCoord1s,GLvoid, GLenum,GLshort, "1.3")
26
+ GL_FUNC_LOAD_3(MultiTexCoord2d,GLvoid, GLenum,GLdouble,GLdouble, "1.3")
27
+ GL_FUNC_LOAD_3(MultiTexCoord2f,GLvoid, GLenum,GLfloat,GLfloat, "1.3")
28
+ GL_FUNC_LOAD_3(MultiTexCoord2i,GLvoid, GLenum,GLint,GLint, "1.3")
29
+ GL_FUNC_LOAD_3(MultiTexCoord2s,GLvoid, GLenum,GLshort,GLshort, "1.3")
30
+ GL_FUNC_LOAD_4(MultiTexCoord3d,GLvoid, GLenum,GLdouble,GLdouble,GLdouble, "1.3")
31
+ GL_FUNC_LOAD_4(MultiTexCoord3f,GLvoid, GLenum,GLfloat,GLfloat,GLfloat, "1.3")
32
+ GL_FUNC_LOAD_4(MultiTexCoord3i,GLvoid, GLenum,GLint,GLint,GLint, "1.3")
33
+ GL_FUNC_LOAD_4(MultiTexCoord3s,GLvoid, GLenum,GLshort,GLshort,GLshort, "1.3")
34
+ GL_FUNC_LOAD_5(MultiTexCoord4d,GLvoid, GLenum,GLdouble,GLdouble,GLdouble,GLdouble, "1.3")
35
+ GL_FUNC_LOAD_5(MultiTexCoord4f,GLvoid, GLenum,GLfloat,GLfloat,GLfloat,GLfloat, "1.3")
36
+ GL_FUNC_LOAD_5(MultiTexCoord4i,GLvoid, GLenum,GLint,GLint,GLint,GLint, "1.3")
37
+ GL_FUNC_LOAD_5(MultiTexCoord4s,GLvoid, GLenum,GLshort,GLshort,GLshort,GLshort, "1.3")
38
+ GL_FUNC_LOAD_2(SampleCoverage,GLvoid, GLclampf,GLboolean, "1.3")
39
+
40
+ #define GLMULTITEXCOORD_VFUNC(_type_) \
41
+ static VALUE \
42
+ gl_MultiTexCoord##_type_##v(argc,argv,obj) \
43
+ int argc; \
44
+ VALUE *argv; \
45
+ VALUE obj; \
46
+ { \
47
+ int num; \
48
+ VALUE ary, args[5]; \
49
+ switch (num = rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3], &args[4])) { \
50
+ case 2: \
51
+ if (TYPE(args[1]) == T_ARRAY) { \
52
+ ary = args[1]; \
53
+ switch (RARRAY_LEN(ary)) { \
54
+ case 1: \
55
+ gl_MultiTexCoord1##_type_(obj,args[0],RARRAY_PTR(ary)[0]); \
56
+ break; \
57
+ case 2: \
58
+ gl_MultiTexCoord2##_type_(obj,args[0],RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1]); \
59
+ break; \
60
+ case 3: \
61
+ gl_MultiTexCoord3##_type_(obj,args[0],RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2]); \
62
+ break; \
63
+ case 4: \
64
+ gl_MultiTexCoord4##_type_(obj,args[0],RARRAY_PTR(ary)[0],RARRAY_PTR(ary)[1],RARRAY_PTR(ary)[2],RARRAY_PTR(ary)[3]); \
65
+ break; \
66
+ default: \
67
+ rb_raise(rb_eArgError, "array length:%d", num); \
68
+ } \
69
+ } \
70
+ else { \
71
+ gl_MultiTexCoord1##_type_(obj,args[0], args[1]); \
72
+ break; \
73
+ } \
74
+ break; \
75
+ case 3: \
76
+ gl_MultiTexCoord2##_type_(obj,args[0], args[1], args[2]); \
77
+ break; \
78
+ case 4: \
79
+ gl_MultiTexCoord3##_type_(obj,args[0], args[1], args[2], args[3]); \
80
+ break; \
81
+ case 5: \
82
+ gl_MultiTexCoord4##_type_(obj,args[0], args[1], args[2], args[3], args[4]); \
83
+ break; \
84
+ default: \
85
+ rb_raise(rb_eArgError, "too many arguments"); \
86
+ break; \
87
+ } \
88
+ return Qnil; \
89
+ }
90
+
91
+ GLMULTITEXCOORD_VFUNC(d)
92
+ GLMULTITEXCOORD_VFUNC(f)
93
+ GLMULTITEXCOORD_VFUNC(i)
94
+ GLMULTITEXCOORD_VFUNC(s)
95
+ #undef GLTEXCOORD_VFUNC
96
+
97
+ #define TRANSPOSEMATRIX_FUNC(_name_,_type_) \
98
+ static void (APIENTRY * fptr_gl##_name_)(const _type_[]); \
99
+ static VALUE \
100
+ gl_##_name_(obj,arg1) \
101
+ VALUE obj,arg1; \
102
+ { \
103
+ _type_ m[4*4]; \
104
+ LOAD_GL_FUNC(gl##_name_, "1.3"); \
105
+ ary2cmat##_type_(arg1, m, 4, 4); \
106
+ fptr_gl##_name_(m); \
107
+ CHECK_GLERROR_FROM("gl" #_name_); \
108
+ return Qnil; \
109
+ }
110
+
111
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixf,float)
112
+ TRANSPOSEMATRIX_FUNC(LoadTransposeMatrixd,double)
113
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixf,float)
114
+ TRANSPOSEMATRIX_FUNC(MultTransposeMatrixd,double)
115
+
116
+ #undef TRANSPOSEMATRIX_FUNC
117
+
118
+ static void (APIENTRY * fptr_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,GLvoid*);
119
+ static VALUE
120
+ gl_CompressedTexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
121
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
122
+ {
123
+ GLenum target;
124
+ GLint level;
125
+ GLenum internalformat;
126
+ GLsizei width;
127
+ GLsizei height;
128
+ GLsizei depth;
129
+ GLint border;
130
+ GLsizei imagesize;
131
+ GLvoid *pixels;
132
+ LOAD_GL_FUNC(glCompressedTexImage3D, "1.3");
133
+ target = (GLenum)NUM2INT(arg1);
134
+ level = (GLint)NUM2INT(arg2);
135
+ internalformat = (GLenum)NUM2INT(arg3);
136
+ width = (GLsizei)NUM2UINT(arg4);
137
+ height = (GLsizei)NUM2UINT(arg5);
138
+ depth = (GLsizei)NUM2UINT(arg6);
139
+ border = (GLint)NUM2INT(arg7);
140
+ imagesize = (GLsizei)NUM2UINT(arg8);
141
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
142
+ fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,(GLvoid *)NUM2SIZET(arg9));
143
+ } else {
144
+ if (TYPE(arg9) == T_STRING || TYPE(arg9) == T_ARRAY) {
145
+ VALUE data;
146
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg9);
147
+ if (RSTRING_LEN(data) < imagesize)
148
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
149
+ pixels = RSTRING_PTR(data);
150
+ } else if (NIL_P(arg9)) {
151
+ pixels = NULL;
152
+ } else {
153
+ Check_Type(arg9,T_STRING); /* force exception */
154
+ return Qnil;
155
+ }
156
+ fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels);
157
+ }
158
+ CHECK_GLERROR_FROM("glCompressedTexImage3D");
159
+ return Qnil;
160
+ }
161
+
162
+ static void (APIENTRY * fptr_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,GLvoid*);
163
+ static VALUE
164
+ gl_CompressedTexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
165
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
166
+ {
167
+ GLenum target;
168
+ GLint level;
169
+ GLenum internalformat;
170
+ GLsizei width;
171
+ GLsizei height;
172
+ GLint border;
173
+ GLsizei imagesize;
174
+ GLvoid *pixels;
175
+ LOAD_GL_FUNC(glCompressedTexImage2D, "1.3");
176
+ target = (GLenum)NUM2INT(arg1);
177
+ level = (GLint)NUM2INT(arg2);
178
+ internalformat = (GLenum)NUM2INT(arg3);
179
+ width = (GLsizei)NUM2UINT(arg4);
180
+ height = (GLsizei)NUM2UINT(arg5);
181
+ border = (GLint)NUM2INT(arg6);
182
+ imagesize = (GLsizei)NUM2UINT(arg7);
183
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
184
+ fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,(GLvoid *)NUM2SIZET(arg8));
185
+ } else {
186
+ if (TYPE(arg8) == T_STRING || TYPE(arg8) == T_ARRAY) {
187
+ VALUE data;
188
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg8);
189
+ if (RSTRING_LEN(data) < imagesize)
190
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
191
+ pixels = RSTRING_PTR(data);
192
+ } else if (NIL_P(arg8)) {
193
+ pixels = NULL;
194
+ } else {
195
+ Check_Type(arg8,T_STRING); /* force exception */
196
+ return Qnil;
197
+ }
198
+ fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels);
199
+ }
200
+ CHECK_GLERROR_FROM("glCompressedTexImage2D");
201
+ return Qnil;
202
+ }
203
+
204
+ static void (APIENTRY * fptr_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,GLvoid*);
205
+ static VALUE
206
+ gl_CompressedTexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
207
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
208
+ {
209
+ GLenum target;
210
+ GLint level;
211
+ GLenum internalformat;
212
+ GLsizei width;
213
+ GLint border;
214
+ GLsizei imagesize;
215
+ GLvoid *pixels;
216
+ LOAD_GL_FUNC(glCompressedTexImage1D, "1.3");
217
+ target = (GLenum)NUM2INT(arg1);
218
+ level = (GLint)NUM2INT(arg2);
219
+ internalformat = (GLenum)NUM2INT(arg3);
220
+ width = (GLsizei)NUM2UINT(arg4);
221
+ border = (GLint)NUM2INT(arg5);
222
+ imagesize = (GLsizei)NUM2UINT(arg6);
223
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
224
+ fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,(GLvoid *)NUM2SIZET(arg7));
225
+ } else {
226
+ if (TYPE(arg7) == T_STRING || TYPE(arg7) == T_ARRAY) {
227
+ VALUE data;
228
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
229
+ if (RSTRING_LEN(data) < imagesize)
230
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
231
+ pixels = RSTRING_PTR(data);
232
+ } else if (NIL_P(arg7)) {
233
+ pixels = NULL;
234
+ } else {
235
+ Check_Type(arg7,T_STRING); /* force exception */
236
+ return Qnil;
237
+ }
238
+ fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels);
239
+ }
240
+ CHECK_GLERROR_FROM("glCompressedTexImage1D");
241
+ return Qnil;
242
+ }
243
+
244
+ static void (APIENTRY * fptr_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*);
245
+ static VALUE
246
+ gl_CompressedTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
247
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
248
+ {
249
+ GLenum target;
250
+ GLint level;
251
+ GLint xoffset;
252
+ GLint yoffset;
253
+ GLint zoffset;
254
+ GLsizei width;
255
+ GLsizei height;
256
+ GLsizei depth;
257
+ GLenum format;
258
+ GLsizei imagesize;
259
+ GLvoid *pixels;
260
+ LOAD_GL_FUNC(glCompressedTexSubImage3D, "1.3");
261
+ target = (GLenum)NUM2INT(arg1);
262
+ level = (GLint)NUM2INT(arg2);
263
+ xoffset = (GLint)NUM2INT(arg3);
264
+ yoffset = (GLint)NUM2INT(arg4);
265
+ zoffset = (GLint)NUM2INT(arg5);
266
+ width = (GLsizei)NUM2UINT(arg6);
267
+ height = (GLsizei)NUM2UINT(arg7);
268
+ depth = (GLsizei)NUM2UINT(arg8);
269
+ format = (GLenum)NUM2INT(arg9);
270
+ imagesize = (GLsizei)NUM2UINT(arg10);
271
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
272
+ fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,(GLvoid *)NUM2SIZET(arg11));
273
+ } else {
274
+ VALUE data;
275
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg11);
276
+ if (RSTRING_LEN(data) < imagesize)
277
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
278
+ pixels = RSTRING_PTR(data);
279
+
280
+ fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels);
281
+ }
282
+ CHECK_GLERROR_FROM("glCompressedTexSubImage3D");
283
+ return Qnil;
284
+ }
285
+
286
+ static void (APIENTRY * fptr_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*);
287
+ static VALUE
288
+ gl_CompressedTexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
289
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
290
+ {
291
+ GLenum target;
292
+ GLint level;
293
+ GLint xoffset;
294
+ GLint yoffset;
295
+ GLsizei width;
296
+ GLsizei height;
297
+ GLenum format;
298
+ GLsizei imagesize;
299
+ GLvoid *pixels;
300
+ LOAD_GL_FUNC(glCompressedTexSubImage2D, "1.3");
301
+ target = (GLenum)NUM2INT(arg1);
302
+ level = (GLint)NUM2INT(arg2);
303
+ xoffset = (GLint)NUM2INT(arg3);
304
+ yoffset = (GLint)NUM2INT(arg4);
305
+ width = (GLsizei)NUM2UINT(arg5);
306
+ height = (GLsizei)NUM2UINT(arg6);
307
+ format = (GLenum)NUM2INT(arg7);
308
+ imagesize = (GLsizei)NUM2UINT(arg8);
309
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
310
+ fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,(GLvoid *)NUM2SIZET(arg9));
311
+ } else {
312
+ VALUE data;
313
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg9);
314
+ if (RSTRING_LEN(data) < imagesize)
315
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
316
+ pixels = RSTRING_PTR(data);
317
+ fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels);
318
+ }
319
+ CHECK_GLERROR_FROM("glCompressedTexSubImage2D");
320
+ return Qnil;
321
+ }
322
+
323
+ static void (APIENTRY * fptr_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,GLvoid*);
324
+ static VALUE
325
+ gl_CompressedTexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
326
+ VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
327
+ {
328
+ GLenum target;
329
+ GLint level;
330
+ GLint xoffset;
331
+ GLsizei width;
332
+ GLenum format;
333
+ GLsizei imagesize;
334
+ GLvoid *pixels;
335
+ LOAD_GL_FUNC(glCompressedTexSubImage1D, "1.3");
336
+ target = (GLenum)NUM2INT(arg1);
337
+ level = (GLint)NUM2INT(arg2);
338
+ xoffset = (GLint)NUM2INT(arg3);
339
+ width = (GLsizei)NUM2UINT(arg4);
340
+ format = (GLenum)NUM2INT(arg5);
341
+ imagesize = (GLsizei)NUM2UINT(arg6);
342
+ if (CheckBufferBinding(GL_PIXEL_UNPACK_BUFFER_BINDING)) {
343
+ fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,(GLvoid *)NUM2SIZET(arg7));
344
+ } else {
345
+ VALUE data;
346
+ data = pack_array_or_pass_string(GL_UNSIGNED_BYTE,arg7);
347
+ if (RSTRING_LEN(data) < imagesize)
348
+ rb_raise(rb_eArgError, "string length:%li",RSTRING_LEN(data));
349
+ pixels = RSTRING_PTR(data);
350
+ fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels);
351
+ }
352
+ CHECK_GLERROR_FROM("glCompressedTexSubImage1D");
353
+ return Qnil;
354
+ }
355
+
356
+ static void (APIENTRY * fptr_glGetCompressedTexImage)(GLenum,GLint,GLvoid*);
357
+ static VALUE
358
+ gl_GetCompressedTexImage(argc,argv,obj)
359
+ int argc;
360
+ VALUE *argv;
361
+ VALUE obj;
362
+ {
363
+ GLenum target;
364
+ GLint lod;
365
+ GLsizei size = 0;
366
+ VALUE data;
367
+ VALUE args[3];
368
+ int numargs;
369
+ LOAD_GL_FUNC(glGetCompressedTexImage, "1.3");
370
+ numargs = rb_scan_args(argc, argv, "21", &args[0], &args[1], &args[2]);
371
+ target = (GLenum)NUM2INT(args[0]);
372
+ lod = (GLenum)NUM2INT(args[1]);
373
+ switch(numargs) {
374
+ default:
375
+ case 2:
376
+ if (CheckBufferBinding(GL_PIXEL_PACK_BUFFER_BINDING))
377
+ rb_raise(rb_eArgError, "Pixel pack buffer bound, but offset argument missing");
378
+ glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */
379
+ CHECK_GLERROR_FROM("glGetTexLevelParameteriv");
380
+ data = allocate_buffer_with_string(size);
381
+ fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING_PTR(data));
382
+ CHECK_GLERROR_FROM("glGetCompressedTexImage");
383
+ return data;
384
+ case 3:
385
+ fptr_glGetCompressedTexImage(target,lod,(GLvoid*)NUM2SIZET(args[2]));
386
+ CHECK_GLERROR_FROM("glGetCompressedTexImage");
387
+ return Qnil;
388
+ }
389
+ }
390
+
391
+ void gl_init_functions_1_3(VALUE module)
392
+ {
393
+ rb_define_module_function(module, "glActiveTexture", gl_ActiveTexture, 1);
394
+ rb_define_module_function(module, "glClientActiveTexture", gl_ClientActiveTexture, 1);
395
+ rb_define_module_function(module, "glMultiTexCoord1d", gl_MultiTexCoord1d, 2);
396
+ rb_define_module_function(module, "glMultiTexCoord1f", gl_MultiTexCoord1f, 2);
397
+ rb_define_module_function(module, "glMultiTexCoord1i", gl_MultiTexCoord1i, 2);
398
+ rb_define_module_function(module, "glMultiTexCoord1s", gl_MultiTexCoord1s, 2);
399
+ rb_define_module_function(module, "glMultiTexCoord2d", gl_MultiTexCoord2d, 3);
400
+ rb_define_module_function(module, "glMultiTexCoord2f", gl_MultiTexCoord2f, 3);
401
+ rb_define_module_function(module, "glMultiTexCoord2i", gl_MultiTexCoord2i, 3);
402
+ rb_define_module_function(module, "glMultiTexCoord2s", gl_MultiTexCoord2s, 3);
403
+ rb_define_module_function(module, "glMultiTexCoord3d", gl_MultiTexCoord3d, 4);
404
+ rb_define_module_function(module, "glMultiTexCoord3f", gl_MultiTexCoord3f, 4);
405
+ rb_define_module_function(module, "glMultiTexCoord3i", gl_MultiTexCoord3i, 4);
406
+ rb_define_module_function(module, "glMultiTexCoord3s", gl_MultiTexCoord3s, 4);
407
+ rb_define_module_function(module, "glMultiTexCoord4d", gl_MultiTexCoord4d, 5);
408
+ rb_define_module_function(module, "glMultiTexCoord4f", gl_MultiTexCoord4f, 5);
409
+ rb_define_module_function(module, "glMultiTexCoord4i", gl_MultiTexCoord4i, 5);
410
+ rb_define_module_function(module, "glMultiTexCoord4s", gl_MultiTexCoord4s, 5);
411
+ rb_define_module_function(module, "glLoadTransposeMatrixf", gl_LoadTransposeMatrixf, 1);
412
+ rb_define_module_function(module, "glLoadTransposeMatrixd", gl_LoadTransposeMatrixd, 1);
413
+ rb_define_module_function(module, "glMultTransposeMatrixf", gl_MultTransposeMatrixf, 1);
414
+ rb_define_module_function(module, "glMultTransposeMatrixd", gl_MultTransposeMatrixd, 1);
415
+ rb_define_module_function(module, "glSampleCoverage", gl_SampleCoverage, 2);
416
+ rb_define_module_function(module, "glCompressedTexImage3D", gl_CompressedTexImage3D, 9);
417
+ rb_define_module_function(module, "glCompressedTexImage2D", gl_CompressedTexImage2D, 8);
418
+ rb_define_module_function(module, "glCompressedTexImage1D", gl_CompressedTexImage1D, 7);
419
+ rb_define_module_function(module, "glCompressedTexSubImage3D", gl_CompressedTexSubImage3D, 11);
420
+ rb_define_module_function(module, "glCompressedTexSubImage2D", gl_CompressedTexSubImage2D, 9);
421
+ rb_define_module_function(module, "glCompressedTexSubImage1D", gl_CompressedTexSubImage1D, 7);
422
+ rb_define_module_function(module, "glGetCompressedTexImage", gl_GetCompressedTexImage, -1);
423
+
424
+ /* Additional functions */
425
+
426
+ rb_define_module_function(module, "glMultiTexCoord", gl_MultiTexCoorddv, -1);
427
+ rb_define_module_function(module, "glMultiTexCoord1dv", gl_MultiTexCoorddv, -1);
428
+ rb_define_module_function(module, "glMultiTexCoord1fv", gl_MultiTexCoordfv, -1);
429
+ rb_define_module_function(module, "glMultiTexCoord1iv", gl_MultiTexCoordiv, -1);
430
+ rb_define_module_function(module, "glMultiTexCoord1sv", gl_MultiTexCoordsv, -1);
431
+ rb_define_module_function(module, "glMultiTexCoord2dv", gl_MultiTexCoorddv, -1);
432
+ rb_define_module_function(module, "glMultiTexCoord2fv", gl_MultiTexCoordfv, -1);
433
+ rb_define_module_function(module, "glMultiTexCoord2iv", gl_MultiTexCoordiv, -1);
434
+ rb_define_module_function(module, "glMultiTexCoord2sv", gl_MultiTexCoordsv, -1);
435
+ rb_define_module_function(module, "glMultiTexCoord3dv", gl_MultiTexCoorddv, -1);
436
+ rb_define_module_function(module, "glMultiTexCoord3fv", gl_MultiTexCoordfv, -1);
437
+ rb_define_module_function(module, "glMultiTexCoord3iv", gl_MultiTexCoordiv, -1);
438
+ rb_define_module_function(module, "glMultiTexCoord3sv", gl_MultiTexCoordsv, -1);
439
+ rb_define_module_function(module, "glMultiTexCoord4dv", gl_MultiTexCoorddv, -1);
440
+ rb_define_module_function(module, "glMultiTexCoord4fv", gl_MultiTexCoordfv, -1);
441
+ rb_define_module_function(module, "glMultiTexCoord4iv", gl_MultiTexCoordiv, -1);
442
+ rb_define_module_function(module, "glMultiTexCoord4sv", gl_MultiTexCoordsv, -1);
443
+ }