Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
20
ruby/RubyOpenGL/gl/extconf.rb
Normal file
20
ruby/RubyOpenGL/gl/extconf.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require "mkmf"
|
||||
$CFLAGS = "/MD /O2 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS"
|
||||
#$CFLAGS = "/MD /Zi /EHsc /DWIN32 /DNDEBUG /D_WINDOWS"
|
||||
#$LDFLAGS = "/Zi"
|
||||
|
||||
libs = [
|
||||
"opengl32",
|
||||
"glu32",
|
||||
]
|
||||
|
||||
libs.each {|lib|
|
||||
unless have_library(lib)
|
||||
puts "Unable to find #{lib}.lib!"
|
||||
puts
|
||||
exit
|
||||
end
|
||||
}
|
||||
|
||||
create_makefile("gl")
|
||||
|
5197
ruby/RubyOpenGL/gl/gl-1.0-1.1.c
Normal file
5197
ruby/RubyOpenGL/gl/gl-1.0-1.1.c
Normal file
File diff suppressed because it is too large
Load diff
1061
ruby/RubyOpenGL/gl/gl-1.2.c
Normal file
1061
ruby/RubyOpenGL/gl/gl-1.2.c
Normal file
File diff suppressed because it is too large
Load diff
725
ruby/RubyOpenGL/gl/gl-1.3.c
Normal file
725
ruby/RubyOpenGL/gl/gl-1.3.c
Normal file
|
@ -0,0 +1,725 @@
|
|||
/*
|
||||
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
||||
*
|
||||
* This program is distributed under the terms of the MIT license.
|
||||
* See the included MIT-LICENSE file for the terms of this license.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "../common/common.h"
|
||||
|
||||
/* OpenGL 1.3 functions */
|
||||
|
||||
static void (APIENTRY * fptr_glActiveTexture)(GLenum);
|
||||
static VALUE
|
||||
gl_ActiveTexture(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLenum texture;
|
||||
LOAD_GL_FUNC(glActiveTexture)
|
||||
texture = (GLenum)NUM2INT(arg1);
|
||||
fptr_glActiveTexture(texture);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glClientActiveTexture)(GLenum);
|
||||
static VALUE
|
||||
gl_ClientActiveTexture(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLenum texture;
|
||||
LOAD_GL_FUNC(glClientActiveTexture)
|
||||
texture = (GLenum)NUM2INT(arg1);
|
||||
fptr_glClientActiveTexture(texture);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord1d)(GLenum,GLdouble);
|
||||
static VALUE
|
||||
gl_MultiTexCoord1d(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLdouble s;
|
||||
LOAD_GL_FUNC(glMultiTexCoord1d)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLdouble)NUM2DBL(arg2);
|
||||
fptr_glMultiTexCoord1d(target,s);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord1f)(GLenum,GLfloat);
|
||||
static VALUE
|
||||
gl_MultiTexCoord1f(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLfloat s;
|
||||
LOAD_GL_FUNC(glMultiTexCoord1f)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLfloat)NUM2DBL(arg2);
|
||||
fptr_glMultiTexCoord1f(target,s);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord1i)(GLenum,GLint);
|
||||
static VALUE
|
||||
gl_MultiTexCoord1i(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLint s;
|
||||
LOAD_GL_FUNC(glMultiTexCoord1i)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLint)NUM2INT(arg2);
|
||||
fptr_glMultiTexCoord1i(target,s);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord1s)(GLenum,GLshort);
|
||||
static VALUE
|
||||
gl_MultiTexCoord1s(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLshort s;
|
||||
LOAD_GL_FUNC(glMultiTexCoord1s)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLshort)NUM2INT(arg2);
|
||||
fptr_glMultiTexCoord1s(target,s);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord2d)(GLenum,GLdouble,GLdouble);
|
||||
static VALUE
|
||||
gl_MultiTexCoord2d(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum target;
|
||||
GLdouble s;
|
||||
GLdouble t;
|
||||
LOAD_GL_FUNC(glMultiTexCoord2d)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLdouble)NUM2DBL(arg2);
|
||||
t = (GLdouble)NUM2DBL(arg3);
|
||||
fptr_glMultiTexCoord2d(target,s,t);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord2f)(GLenum,GLfloat,GLfloat);
|
||||
static VALUE
|
||||
gl_MultiTexCoord2f(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum target;
|
||||
GLfloat s;
|
||||
GLfloat t;
|
||||
LOAD_GL_FUNC(glMultiTexCoord2f)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLfloat)NUM2DBL(arg2);
|
||||
t = (GLfloat)NUM2DBL(arg3);
|
||||
fptr_glMultiTexCoord2f(target,s,t);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord2i)(GLenum,GLint,GLint);
|
||||
static VALUE
|
||||
gl_MultiTexCoord2i(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum target;
|
||||
GLint s;
|
||||
GLint t;
|
||||
LOAD_GL_FUNC(glMultiTexCoord2i)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLint)NUM2INT(arg2);
|
||||
t = (GLint)NUM2INT(arg3);
|
||||
fptr_glMultiTexCoord2i(target,s,t);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord2s)(GLenum,GLshort,GLshort);
|
||||
static VALUE
|
||||
gl_MultiTexCoord2s(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum target;
|
||||
GLshort s;
|
||||
GLshort t;
|
||||
LOAD_GL_FUNC(glMultiTexCoord2s)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLshort)NUM2INT(arg2);
|
||||
t = (GLshort)NUM2INT(arg3);
|
||||
fptr_glMultiTexCoord2s(target,s,t);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord3d)(GLenum,GLdouble,GLdouble,GLdouble);
|
||||
static VALUE
|
||||
gl_MultiTexCoord3d(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum target;
|
||||
GLdouble s;
|
||||
GLdouble t;
|
||||
GLdouble r;
|
||||
LOAD_GL_FUNC(glMultiTexCoord3d)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLdouble)NUM2DBL(arg2);
|
||||
t = (GLdouble)NUM2DBL(arg3);
|
||||
r = (GLdouble)NUM2DBL(arg4);
|
||||
fptr_glMultiTexCoord3d(target,s,t,r);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord3f)(GLenum,GLfloat,GLfloat,GLfloat);
|
||||
static VALUE
|
||||
gl_MultiTexCoord3f(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum target;
|
||||
GLfloat s;
|
||||
GLfloat t;
|
||||
GLfloat r;
|
||||
LOAD_GL_FUNC(glMultiTexCoord3f)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLfloat)NUM2DBL(arg2);
|
||||
t = (GLfloat)NUM2DBL(arg3);
|
||||
r = (GLfloat)NUM2DBL(arg4);
|
||||
fptr_glMultiTexCoord3f(target,s,t,r);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord3i)(GLenum,GLint,GLint,GLint);
|
||||
static VALUE
|
||||
gl_MultiTexCoord3i(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum target;
|
||||
GLint s;
|
||||
GLint t;
|
||||
GLint r;
|
||||
LOAD_GL_FUNC(glMultiTexCoord3i)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLint)NUM2INT(arg2);
|
||||
t = (GLint)NUM2INT(arg3);
|
||||
r = (GLint)NUM2INT(arg4);
|
||||
fptr_glMultiTexCoord3i(target,s,t,r);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord3s)(GLenum,GLshort,GLshort,GLshort);
|
||||
static VALUE
|
||||
gl_MultiTexCoord3s(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum target;
|
||||
GLshort s;
|
||||
GLshort t;
|
||||
GLshort r;
|
||||
LOAD_GL_FUNC(glMultiTexCoord3s)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLshort)NUM2INT(arg2);
|
||||
t = (GLshort)NUM2INT(arg3);
|
||||
r = (GLshort)NUM2INT(arg4);
|
||||
fptr_glMultiTexCoord3s(target,s,t,r);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord4d)(GLenum,GLdouble,GLdouble,GLdouble,GLdouble);
|
||||
static VALUE
|
||||
gl_MultiTexCoord4d(obj,arg1,arg2,arg3,arg4,arg5)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
||||
{
|
||||
GLenum target;
|
||||
GLdouble s;
|
||||
GLdouble t;
|
||||
GLdouble r;
|
||||
GLdouble q;
|
||||
LOAD_GL_FUNC(glMultiTexCoord4d)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLdouble)NUM2DBL(arg2);
|
||||
t = (GLdouble)NUM2DBL(arg3);
|
||||
r = (GLdouble)NUM2DBL(arg4);
|
||||
q = (GLdouble)NUM2DBL(arg5);
|
||||
fptr_glMultiTexCoord4d(target,s,t,r,q);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord4f)(GLenum,GLfloat,GLfloat,GLfloat,GLfloat);
|
||||
static VALUE
|
||||
gl_MultiTexCoord4f(obj,arg1,arg2,arg3,arg4,arg5)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
||||
{
|
||||
GLenum target;
|
||||
GLfloat s;
|
||||
GLfloat t;
|
||||
GLfloat r;
|
||||
GLfloat q;
|
||||
LOAD_GL_FUNC(glMultiTexCoord4f)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLfloat)NUM2DBL(arg2);
|
||||
t = (GLfloat)NUM2DBL(arg3);
|
||||
r = (GLfloat)NUM2DBL(arg4);
|
||||
q = (GLfloat)NUM2DBL(arg5);
|
||||
fptr_glMultiTexCoord4f(target,s,t,r,q);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord4i)(GLenum,GLint,GLint,GLint,GLint);
|
||||
static VALUE
|
||||
gl_MultiTexCoord4i(obj,arg1,arg2,arg3,arg4,arg5)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
||||
{
|
||||
GLenum target;
|
||||
GLint s;
|
||||
GLint t;
|
||||
GLint r;
|
||||
GLint q;
|
||||
LOAD_GL_FUNC(glMultiTexCoord4i)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLint)NUM2INT(arg2);
|
||||
t = (GLint)NUM2INT(arg3);
|
||||
r = (GLint)NUM2INT(arg4);
|
||||
q = (GLint)NUM2INT(arg5);
|
||||
fptr_glMultiTexCoord4i(target,s,t,r,q);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiTexCoord4s)(GLenum,GLshort,GLshort,GLshort,GLshort);
|
||||
static VALUE
|
||||
gl_MultiTexCoord4s(obj,arg1,arg2,arg3,arg4,arg5)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5;
|
||||
{
|
||||
GLenum target;
|
||||
GLshort s;
|
||||
GLshort t;
|
||||
GLshort r;
|
||||
GLshort q;
|
||||
LOAD_GL_FUNC(glMultiTexCoord4s)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
s = (GLshort)NUM2INT(arg2);
|
||||
t = (GLshort)NUM2INT(arg3);
|
||||
r = (GLshort)NUM2INT(arg4);
|
||||
q = (GLshort)NUM2INT(arg5);
|
||||
fptr_glMultiTexCoord4s(target,s,t,r,q);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#define GLMULTITEXCOORD_VFUNC(_type_) \
|
||||
static VALUE \
|
||||
gl_MultiTexCoord##_type_##v(argc,argv,obj) \
|
||||
int argc; \
|
||||
VALUE *argv; \
|
||||
VALUE obj; \
|
||||
{ \
|
||||
int num; \
|
||||
VALUE args[5]; \
|
||||
RArray *ary; \
|
||||
switch (num = rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3],&args[4])) { \
|
||||
case 2: \
|
||||
if (TYPE(args[1]) == T_ARRAY) { \
|
||||
ary = RARRAY(args[1]); \
|
||||
switch (ary->len) { \
|
||||
case 1: \
|
||||
gl_MultiTexCoord1##_type_(obj,args[0],ary->ptr[0]); \
|
||||
break; \
|
||||
case 2: \
|
||||
gl_MultiTexCoord2##_type_(obj,args[0],ary->ptr[0],ary->ptr[1]); \
|
||||
break; \
|
||||
case 3: \
|
||||
gl_MultiTexCoord3##_type_(obj,args[0],ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
|
||||
break; \
|
||||
case 4: \
|
||||
gl_MultiTexCoord4##_type_(obj,args[0],ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \
|
||||
break; \
|
||||
default: \
|
||||
rb_raise(rb_eArgError, "array length:%d", num); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
gl_MultiTexCoord1##_type_(obj,args[0], args[1]); \
|
||||
break; \
|
||||
} \
|
||||
break; \
|
||||
case 3: \
|
||||
gl_MultiTexCoord2##_type_(obj,args[0], args[1], args[2]); \
|
||||
break; \
|
||||
case 4: \
|
||||
gl_MultiTexCoord3##_type_(obj,args[0], args[1], args[2], args[3]); \
|
||||
break; \
|
||||
case 5: \
|
||||
gl_MultiTexCoord4##_type_(obj,args[0], args[1], args[2], args[3], args[4]); \
|
||||
break; \
|
||||
default: \
|
||||
rb_raise(rb_eArgError, "too many arguments"); \
|
||||
break; \
|
||||
} \
|
||||
return Qnil; \
|
||||
}
|
||||
|
||||
GLMULTITEXCOORD_VFUNC(d)
|
||||
GLMULTITEXCOORD_VFUNC(f)
|
||||
GLMULTITEXCOORD_VFUNC(i)
|
||||
GLMULTITEXCOORD_VFUNC(s)
|
||||
#undef GLTEXCOORD_VFUNC
|
||||
|
||||
|
||||
static void (APIENTRY * fptr_glLoadTransposeMatrixf)(const GLfloat[]);
|
||||
static VALUE
|
||||
gl_LoadTransposeMatrixf(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLfloat m[4*4];
|
||||
LOAD_GL_FUNC(glLoadTransposeMatrixf)
|
||||
ary2cmat4x4flt(arg1, m);
|
||||
fptr_glLoadTransposeMatrixf(m);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glLoadTransposeMatrixd)(const GLdouble[]);
|
||||
static VALUE
|
||||
gl_LoadTransposeMatrixd(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLdouble m[4*4];
|
||||
LOAD_GL_FUNC(glLoadTransposeMatrixd)
|
||||
ary2cmat4x4dbl(arg1, m);
|
||||
fptr_glLoadTransposeMatrixd(m);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultTransposeMatrixf)(const GLfloat[]);
|
||||
static VALUE
|
||||
gl_MultTransposeMatrixf(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLfloat m[4*4];
|
||||
LOAD_GL_FUNC(glMultTransposeMatrixf)
|
||||
ary2cmat4x4flt(arg1, m);
|
||||
fptr_glMultTransposeMatrixf(m);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultTransposeMatrixd)(const GLdouble[]);
|
||||
static VALUE
|
||||
gl_MultTransposeMatrixd(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLdouble m[4*4];
|
||||
LOAD_GL_FUNC(glMultTransposeMatrixd)
|
||||
ary2cmat4x4dbl(arg1, m);
|
||||
fptr_glMultTransposeMatrixd(m);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSampleCoverage)(GLclampf,GLboolean);
|
||||
static VALUE
|
||||
gl_SampleCoverage(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLclampf value;
|
||||
GLboolean invert;
|
||||
LOAD_GL_FUNC(glSampleCoverage)
|
||||
value = (GLclampf)NUM2DBL(arg1);
|
||||
invert = (GLboolean)NUM2INT(arg2);
|
||||
fptr_glSampleCoverage(value,invert);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,GLvoid*);
|
||||
static VALUE
|
||||
gl_CompressedTexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
||||
{
|
||||
GLenum target;
|
||||
GLint level;
|
||||
GLenum internalformat;
|
||||
GLsizei width;
|
||||
GLsizei height;
|
||||
GLsizei depth;
|
||||
GLint border;
|
||||
GLsizei imagesize;
|
||||
GLvoid *pixels;
|
||||
LOAD_GL_FUNC(glCompressedTexImage3D)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
level = (GLint)NUM2INT(arg2);
|
||||
internalformat = (GLenum)NUM2INT(arg3);
|
||||
width = (GLsizei)NUM2UINT(arg4);
|
||||
height = (GLsizei)NUM2UINT(arg5);
|
||||
depth = (GLsizei)NUM2UINT(arg6);
|
||||
border = (GLint)NUM2INT(arg7);
|
||||
imagesize = (GLsizei)NUM2UINT(arg8);
|
||||
if (TYPE(arg9) == T_STRING) {
|
||||
if (RSTRING(arg9)->len < imagesize)
|
||||
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
|
||||
pixels = RSTRING(arg9)->ptr;
|
||||
} else if (NIL_P(arg9)) {
|
||||
pixels = NULL;
|
||||
} else {
|
||||
Check_Type(arg9,T_STRING); /* force exception */
|
||||
return Qnil;
|
||||
}
|
||||
fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,GLvoid*);
|
||||
static VALUE
|
||||
gl_CompressedTexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8;
|
||||
{
|
||||
GLenum target;
|
||||
GLint level;
|
||||
GLenum internalformat;
|
||||
GLsizei width;
|
||||
GLsizei height;
|
||||
GLint border;
|
||||
GLsizei imagesize;
|
||||
GLvoid *pixels;
|
||||
LOAD_GL_FUNC(glCompressedTexImage2D)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
level = (GLint)NUM2INT(arg2);
|
||||
internalformat = (GLenum)NUM2INT(arg3);
|
||||
width = (GLsizei)NUM2UINT(arg4);
|
||||
height = (GLsizei)NUM2UINT(arg5);
|
||||
border = (GLint)NUM2INT(arg6);
|
||||
imagesize = (GLsizei)NUM2UINT(arg7);
|
||||
if (TYPE(arg8) == T_STRING) {
|
||||
if (RSTRING(arg8)->len < imagesize)
|
||||
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len);
|
||||
pixels = RSTRING(arg8)->ptr;
|
||||
} else if (NIL_P(arg8)) {
|
||||
pixels = NULL;
|
||||
} else {
|
||||
Check_Type(arg8,T_STRING); /* force exception */
|
||||
return Qnil;
|
||||
}
|
||||
fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,GLvoid*);
|
||||
static VALUE
|
||||
gl_CompressedTexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
||||
{
|
||||
GLenum target;
|
||||
GLint level;
|
||||
GLenum internalformat;
|
||||
GLsizei width;
|
||||
GLint border;
|
||||
GLsizei imagesize;
|
||||
GLvoid *pixels;
|
||||
LOAD_GL_FUNC(glCompressedTexImage1D)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
level = (GLint)NUM2INT(arg2);
|
||||
internalformat = (GLenum)NUM2INT(arg3);
|
||||
width = (GLsizei)NUM2UINT(arg4);
|
||||
border = (GLint)NUM2INT(arg5);
|
||||
imagesize = (GLsizei)NUM2UINT(arg6);
|
||||
if (TYPE(arg7) == T_STRING) {
|
||||
if (RSTRING(arg7)->len < imagesize)
|
||||
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
|
||||
pixels = RSTRING(arg7)->ptr;
|
||||
} else if (NIL_P(arg7)) {
|
||||
pixels = NULL;
|
||||
} else {
|
||||
Check_Type(arg7,T_STRING); /* force exception */
|
||||
return Qnil;
|
||||
}
|
||||
fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*);
|
||||
static VALUE
|
||||
gl_CompressedTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
||||
{
|
||||
GLenum target;
|
||||
GLint level;
|
||||
GLint xoffset;
|
||||
GLint yoffset;
|
||||
GLint zoffset;
|
||||
GLsizei width;
|
||||
GLsizei height;
|
||||
GLsizei depth;
|
||||
GLenum format;
|
||||
GLsizei imagesize;
|
||||
GLvoid *pixels;
|
||||
LOAD_GL_FUNC(glCompressedTexSubImage3D)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
level = (GLint)NUM2INT(arg2);
|
||||
xoffset = (GLint)NUM2INT(arg3);
|
||||
yoffset = (GLint)NUM2INT(arg4);
|
||||
zoffset = (GLint)NUM2INT(arg5);
|
||||
width = (GLsizei)NUM2UINT(arg6);
|
||||
height = (GLsizei)NUM2UINT(arg7);
|
||||
depth = (GLsizei)NUM2UINT(arg8);
|
||||
format = (GLenum)NUM2INT(arg9);
|
||||
imagesize = (GLsizei)NUM2UINT(arg10);
|
||||
if (TYPE(arg11) == T_STRING) {
|
||||
if (RSTRING(arg11)->len < imagesize)
|
||||
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len);
|
||||
pixels = RSTRING(arg11)->ptr;
|
||||
} else {
|
||||
Check_Type(arg11,T_STRING); /* force exception */
|
||||
return Qnil;
|
||||
}
|
||||
fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*);
|
||||
static VALUE
|
||||
gl_CompressedTexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
||||
{
|
||||
GLenum target;
|
||||
GLint level;
|
||||
GLint xoffset;
|
||||
GLint yoffset;
|
||||
GLsizei width;
|
||||
GLsizei height;
|
||||
GLenum format;
|
||||
GLsizei imagesize;
|
||||
GLvoid *pixels;
|
||||
LOAD_GL_FUNC(glCompressedTexSubImage2D)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
level = (GLint)NUM2INT(arg2);
|
||||
xoffset = (GLint)NUM2INT(arg3);
|
||||
yoffset = (GLint)NUM2INT(arg4);
|
||||
width = (GLsizei)NUM2UINT(arg5);
|
||||
height = (GLsizei)NUM2UINT(arg6);
|
||||
format = (GLenum)NUM2INT(arg7);
|
||||
imagesize = (GLsizei)NUM2UINT(arg8);
|
||||
if (TYPE(arg9) == T_STRING) {
|
||||
if (RSTRING(arg9)->len < imagesize)
|
||||
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len);
|
||||
pixels = RSTRING(arg9)->ptr;
|
||||
} else {
|
||||
Check_Type(arg9,T_STRING); /* force exception */
|
||||
return Qnil;
|
||||
}
|
||||
fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,GLvoid*);
|
||||
static VALUE
|
||||
gl_CompressedTexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
||||
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7;
|
||||
{
|
||||
GLenum target;
|
||||
GLint level;
|
||||
GLint xoffset;
|
||||
GLsizei width;
|
||||
GLenum format;
|
||||
GLsizei imagesize;
|
||||
GLvoid *pixels;
|
||||
LOAD_GL_FUNC(glCompressedTexSubImage1D)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
level = (GLint)NUM2INT(arg2);
|
||||
xoffset = (GLint)NUM2INT(arg3);
|
||||
width = (GLsizei)NUM2UINT(arg4);
|
||||
format = (GLenum)NUM2INT(arg5);
|
||||
imagesize = (GLsizei)NUM2UINT(arg6);
|
||||
if (TYPE(arg7) == T_STRING) {
|
||||
if (RSTRING(arg7)->len < imagesize)
|
||||
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len);
|
||||
pixels = RSTRING(arg7)->ptr;
|
||||
} else {
|
||||
Check_Type(arg7,T_STRING); /* force exception */
|
||||
return Qnil;
|
||||
}
|
||||
fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetCompressedTexImage)(GLenum,GLint,GLvoid*);
|
||||
static VALUE
|
||||
gl_GetCompressedTexImage(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLint lod;
|
||||
GLsizei size = 0;
|
||||
VALUE data;
|
||||
LOAD_GL_FUNC(glGetCompressedTexImage)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
lod = (GLenum)NUM2INT(arg2);
|
||||
glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */
|
||||
data = allocate_buffer_with_string(size);
|
||||
fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING(data)->ptr);
|
||||
return data;
|
||||
}
|
||||
|
||||
void gl_init_functions_1_3(VALUE module)
|
||||
{
|
||||
rb_define_module_function(module, "glActiveTexture", gl_ActiveTexture, 1);
|
||||
rb_define_module_function(module, "glClientActiveTexture", gl_ClientActiveTexture, 1);
|
||||
rb_define_module_function(module, "glMultiTexCoord1d", gl_MultiTexCoord1d, 2);
|
||||
rb_define_module_function(module, "glMultiTexCoord1f", gl_MultiTexCoord1f, 2);
|
||||
rb_define_module_function(module, "glMultiTexCoord1i", gl_MultiTexCoord1i, 2);
|
||||
rb_define_module_function(module, "glMultiTexCoord1s", gl_MultiTexCoord1s, 2);
|
||||
rb_define_module_function(module, "glMultiTexCoord2d", gl_MultiTexCoord2d, 3);
|
||||
rb_define_module_function(module, "glMultiTexCoord2f", gl_MultiTexCoord2f, 3);
|
||||
rb_define_module_function(module, "glMultiTexCoord2i", gl_MultiTexCoord2i, 3);
|
||||
rb_define_module_function(module, "glMultiTexCoord2s", gl_MultiTexCoord2s, 3);
|
||||
rb_define_module_function(module, "glMultiTexCoord3d", gl_MultiTexCoord3d, 4);
|
||||
rb_define_module_function(module, "glMultiTexCoord3f", gl_MultiTexCoord3f, 4);
|
||||
rb_define_module_function(module, "glMultiTexCoord3i", gl_MultiTexCoord3i, 4);
|
||||
rb_define_module_function(module, "glMultiTexCoord3s", gl_MultiTexCoord3s, 4);
|
||||
rb_define_module_function(module, "glMultiTexCoord4d", gl_MultiTexCoord4d, 5);
|
||||
rb_define_module_function(module, "glMultiTexCoord4f", gl_MultiTexCoord4f, 5);
|
||||
rb_define_module_function(module, "glMultiTexCoord4i", gl_MultiTexCoord4i, 5);
|
||||
rb_define_module_function(module, "glMultiTexCoord4s", gl_MultiTexCoord4s, 5);
|
||||
rb_define_module_function(module, "glLoadTransposeMatrixf", gl_LoadTransposeMatrixf, 1);
|
||||
rb_define_module_function(module, "glLoadTransposeMatrixd", gl_LoadTransposeMatrixd, 1);
|
||||
rb_define_module_function(module, "glMultTransposeMatrixf", gl_MultTransposeMatrixf, 1);
|
||||
rb_define_module_function(module, "glMultTransposeMatrixd", gl_MultTransposeMatrixd, 1);
|
||||
rb_define_module_function(module, "glSampleCoverage", gl_SampleCoverage, 2);
|
||||
rb_define_module_function(module, "glCompressedTexImage3D", gl_CompressedTexImage3D, 9);
|
||||
rb_define_module_function(module, "glCompressedTexImage2D", gl_CompressedTexImage2D, 8);
|
||||
rb_define_module_function(module, "glCompressedTexImage1D", gl_CompressedTexImage1D, 7);
|
||||
rb_define_module_function(module, "glCompressedTexSubImage3D", gl_CompressedTexSubImage3D, 11);
|
||||
rb_define_module_function(module, "glCompressedTexSubImage2D", gl_CompressedTexSubImage2D, 9);
|
||||
rb_define_module_function(module, "glCompressedTexSubImage1D", gl_CompressedTexSubImage1D, 7);
|
||||
rb_define_module_function(module, "glGetCompressedTexImage", gl_GetCompressedTexImage, 2);
|
||||
|
||||
/* Additional functions */
|
||||
|
||||
rb_define_module_function(module, "glMultiTexCoord", gl_MultiTexCoorddv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord1dv", gl_MultiTexCoorddv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord1fv", gl_MultiTexCoordfv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord1iv", gl_MultiTexCoordiv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord1sv", gl_MultiTexCoordsv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord2dv", gl_MultiTexCoorddv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord2fv", gl_MultiTexCoordfv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord2iv", gl_MultiTexCoordiv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord2sv", gl_MultiTexCoordsv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord3dv", gl_MultiTexCoorddv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord3fv", gl_MultiTexCoordfv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord3iv", gl_MultiTexCoordiv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord3sv", gl_MultiTexCoordsv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord4dv", gl_MultiTexCoorddv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord4fv", gl_MultiTexCoordfv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord4iv", gl_MultiTexCoordiv, -1);
|
||||
rb_define_module_function(module, "glMultiTexCoord4sv", gl_MultiTexCoordsv, -1);
|
||||
}
|
647
ruby/RubyOpenGL/gl/gl-1.4.c
Normal file
647
ruby/RubyOpenGL/gl/gl-1.4.c
Normal file
|
@ -0,0 +1,647 @@
|
|||
/*
|
||||
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
||||
*
|
||||
* This program is distributed under the terms of the MIT license.
|
||||
* See the included MIT-LICENSE file for the terms of this license.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "../common/common.h"
|
||||
|
||||
/* OpenGL 1.4 functions */
|
||||
|
||||
static void (APIENTRY * fptr_glBlendFuncSeparate)(GLenum,GLenum,GLenum,GLenum);
|
||||
static VALUE
|
||||
gl_BlendFuncSeparate(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum srcRGB;
|
||||
GLenum dstRGB;
|
||||
GLenum srcAlpha;
|
||||
GLenum dstAlpha;
|
||||
LOAD_GL_FUNC(glBlendFuncSeparate)
|
||||
srcRGB = (GLenum)NUM2INT(arg1);
|
||||
dstRGB = (GLenum)NUM2INT(arg2);
|
||||
srcAlpha = (GLenum)NUM2INT(arg3);
|
||||
dstAlpha = (GLenum)NUM2INT(arg4);
|
||||
fptr_glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glFogCoordf)(GLfloat);
|
||||
static VALUE
|
||||
gl_FogCoordf(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLfloat coord;
|
||||
LOAD_GL_FUNC(glFogCoordf)
|
||||
coord=(GLfloat)NUM2DBL(arg1);
|
||||
fptr_glFogCoordf(coord);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glFogCoordfv)(GLfloat *);
|
||||
static VALUE
|
||||
gl_FogCoordfv(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLfloat coord;
|
||||
LOAD_GL_FUNC(glFogCoordfv)
|
||||
Check_Type(arg1,T_ARRAY);
|
||||
ary2cflt(arg1,&coord,1);
|
||||
fptr_glFogCoordfv(&coord);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glFogCoordd)(GLdouble);
|
||||
static VALUE
|
||||
gl_FogCoordd(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLdouble coord;
|
||||
LOAD_GL_FUNC(glFogCoordd)
|
||||
coord=(GLdouble)NUM2DBL(arg1);
|
||||
fptr_glFogCoordd(coord);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glFogCoorddv)(GLdouble *);
|
||||
static VALUE
|
||||
gl_FogCoorddv(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLdouble coord;
|
||||
LOAD_GL_FUNC(glFogCoorddv)
|
||||
Check_Type(arg1,T_ARRAY);
|
||||
ary2cdbl(arg1,&coord,1);
|
||||
fptr_glFogCoorddv(&coord);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
extern VALUE g_FogCoord_ptr;
|
||||
static void (APIENTRY * fptr_glFogCoordPointer)(GLenum,GLsizei,const GLvoid *);
|
||||
static VALUE
|
||||
gl_FogCoordPointer(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum type;
|
||||
GLsizei stride;
|
||||
LOAD_GL_FUNC(glFogCoordPointer)
|
||||
type = (GLenum)NUM2INT(arg1);
|
||||
stride = (GLsizei)NUM2UINT(arg2);
|
||||
Check_Type(arg3, T_STRING);
|
||||
rb_str_freeze(arg3);
|
||||
g_FogCoord_ptr = arg3;
|
||||
fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING(arg3)->ptr);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiDrawArrays)(GLenum,GLint*,GLsizei*,GLsizei);
|
||||
static VALUE
|
||||
gl_MultiDrawArrays(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
/* TODO: check ary1,ary2 if len < primcount then raise */
|
||||
/* stringy ? */
|
||||
GLenum mode;
|
||||
GLsizei primcount;
|
||||
GLint *ary1;
|
||||
GLsizei *ary2;
|
||||
LOAD_GL_FUNC(glMultiDrawArrays)
|
||||
mode = (GLenum)NUM2INT(arg1);
|
||||
primcount = (GLsizei)NUM2UINT(arg4);
|
||||
ary1 = ALLOC_N(GLint,primcount);
|
||||
ary2 = ALLOC_N(GLsizei,primcount);
|
||||
ary2cint(arg2,ary1,primcount);
|
||||
ary2cint(arg3,ary2,primcount);
|
||||
fptr_glMultiDrawArrays(mode,ary1,ary2,primcount);
|
||||
xfree(ary1);
|
||||
xfree(ary2);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glMultiDrawElements)(GLenum,const GLsizei *,GLenum,GLvoid **,GLsizei);
|
||||
static VALUE
|
||||
gl_MultiDrawElements(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum mode;
|
||||
GLenum type;
|
||||
GLsizei *counts;
|
||||
GLvoid **indices;
|
||||
GLint size;
|
||||
RArray *ary;
|
||||
int i;
|
||||
LOAD_GL_FUNC(glMultiDrawElements)
|
||||
mode = (GLenum)NUM2INT(arg1);
|
||||
type = (GLenum)NUM2INT(arg2);
|
||||
Check_Type(arg3,T_ARRAY);
|
||||
ary = RARRAY(arg3);
|
||||
size = ary->len;
|
||||
counts = ALLOC_N(GLsizei,size);
|
||||
indices = ALLOC_N(GLvoid*,size);
|
||||
for (i=0;i<size;i++) {
|
||||
indices[i] = RSTRING(ary->ptr[i])->ptr;
|
||||
counts[i] = RSTRING(ary->ptr[i])->len;
|
||||
}
|
||||
fptr_glMultiDrawElements(mode,counts,type,indices,size);
|
||||
xfree(counts);
|
||||
xfree(indices);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glPointParameterf)(GLenum,GLfloat);
|
||||
static VALUE
|
||||
gl_PointParameterf(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum pname;
|
||||
GLfloat param;
|
||||
LOAD_GL_FUNC(glPointParameterf)
|
||||
pname = (GLenum)NUM2INT(arg1);
|
||||
param = (GLfloat)NUM2INT(arg2);
|
||||
fptr_glPointParameterf(pname,param);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glPointParameterfv)(GLenum,GLfloat *);
|
||||
static VALUE
|
||||
gl_PointParameterfv(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum pname;
|
||||
GLfloat params[3] = {0.0,0.0,0.0};
|
||||
GLint size;
|
||||
LOAD_GL_FUNC(glPointParameterfv)
|
||||
pname = (GLenum)NUM2INT(arg1);
|
||||
Check_Type(arg2,T_ARRAY);
|
||||
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
||||
size = 3;
|
||||
else
|
||||
size = 1;
|
||||
ary2cflt(arg2,params,size);
|
||||
fptr_glPointParameterfv(pname,params);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glPointParameteri)(GLenum,GLint);
|
||||
static VALUE
|
||||
gl_PointParameteri(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum pname;
|
||||
GLint param;
|
||||
LOAD_GL_FUNC(glPointParameteri)
|
||||
pname = (GLenum)NUM2INT(arg1);
|
||||
param = (GLint)NUM2INT(arg2);
|
||||
fptr_glPointParameteri(pname,param);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glPointParameteriv)(GLenum,GLint *);
|
||||
static VALUE
|
||||
gl_PointParameteriv(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum pname;
|
||||
GLint params[3] = {0.0,0.0,0.0};
|
||||
GLint size;
|
||||
LOAD_GL_FUNC(glPointParameteriv)
|
||||
pname = (GLenum)NUM2INT(arg1);
|
||||
Check_Type(arg2,T_ARRAY);
|
||||
if (pname==GL_POINT_DISTANCE_ATTENUATION)
|
||||
size = 3;
|
||||
else
|
||||
size = 1;
|
||||
ary2cint(arg2,params,size);
|
||||
fptr_glPointParameteriv(pname,params);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3b)(GLbyte,GLbyte,GLbyte);
|
||||
static VALUE
|
||||
gl_SecondaryColor3b(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLbyte red;
|
||||
GLbyte green;
|
||||
GLbyte blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3b)
|
||||
red = (GLbyte)NUM2INT(arg1);
|
||||
green = (GLbyte)NUM2INT(arg2);
|
||||
blue = (GLbyte)NUM2INT(arg3);
|
||||
fptr_glSecondaryColor3b(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3d)(GLdouble,GLdouble,GLdouble);
|
||||
static VALUE
|
||||
gl_SecondaryColor3d(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLdouble red;
|
||||
GLdouble green;
|
||||
GLdouble blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3d)
|
||||
red = (GLdouble)NUM2DBL(arg1);
|
||||
green = (GLdouble)NUM2DBL(arg2);
|
||||
blue = (GLdouble)NUM2DBL(arg3);
|
||||
fptr_glSecondaryColor3d(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3f)(GLfloat,GLfloat,GLfloat);
|
||||
static VALUE
|
||||
gl_SecondaryColor3f(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLfloat red;
|
||||
GLfloat green;
|
||||
GLfloat blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3f)
|
||||
red = (GLfloat)NUM2DBL(arg1);
|
||||
green = (GLfloat)NUM2DBL(arg2);
|
||||
blue = (GLfloat)NUM2DBL(arg3);
|
||||
fptr_glSecondaryColor3f(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3i)(GLint,GLint,GLint);
|
||||
static VALUE
|
||||
gl_SecondaryColor3i(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLint red;
|
||||
GLint green;
|
||||
GLint blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3i)
|
||||
red = (GLint)NUM2INT(arg1);
|
||||
green = (GLint)NUM2INT(arg2);
|
||||
blue = (GLint)NUM2INT(arg3);
|
||||
fptr_glSecondaryColor3i(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3s)(GLshort,GLshort,GLshort);
|
||||
static VALUE
|
||||
gl_SecondaryColor3s(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLshort red;
|
||||
GLshort green;
|
||||
GLshort blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3s)
|
||||
red = (GLshort)NUM2INT(arg1);
|
||||
green = (GLshort)NUM2INT(arg2);
|
||||
blue = (GLshort)NUM2INT(arg3);
|
||||
fptr_glSecondaryColor3s(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3ub)(GLubyte,GLubyte,GLubyte);
|
||||
static VALUE
|
||||
gl_SecondaryColor3ub(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLubyte red;
|
||||
GLubyte green;
|
||||
GLubyte blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3ub)
|
||||
red = (GLubyte)NUM2INT(arg1);
|
||||
green = (GLubyte)NUM2INT(arg2);
|
||||
blue = (GLubyte)NUM2INT(arg3);
|
||||
fptr_glSecondaryColor3ub(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3ui)(GLuint,GLuint,GLuint);
|
||||
static VALUE
|
||||
gl_SecondaryColor3ui(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLuint red;
|
||||
GLuint green;
|
||||
GLuint blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3ui)
|
||||
red = (GLuint)NUM2UINT(arg1);
|
||||
green = (GLuint)NUM2UINT(arg2);
|
||||
blue = (GLuint)NUM2UINT(arg3);
|
||||
fptr_glSecondaryColor3ui(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glSecondaryColor3us)(GLushort,GLushort,GLushort);
|
||||
static VALUE
|
||||
gl_SecondaryColor3us(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLushort red;
|
||||
GLushort green;
|
||||
GLushort blue;
|
||||
LOAD_GL_FUNC(glSecondaryColor3us)
|
||||
red = (GLushort)NUM2INT(arg1);
|
||||
green = (GLushort)NUM2INT(arg2);
|
||||
blue = (GLushort)NUM2INT(arg3);
|
||||
fptr_glSecondaryColor3us(red,green,blue);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#define GLSECONDARYCOLOR_VFUNC(_type_) \
|
||||
static VALUE \
|
||||
gl_SecondaryColor##_type_##v(argc,argv,obj) \
|
||||
int argc; \
|
||||
VALUE *argv; \
|
||||
VALUE obj; \
|
||||
{ \
|
||||
int num; \
|
||||
VALUE args[3]; \
|
||||
RArray *ary; \
|
||||
switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \
|
||||
case 1: \
|
||||
if (TYPE(args[0]) == T_ARRAY) { \
|
||||
ary = RARRAY(args[0]); \
|
||||
switch (ary->len) { \
|
||||
case 3: \
|
||||
gl_SecondaryColor3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
|
||||
break; \
|
||||
default: \
|
||||
rb_raise(rb_eArgError, "array length:%d", num); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
rb_raise(rb_eArgError, "array length:%d", num); \
|
||||
break; \
|
||||
case 3: \
|
||||
gl_SecondaryColor3##_type_(obj,args[0], args[1], args[2]); \
|
||||
break; \
|
||||
default: \
|
||||
rb_raise(rb_eArgError, "too many arguments"); \
|
||||
break; \
|
||||
} \
|
||||
return Qnil; \
|
||||
}
|
||||
|
||||
GLSECONDARYCOLOR_VFUNC(b)
|
||||
GLSECONDARYCOLOR_VFUNC(d)
|
||||
GLSECONDARYCOLOR_VFUNC(f)
|
||||
GLSECONDARYCOLOR_VFUNC(i)
|
||||
GLSECONDARYCOLOR_VFUNC(s)
|
||||
GLSECONDARYCOLOR_VFUNC(ui)
|
||||
GLSECONDARYCOLOR_VFUNC(ub)
|
||||
GLSECONDARYCOLOR_VFUNC(us)
|
||||
#undef GLSECONDARYCOLOR_VFUNC
|
||||
|
||||
extern VALUE g_SecondaryColor_ptr;
|
||||
static void (APIENTRY * fptr_glSecondaryColorPointer)(GLint,GLenum,GLsizei,const GLvoid *);
|
||||
static VALUE
|
||||
gl_SecondaryColorPointer(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint size;
|
||||
GLenum type;
|
||||
GLsizei stride;
|
||||
LOAD_GL_FUNC(glSecondaryColorPointer)
|
||||
size = (GLint)NUM2INT(arg1);
|
||||
type = (GLenum)NUM2INT(arg2);
|
||||
stride = (GLsizei)NUM2UINT(arg3);
|
||||
Check_Type(arg4, T_STRING);
|
||||
rb_str_freeze(arg4);
|
||||
g_SecondaryColor_ptr = arg4;
|
||||
fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING(arg4)->ptr);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos2d)(GLdouble,GLdouble);
|
||||
static VALUE
|
||||
gl_WindowPos2d(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLdouble x;
|
||||
GLdouble y;
|
||||
LOAD_GL_FUNC(glWindowPos2d)
|
||||
x = (GLdouble)NUM2DBL(arg1);
|
||||
y = (GLdouble)NUM2DBL(arg2);
|
||||
fptr_glWindowPos2d(x,y);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos2f)(GLfloat,GLfloat);
|
||||
static VALUE
|
||||
gl_WindowPos2f(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
LOAD_GL_FUNC(glWindowPos2f)
|
||||
x = (GLfloat)NUM2DBL(arg1);
|
||||
y = (GLfloat)NUM2DBL(arg2);
|
||||
fptr_glWindowPos2f(x,y);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos2i)(GLint,GLint);
|
||||
static VALUE
|
||||
gl_WindowPos2i(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLint x;
|
||||
GLint y;
|
||||
LOAD_GL_FUNC(glWindowPos2i)
|
||||
x = (GLint)NUM2INT(arg1);
|
||||
y = (GLint)NUM2INT(arg2);
|
||||
fptr_glWindowPos2i(x,y);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos2s)(GLshort,GLshort);
|
||||
static VALUE
|
||||
gl_WindowPos2s(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLshort x;
|
||||
GLshort y;
|
||||
LOAD_GL_FUNC(glWindowPos2s)
|
||||
x = (GLshort)NUM2INT(arg1);
|
||||
y = (GLshort)NUM2INT(arg2);
|
||||
fptr_glWindowPos2s(x,y);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos3d)(GLdouble,GLdouble,GLdouble);
|
||||
static VALUE
|
||||
gl_WindowPos3d(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLdouble x;
|
||||
GLdouble y;
|
||||
GLdouble z;
|
||||
LOAD_GL_FUNC(glWindowPos3d)
|
||||
x = (GLdouble)NUM2DBL(arg1);
|
||||
y = (GLdouble)NUM2DBL(arg2);
|
||||
z = (GLdouble)NUM2DBL(arg3);
|
||||
fptr_glWindowPos3d(x,y,z);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos3f)(GLfloat,GLfloat,GLfloat);
|
||||
static VALUE
|
||||
gl_WindowPos3f(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
LOAD_GL_FUNC(glWindowPos3f)
|
||||
x = (GLfloat)NUM2DBL(arg1);
|
||||
y = (GLfloat)NUM2DBL(arg2);
|
||||
z = (GLfloat)NUM2DBL(arg3);
|
||||
fptr_glWindowPos3f(x,y,z);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos3i)(GLint,GLint,GLint);
|
||||
static VALUE
|
||||
gl_WindowPos3i(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLint x;
|
||||
GLint y;
|
||||
GLint z;
|
||||
LOAD_GL_FUNC(glWindowPos3i)
|
||||
x = (GLint)NUM2INT(arg1);
|
||||
y = (GLint)NUM2INT(arg2);
|
||||
z = (GLint)NUM2INT(arg3);
|
||||
fptr_glWindowPos3i(x,y,z);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glWindowPos3s)(GLshort,GLshort,GLshort);
|
||||
static VALUE
|
||||
gl_WindowPos3s(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLshort x;
|
||||
GLshort y;
|
||||
GLshort z;
|
||||
LOAD_GL_FUNC(glWindowPos3s)
|
||||
x = (GLshort)NUM2INT(arg1);
|
||||
y = (GLshort)NUM2INT(arg2);
|
||||
z = (GLshort)NUM2INT(arg3);
|
||||
fptr_glWindowPos3s(x,y,z);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
#define GLWINDOWPOS_VFUNC(_type_) \
|
||||
static VALUE \
|
||||
gl_WindowPos##_type_##v(argc,argv,obj) \
|
||||
int argc; \
|
||||
VALUE *argv; \
|
||||
VALUE obj; \
|
||||
{ \
|
||||
int num; \
|
||||
VALUE args[3]; \
|
||||
RArray *ary; \
|
||||
switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \
|
||||
case 1: \
|
||||
if (TYPE(args[0]) == T_ARRAY) { \
|
||||
ary = RARRAY(args[0]); \
|
||||
switch (ary->len) { \
|
||||
case 2: \
|
||||
gl_WindowPos2##_type_(obj,ary->ptr[0],ary->ptr[1]); \
|
||||
break; \
|
||||
case 3: \
|
||||
gl_WindowPos3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \
|
||||
break; \
|
||||
default: \
|
||||
rb_raise(rb_eArgError, "array length:%d", num); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
rb_raise(rb_eArgError, "array length:%d", num); \
|
||||
break; \
|
||||
case 2: \
|
||||
gl_WindowPos2##_type_(obj,args[0], args[1]); \
|
||||
break; \
|
||||
case 3: \
|
||||
gl_WindowPos3##_type_(obj,args[0], args[1], args[2]); \
|
||||
break; \
|
||||
default: \
|
||||
rb_raise(rb_eArgError, "too many arguments"); \
|
||||
break; \
|
||||
} \
|
||||
return Qnil; \
|
||||
}
|
||||
|
||||
GLWINDOWPOS_VFUNC(d)
|
||||
GLWINDOWPOS_VFUNC(f)
|
||||
GLWINDOWPOS_VFUNC(i)
|
||||
GLWINDOWPOS_VFUNC(s)
|
||||
#undef GLWINDOWPOS_VFUNC
|
||||
|
||||
|
||||
void gl_init_functions_1_4(VALUE module)
|
||||
{
|
||||
rb_define_module_function(module, "glBlendFuncSeparate", gl_BlendFuncSeparate, 4);
|
||||
rb_define_module_function(module, "glFogCoordf", gl_FogCoordf, 1);
|
||||
rb_define_module_function(module, "glFogCoordfv", gl_FogCoordfv, 1);
|
||||
rb_define_module_function(module, "glFogCoordd", gl_FogCoordd, 1);
|
||||
rb_define_module_function(module, "glFogCoorddv", gl_FogCoorddv, 1);
|
||||
rb_define_module_function(module, "glFogCoordPointer", gl_FogCoordPointer, 3);
|
||||
rb_define_module_function(module, "glMultiDrawArrays", gl_MultiDrawArrays, 4);
|
||||
rb_define_module_function(module, "glMultiDrawElements", gl_MultiDrawElements, 3);
|
||||
rb_define_module_function(module, "glPointParameterf", gl_PointParameterf, 2);
|
||||
rb_define_module_function(module, "glPointParameterfv", gl_PointParameterfv, 2);
|
||||
rb_define_module_function(module, "glPointParameteri", gl_PointParameteri, 2);
|
||||
rb_define_module_function(module, "glPointParameteriv", gl_PointParameteriv, 2);
|
||||
rb_define_module_function(module, "glSecondaryColor3b", gl_SecondaryColor3b, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3d", gl_SecondaryColor3d, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3f", gl_SecondaryColor3f, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3i", gl_SecondaryColor3i, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3s", gl_SecondaryColor3s, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3ub", gl_SecondaryColor3ub, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3ui", gl_SecondaryColor3ui, 3);
|
||||
rb_define_module_function(module, "glSecondaryColor3us", gl_SecondaryColor3us, 3);
|
||||
rb_define_module_function(module, "glSecondaryColorPointer", gl_SecondaryColorPointer, 4);
|
||||
rb_define_module_function(module, "glWindowPos2d", gl_WindowPos2d, 2);
|
||||
rb_define_module_function(module, "glWindowPos2f", gl_WindowPos2f, 2);
|
||||
rb_define_module_function(module, "glWindowPos2i", gl_WindowPos2i, 2);
|
||||
rb_define_module_function(module, "glWindowPos2s", gl_WindowPos2s, 2);
|
||||
rb_define_module_function(module, "glWindowPos3d", gl_WindowPos3d, 3);
|
||||
rb_define_module_function(module, "glWindowPos3f", gl_WindowPos3f, 3);
|
||||
rb_define_module_function(module, "glWindowPos3i", gl_WindowPos3i, 3);
|
||||
rb_define_module_function(module, "glWindowPos3s", gl_WindowPos3s, 3);
|
||||
|
||||
/* Additional Functions */
|
||||
rb_define_module_function(module, "glSecondaryColor3bv", gl_SecondaryColorbv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3dv", gl_SecondaryColordv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3fv", gl_SecondaryColorfv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3iv", gl_SecondaryColoriv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3sv", gl_SecondaryColorsv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3ubv", gl_SecondaryColorubv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3uiv", gl_SecondaryColoruiv, -1);
|
||||
rb_define_module_function(module, "glSecondaryColor3usv", gl_SecondaryColorusv, -1);
|
||||
|
||||
rb_define_module_function(module, "glWindowPos2dv", gl_WindowPosdv, -1);
|
||||
rb_define_module_function(module, "glWindowPos2fv", gl_WindowPosfv, -1);
|
||||
rb_define_module_function(module, "glWindowPos2iv", gl_WindowPosiv, -1);
|
||||
rb_define_module_function(module, "glWindowPos2sv", gl_WindowPossv, -1);
|
||||
rb_define_module_function(module, "glWindowPos3dv", gl_WindowPosdv, -1);
|
||||
rb_define_module_function(module, "glWindowPos3fv", gl_WindowPosfv, -1);
|
||||
rb_define_module_function(module, "glWindowPos3iv", gl_WindowPosiv, -1);
|
||||
rb_define_module_function(module, "glWindowPos3sv", gl_WindowPossv, -1);
|
||||
}
|
362
ruby/RubyOpenGL/gl/gl-1.5.c
Normal file
362
ruby/RubyOpenGL/gl/gl-1.5.c
Normal file
|
@ -0,0 +1,362 @@
|
|||
/*
|
||||
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
||||
*
|
||||
* This program is distributed under the terms of the MIT license.
|
||||
* See the included MIT-LICENSE file for the terms of this license.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "../common/common.h"
|
||||
|
||||
/* OpenGL 1.5 functions */
|
||||
|
||||
static void (APIENTRY * fptr_glGenQueries)(GLsizei,GLuint *);
|
||||
static VALUE
|
||||
gl_GenQueries(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLsizei n;
|
||||
GLuint *queries;
|
||||
RArray *ret;
|
||||
int i;
|
||||
LOAD_GL_FUNC(glGenQueries)
|
||||
n = (GLsizei)NUM2UINT(arg1);
|
||||
queries = ALLOC_N(GLuint, n);
|
||||
fptr_glGenQueries(n, queries);
|
||||
ret = RARRAY(rb_ary_new2(n));
|
||||
for (i = 0; i < n; i++)
|
||||
rb_ary_push((VALUE)ret, INT2NUM(queries[i]));
|
||||
xfree(queries);
|
||||
return (VALUE)ret;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glDeleteQueries)(GLsizei,GLuint *);
|
||||
static VALUE
|
||||
gl_DeleteQueries(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLsizei n;
|
||||
GLuint *queries;
|
||||
LOAD_GL_FUNC(glDeleteQueries)
|
||||
Check_Type(arg1,T_ARRAY);
|
||||
n = RARRAY(arg1)->len;
|
||||
queries = ALLOC_N(GLuint,n);
|
||||
ary2cuint(arg1,queries,n);
|
||||
fptr_glDeleteQueries( n, queries);
|
||||
xfree(queries);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static GLboolean (APIENTRY * fptr_glIsQuery)(GLuint);
|
||||
static VALUE
|
||||
gl_IsQuery(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLuint query;
|
||||
GLboolean ret;
|
||||
LOAD_GL_FUNC(glIsQuery)
|
||||
query = (GLuint)NUM2UINT(arg1);
|
||||
ret = fptr_glIsQuery(query);
|
||||
return INT2NUM(ret);
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glBeginQuery)(GLenum,GLuint);
|
||||
static VALUE
|
||||
gl_BeginQuery(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLuint id;
|
||||
LOAD_GL_FUNC(glBeginQuery)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
id = (GLuint)NUM2UINT(arg2);
|
||||
fptr_glBeginQuery(target,id);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glEndQuery)(GLenum);
|
||||
static VALUE
|
||||
gl_EndQuery(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLenum target;
|
||||
LOAD_GL_FUNC(glEndQuery)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
fptr_glEndQuery(target);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetQueryiv)(GLenum,GLenum,GLint *);
|
||||
static VALUE
|
||||
gl_GetQueryiv(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLenum pname;
|
||||
GLint params = 0;
|
||||
VALUE retary;
|
||||
LOAD_GL_FUNC(glGetQueryiv)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
pname = (GLenum)NUM2INT(arg2);
|
||||
fptr_glGetQueryiv(target,pname,¶ms);
|
||||
retary = rb_ary_new2(1);
|
||||
rb_ary_push(retary, INT2NUM(params));
|
||||
return retary;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetQueryObjectiv)(GLuint,GLenum,GLint *);
|
||||
static VALUE
|
||||
gl_GetQueryObjectiv(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLuint id;
|
||||
GLenum pname;
|
||||
GLint params = 0;
|
||||
VALUE retary;
|
||||
LOAD_GL_FUNC(glGetQueryObjectiv)
|
||||
id = (GLuint)NUM2UINT(arg1);
|
||||
pname = (GLenum)NUM2INT(arg2);
|
||||
fptr_glGetQueryObjectiv(id,pname,¶ms);
|
||||
retary = rb_ary_new2(1);
|
||||
rb_ary_push(retary,INT2NUM(params));
|
||||
return retary;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetQueryObjectuiv)(GLuint,GLenum,GLuint *);
|
||||
static VALUE
|
||||
gl_GetQueryObjectuiv(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLuint id;
|
||||
GLenum pname;
|
||||
GLuint params = 0;
|
||||
VALUE retary;
|
||||
LOAD_GL_FUNC(glGetQueryObjectuiv)
|
||||
id = (GLuint)NUM2UINT(arg1);
|
||||
pname = (GLenum)NUM2INT(arg2);
|
||||
fptr_glGetQueryObjectuiv(id,pname,¶ms);
|
||||
retary = rb_ary_new2(1);
|
||||
rb_ary_push(retary,INT2NUM(params));
|
||||
return retary;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glBindBuffer)(GLenum,GLuint);
|
||||
static VALUE
|
||||
gl_BindBuffer(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLuint buffer;
|
||||
LOAD_GL_FUNC(glBindBuffer)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
buffer = (GLenum)NUM2INT(arg2);
|
||||
fptr_glBindBuffer(target,buffer);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glDeleteBuffers)(GLsizei,GLuint *);
|
||||
static VALUE
|
||||
gl_DeleteBuffers(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLsizei n;
|
||||
GLuint *buffers;
|
||||
LOAD_GL_FUNC(glDeleteBuffers)
|
||||
Check_Type(arg1,T_ARRAY);
|
||||
n = RARRAY(arg1)->len;
|
||||
buffers = ALLOC_N(GLuint,n);
|
||||
ary2cuint(arg1,buffers,n);
|
||||
fptr_glDeleteBuffers(n, buffers);
|
||||
xfree(buffers);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGenBuffers)(GLsizei,GLuint *);
|
||||
static VALUE
|
||||
gl_GenBuffers(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLsizei n;
|
||||
GLuint *buffers;
|
||||
RArray *ret;
|
||||
int i;
|
||||
LOAD_GL_FUNC(glGenBuffers)
|
||||
n = (GLsizei)NUM2UINT(arg1);
|
||||
buffers = ALLOC_N(GLuint, n);
|
||||
fptr_glGenBuffers(n, buffers);
|
||||
ret = RARRAY(rb_ary_new2(n));
|
||||
for (i = 0; i < n; i++)
|
||||
rb_ary_push((VALUE)ret, INT2NUM(buffers[i]));
|
||||
xfree(buffers);
|
||||
return (VALUE)ret;
|
||||
}
|
||||
|
||||
static GLboolean (APIENTRY * fptr_glIsBuffer)(GLuint);
|
||||
static VALUE
|
||||
gl_IsBuffer(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLuint buffer;
|
||||
GLboolean ret;
|
||||
LOAD_GL_FUNC(glIsBuffer)
|
||||
buffer = (GLuint)NUM2UINT(arg1);
|
||||
ret = fptr_glIsBuffer(buffer);
|
||||
return INT2NUM(ret);
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glBufferData)(GLenum,GLsizeiptr,GLvoid *,GLenum);
|
||||
static VALUE
|
||||
gl_BufferData(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum target;
|
||||
GLsizeiptr size;
|
||||
GLenum usage;
|
||||
LOAD_GL_FUNC(glBufferData)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
size = (GLsizeiptr)NUM2INT(arg2);
|
||||
usage = (GLenum)NUM2INT(arg4);
|
||||
if (TYPE(arg3) == T_STRING) {
|
||||
fptr_glBufferData(target,size,(GLvoid *)RSTRING(arg3)->ptr,usage);
|
||||
} else if (NIL_P(arg3)) {
|
||||
fptr_glBufferData(target,size,NULL,usage);
|
||||
} else {
|
||||
Check_Type(arg3,T_STRING); /* force exception */
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid *);
|
||||
static VALUE
|
||||
gl_BufferSubData(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLenum target;
|
||||
GLintptr offset;
|
||||
GLsizeiptr size;
|
||||
LOAD_GL_FUNC(glBufferSubData)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
offset = (GLintptr)NUM2INT(arg2);
|
||||
size = (GLsizeiptr)NUM2INT(arg3);
|
||||
Check_Type(arg4,T_STRING);
|
||||
fptr_glBufferSubData(target,offset,size,(GLvoid *)RSTRING(arg4)->ptr);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid *);
|
||||
static VALUE
|
||||
gl_GetBufferSubData(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
GLenum target;
|
||||
GLintptr offset;
|
||||
GLsizeiptr size;
|
||||
VALUE data;
|
||||
LOAD_GL_FUNC(glGetBufferSubData)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
offset = (GLintptr)NUM2INT(arg2);
|
||||
size = (GLsizeiptr)NUM2INT(arg3);
|
||||
data = allocate_buffer_with_string(size);
|
||||
fptr_glGetBufferSubData(target,offset,size,(GLvoid *)RSTRING(data)->ptr);
|
||||
return data;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetBufferParameteriv)(GLenum,GLenum,GLint *);
|
||||
static VALUE
|
||||
gl_GetBufferParameteriv(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLenum value;
|
||||
GLint data = 0;
|
||||
VALUE retary;
|
||||
LOAD_GL_FUNC(glGetBufferParameteriv)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
value = (GLenum)NUM2INT(arg2);
|
||||
fptr_glGetBufferParameteriv(target,value,&data);
|
||||
retary = rb_ary_new2(1);
|
||||
rb_ary_push(retary,INT2NUM(data));
|
||||
return retary;
|
||||
}
|
||||
|
||||
static GLvoid * (APIENTRY * fptr_glMapBuffer)(GLenum,GLenum);
|
||||
static VALUE
|
||||
gl_MapBuffer(obj,arg1,arg2)
|
||||
VALUE obj,arg1,arg2;
|
||||
{
|
||||
GLenum target;
|
||||
GLenum access;
|
||||
GLint size = 0;
|
||||
VALUE data;
|
||||
GLvoid *buffer_ptr;
|
||||
LOAD_GL_FUNC(glMapBuffer)
|
||||
LOAD_GL_FUNC(glGetBufferParameteriv)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
access = (GLenum)NUM2INT(arg2);
|
||||
fptr_glGetBufferParameteriv(target,GL_BUFFER_SIZE,&size);
|
||||
buffer_ptr = fptr_glMapBuffer(target,access);
|
||||
data = allocate_buffer_with_string(size);
|
||||
memcpy(RSTRING(data)->ptr, buffer_ptr, size);
|
||||
return data;
|
||||
}
|
||||
|
||||
static GLboolean (APIENTRY * fptr_glUnmapBuffer)(GLenum);
|
||||
static VALUE
|
||||
gl_UnmapBuffer(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
GLenum target;
|
||||
GLboolean ret;
|
||||
LOAD_GL_FUNC(glUnmapBuffer)
|
||||
target = (GLenum)NUM2INT(arg1);
|
||||
ret = fptr_glUnmapBuffer(target);
|
||||
return INT2NUM(ret);
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glGetBufferPointerv)(GLenum,GLenum,GLvoid **);
|
||||
static VALUE
|
||||
gl_GetBufferPointerv(obj,arg1,arg2,arg3)
|
||||
VALUE obj,arg1,arg2,arg3;
|
||||
{
|
||||
LOAD_GL_FUNC(glGetBufferPointerv)
|
||||
/* not implemented */
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void gl_init_functions_1_5(VALUE module)
|
||||
{
|
||||
rb_define_module_function(module, "glGenQueries", gl_GenQueries, 1);
|
||||
rb_define_module_function(module, "glDeleteQueries", gl_DeleteQueries, 1);
|
||||
rb_define_module_function(module, "glIsQuery", gl_IsQuery, 1);
|
||||
rb_define_module_function(module, "glBeginQuery", gl_BeginQuery, 2);
|
||||
rb_define_module_function(module, "glEndQuery", gl_EndQuery, 1);
|
||||
rb_define_module_function(module, "glGetQueryiv", gl_GetQueryiv, 2);
|
||||
rb_define_module_function(module, "glGetQueryObjectiv", gl_GetQueryObjectiv, 2);
|
||||
rb_define_module_function(module, "glGetQueryObjectuiv", gl_GetQueryObjectuiv, 2);
|
||||
rb_define_module_function(module, "glBindBuffer", gl_BindBuffer, 2);
|
||||
rb_define_module_function(module, "glDeleteBuffers", gl_DeleteBuffers, 1);
|
||||
rb_define_module_function(module, "glGenBuffers", gl_GenBuffers, 1);
|
||||
rb_define_module_function(module, "glIsBuffer", gl_IsBuffer, 1);
|
||||
rb_define_module_function(module, "glBufferData", gl_BufferData, 4);
|
||||
rb_define_module_function(module, "glBufferSubData", gl_BufferSubData, 4);
|
||||
rb_define_module_function(module, "glGetBufferSubData", gl_GetBufferSubData, 3);
|
||||
rb_define_module_function(module, "glMapBuffer", gl_MapBuffer, 2);
|
||||
rb_define_module_function(module, "glUnmapBuffer", gl_UnmapBuffer, 1);
|
||||
rb_define_module_function(module, "glGetBufferParameteriv", gl_GetBufferParameteriv, 2);
|
||||
rb_define_module_function(module, "glGetBufferPointerv", gl_GetBufferPointerv, 3);
|
||||
}
|
1632
ruby/RubyOpenGL/gl/gl-2.0.c
Normal file
1632
ruby/RubyOpenGL/gl/gl-2.0.c
Normal file
File diff suppressed because it is too large
Load diff
154
ruby/RubyOpenGL/gl/gl-2.1.c
Normal file
154
ruby/RubyOpenGL/gl/gl-2.1.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
|
||||
*
|
||||
* This program is distributed under the terms of the MIT license.
|
||||
* See the included MIT-LICENSE file for the terms of this license.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "../common/common.h"
|
||||
|
||||
static void (APIENTRY * fptr_glUniformMatrix2x3fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
||||
static VALUE
|
||||
gl_UniformMatrix2x3fv(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint location;
|
||||
GLsizei count;
|
||||
GLboolean transpose;
|
||||
GLfloat *value;
|
||||
LOAD_GL_FUNC(glUniformMatrix2x3fv)
|
||||
location = (GLint)NUM2INT(arg1);
|
||||
count = (GLint)NUM2INT(arg2);
|
||||
transpose = (GLboolean)NUM2INT(arg3);
|
||||
value = ALLOC_N(GLfloat, 2*3*count);
|
||||
ary2cflt(arg4,value,2*3*count);
|
||||
fptr_glUniformMatrix2x3fv(location,count,transpose,value);
|
||||
xfree(value);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glUniformMatrix3x2fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
||||
static VALUE
|
||||
gl_UniformMatrix3x2fv(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint location;
|
||||
GLsizei count;
|
||||
GLboolean transpose;
|
||||
GLfloat *value;
|
||||
LOAD_GL_FUNC(glUniformMatrix3x2fv)
|
||||
location = (GLint)NUM2INT(arg1);
|
||||
count = (GLint)NUM2INT(arg2);
|
||||
transpose = (GLboolean)NUM2INT(arg3);
|
||||
value = ALLOC_N(GLfloat, 3*2*count);
|
||||
ary2cflt(arg4,value,3*2*count);
|
||||
fptr_glUniformMatrix3x2fv(location,count,transpose,value);
|
||||
xfree(value);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glUniformMatrix2x4fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
||||
static VALUE
|
||||
gl_UniformMatrix2x4fv(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint location;
|
||||
GLsizei count;
|
||||
GLboolean transpose;
|
||||
GLfloat *value;
|
||||
LOAD_GL_FUNC(glUniformMatrix2x4fv)
|
||||
location = (GLint)NUM2INT(arg1);
|
||||
count = (GLint)NUM2INT(arg2);
|
||||
transpose = (GLboolean)NUM2INT(arg3);
|
||||
value = ALLOC_N(GLfloat, 2*4*count);
|
||||
ary2cflt(arg4,value,2*4*count);
|
||||
fptr_glUniformMatrix2x4fv(location,count,transpose,value);
|
||||
xfree(value);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glUniformMatrix4x2fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
||||
static VALUE
|
||||
gl_UniformMatrix4x2fv(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint location;
|
||||
GLsizei count;
|
||||
GLboolean transpose;
|
||||
GLfloat *value;
|
||||
LOAD_GL_FUNC(glUniformMatrix4x2fv)
|
||||
location = (GLint)NUM2INT(arg1);
|
||||
count = (GLint)NUM2INT(arg2);
|
||||
transpose = (GLboolean)NUM2INT(arg3);
|
||||
value = ALLOC_N(GLfloat, 4*2*count);
|
||||
ary2cflt(arg4,value,4*2*count);
|
||||
fptr_glUniformMatrix4x2fv(location,count,transpose,value);
|
||||
xfree(value);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glUniformMatrix3x4fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
||||
static VALUE
|
||||
gl_UniformMatrix3x4fv(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint location;
|
||||
GLsizei count;
|
||||
GLboolean transpose;
|
||||
GLfloat *value;
|
||||
LOAD_GL_FUNC(glUniformMatrix3x4fv)
|
||||
location = (GLint)NUM2INT(arg1);
|
||||
count = (GLint)NUM2INT(arg2);
|
||||
transpose = (GLboolean)NUM2INT(arg3);
|
||||
value = ALLOC_N(GLfloat, 3*4*count);
|
||||
ary2cflt(arg4,value,3*4*count);
|
||||
fptr_glUniformMatrix3x4fv(location,count,transpose,value);
|
||||
xfree(value);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void (APIENTRY * fptr_glUniformMatrix4x3fv)(GLint,GLsizei,GLboolean,GLfloat *);
|
||||
static VALUE
|
||||
gl_UniformMatrix4x3fv(obj,arg1,arg2,arg3,arg4)
|
||||
VALUE obj,arg1,arg2,arg3,arg4;
|
||||
{
|
||||
GLint location;
|
||||
GLsizei count;
|
||||
GLboolean transpose;
|
||||
GLfloat *value;
|
||||
LOAD_GL_FUNC(glUniformMatrix4x3fv)
|
||||
location = (GLint)NUM2INT(arg1);
|
||||
count = (GLint)NUM2INT(arg2);
|
||||
transpose = (GLboolean)NUM2INT(arg3);
|
||||
value = ALLOC_N(GLfloat, 4*3*count);
|
||||
ary2cflt(arg4,value,4*3*count);
|
||||
fptr_glUniformMatrix4x3fv(location,count,transpose,value);
|
||||
xfree(value);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
void gl_init_functions_2_1(VALUE module)
|
||||
{
|
||||
rb_define_module_function(module, "glUniformMatrix2x3fv", gl_UniformMatrix2x3fv, 4);
|
||||
rb_define_module_function(module, "glUniformMatrix3x2fv", gl_UniformMatrix3x2fv, 4);
|
||||
rb_define_module_function(module, "glUniformMatrix2x4fv", gl_UniformMatrix2x4fv, 4);
|
||||
rb_define_module_function(module, "glUniformMatrix4x2fv", gl_UniformMatrix4x2fv, 4);
|
||||
rb_define_module_function(module, "glUniformMatrix3x4fv", gl_UniformMatrix3x4fv, 4);
|
||||
rb_define_module_function(module, "glUniformMatrix4x3fv", gl_UniformMatrix4x3fv, 4);
|
||||
}
|
2904
ruby/RubyOpenGL/gl/gl-enums.c
Normal file
2904
ruby/RubyOpenGL/gl/gl-enums.c
Normal file
File diff suppressed because it is too large
Load diff
87
ruby/RubyOpenGL/gl/gl.c
Normal file
87
ruby/RubyOpenGL/gl/gl.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
|
||||
* Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
|
||||
*
|
||||
* This program is distributed under the terms of the MIT license.
|
||||
* See the included MIT-LICENSE file for the terms of this license.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "../common/common.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT
|
||||
#endif
|
||||
|
||||
static VALUE module;
|
||||
|
||||
void gl_init_enums(VALUE);
|
||||
void gl_init_functions_1_0__1_1(VALUE);
|
||||
void gl_init_functions_1_2(VALUE);
|
||||
void gl_init_functions_1_3(VALUE);
|
||||
void gl_init_functions_1_4(VALUE);
|
||||
void gl_init_functions_1_5(VALUE);
|
||||
void gl_init_functions_2_0(VALUE);
|
||||
void gl_init_functions_2_1(VALUE);
|
||||
|
||||
VALUE IsFunctionAvailable(char *name)
|
||||
{
|
||||
GLvoid *ret;
|
||||
ret = load_gl_function(name,0); /* won't raise */
|
||||
if (ret==NULL)
|
||||
return Qfalse;
|
||||
else
|
||||
return Qtrue;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
IsAvailable(obj,arg1)
|
||||
VALUE obj,arg1;
|
||||
{
|
||||
char *name = RSTRING(arg1)->ptr;
|
||||
Check_Type(arg1, T_STRING);
|
||||
if (name && name[0] && (name[0]=='G' || name[0]=='W')) { /* GL_, GLX_, WGL_ extension */
|
||||
char buf[512+128];
|
||||
if (strlen(name)>(512))
|
||||
return Qfalse;
|
||||
if (glGetString(GL_EXTENSIONS)==0)
|
||||
return Qfalse;
|
||||
|
||||
sprintf(buf,"Gl.glGetString(Gl::GL_EXTENSIONS).split(' ').include?('%s')", name);
|
||||
return rb_eval_string(buf);
|
||||
} else { /* function */
|
||||
return IsFunctionAvailable(name);
|
||||
}
|
||||
}
|
||||
|
||||
DLLEXPORT void Init_gl()
|
||||
{
|
||||
module = rb_define_module("Gl");
|
||||
gl_init_enums(module);
|
||||
gl_init_functions_1_0__1_1(module);
|
||||
gl_init_functions_1_2(module);
|
||||
gl_init_functions_1_3(module);
|
||||
gl_init_functions_1_4(module);
|
||||
gl_init_functions_1_5(module);
|
||||
gl_init_functions_2_0(module);
|
||||
gl_init_functions_2_1(module);
|
||||
|
||||
rb_define_module_function(module, "is_available?", IsAvailable, 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue