[GB.OPENGL]

* BUG: Missing glu and glsl files


git-svn-id: svn://localhost/gambas/trunk@3961 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Tomek 2011-08-01 15:43:09 +00:00
parent ccc22a8f5f
commit c27b8eb64a
6 changed files with 576 additions and 0 deletions

View File

@ -0,0 +1,202 @@
/***************************************************************************
GLuniform.c
(c) 2009 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#define __GLATTRIBUTES_C
#include "GL.h"
/*GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
//GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
GB_STATIC_METHOD("glVertexAttrib4Niv", NULL, GLVERTEXATTRIB4NIV, "(Index)i(V)Integer[]"),
GB_STATIC_METHOD("glVertexAttrib4Nuiv", NULL, GLVERTEXATTRIB4NUIV, "(Index)i(V)Integer[]"),
GB_STATIC_METHOD("glVertexAttrib4iv", NULL, GLVERTEXATTRIB4IV, "(Index)i(V)Integer[]"),
GB_STATIC_METHOD("glVertexAttrib4uiv", NULL, GLVERTEXATTRIB4UIV, "(Index)i(V)Integer[]"),
//GB_STATIC_METHOD("glVertexAttribPointer", NULL, GLVERTEXATTRIBPOINTER, "(Index)i(Size)i(Type)i(Normalized)b(Stride)i(Pointer)p"),*/
BEGIN_METHOD(GLBINDATTRIBLOCATION, GB_INTEGER program; GB_INTEGER index; GB_STRING name)
glBindAttribLocation (VARG(program), VARG(index), GB.ToZeroString(ARG(name)));
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB1F, GB_INTEGER index; GB_FLOAT x)
glVertexAttrib1d(VARG(index), VARG(x));
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB2F, GB_INTEGER index; GB_FLOAT x; GB_FLOAT y)
glVertexAttrib2d(VARG(index), VARG(x), VARG(y));
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB3F, GB_INTEGER index; GB_FLOAT x; GB_FLOAT y; GB_FLOAT z)
glVertexAttrib3d(VARG(index), VARG(x), VARG(y), VARG(z));
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB4F, GB_INTEGER index; GB_FLOAT x; GB_FLOAT y; GB_FLOAT z; GB_FLOAT w)
glVertexAttrib4d(VARG(index), VARG(x), VARG(y), VARG(z), VARG(w));
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB1FV, GB_INTEGER index; GB_OBJECT v)
GB_ARRAY fArray = VARG(v);
int count = GB.Array.Count(fArray);
if (!count)
return;
GLdouble values[count];
int i;
for (i=0; i<count; i++)
values[i] = *((GLdouble *)GB.Array.Get(fArray, i));
glVertexAttrib1dv (VARG(index), values);
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB2FV, GB_INTEGER index; GB_OBJECT v)
GB_ARRAY fArray = VARG(v);
int count = GB.Array.Count(fArray);
int fill = count & 1; // fill=1 if number isn't pair, first bit = 1
if (!count)
return;
GLdouble values[count+fill];
int i;
for (i=0; i<count; i++)
values[i] = *((GLdouble *)GB.Array.Get(fArray, i));
if (fill)
values[count+1] = 0;
count = (count/2)+fill;
glVertexAttrib2dv (VARG(index), values);
END_METHOD
BEGIN_METHOD(GLVERTEXATTRIB3FV, GB_INTEGER index; GB_OBJECT v)
GB_ARRAY fArray = VARG(v);
int count = GB.Array.Count(fArray);
int fill = count%3 ? (3-(count%3)) : 0;
if (!count)
return;
GLdouble values[count+fill];
int i;
for (i=0; i<count; i++)
values[i] = *((GLdouble *)GB.Array.Get(fArray, i));
if (fill)
{
for (i=1; i<=fill; i++)
values[count+i] = 0;
fill = 1;
}
count = (count/3)+fill;
glVertexAttrib3dv (VARG(index), values);
END_METHOD
BEGIN_METHOD( GLVERTEXATTRIB4FV, GB_INTEGER index; GB_OBJECT v)
GB_ARRAY fArray = VARG(v);
int count = GB.Array.Count(fArray);
int fill = count%4 ? (4-(count%4)) : 0;
if (!count)
return;
GLdouble values[count+fill];
int i;
for (i=0; i<count; i++)
values[i] = *((GLdouble *)GB.Array.Get(fArray, i));
if (fill)
{
for (i=1; i<=fill; i++)
values[count+i] = 0;
fill = 1;
}
count = (count/4)+fill;
glVertexAttrib4dv (VARG(index), values);
END_METHOD
BEGIN_METHOD(GLFRAMEBUFFERTEXTURE2D, GB_INTEGER Target; GB_INTEGER Attachment; GB_INTEGER Textarget; GB_INTEGER Texture; GB_INTEGER Level)
glFramebufferTexture2D(VARG(Target), VARG(Attachment), VARG(Textarget), VARG(Texture), VARG(Level));
END_METHOD
BEGIN_METHOD(GLGENFRAMEBUFFERSEXT, GB_INTEGER N)
GLuint framebuffers;
glGenFramebuffersEXT(VARG(N), &framebuffers);
GB.ReturnInteger(framebuffers);
END_METHOD
BEGIN_METHOD(GLBINDFRAMEBUFFERSEXT, GB_INTEGER Target; GB_INTEGER Framebuffer)
glBindFramebufferEXT(VARG(Target), VARG(Framebuffer));
END_METHOD
BEGIN_METHOD(GLCHECKFRAMEBUFFERSTATUSEXT, GB_INTEGER Target)
GLuint result;
result = glCheckFramebufferStatusEXT (VARG(Target));
GB.ReturnInteger(result);
END_METHOD

View File

@ -0,0 +1,41 @@
/***************************************************************************
GLattributes.h
(c) 2009 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#ifndef __GLATTRIBUTES_H
#define __GLATTRIBUTES_H
#include "main.h"
DECLARE_METHOD(GLBINDATTRIBLOCATION);
DECLARE_METHOD(GLVERTEXATTRIB1F);
DECLARE_METHOD(GLVERTEXATTRIB1FV);
DECLARE_METHOD(GLVERTEXATTRIB2F);
DECLARE_METHOD(GLVERTEXATTRIB2FV);
DECLARE_METHOD(GLVERTEXATTRIB3F);
DECLARE_METHOD(GLVERTEXATTRIB3FV);
DECLARE_METHOD(GLVERTEXATTRIB4F);
DECLARE_METHOD(GLVERTEXATTRIB4FV);
DECLARE_METHOD(GLGENFRAMEBUFFERSEXT);
DECLARE_METHOD(GLFRAMEBUFFERTEXTURE2D);
DECLARE_METHOD(GLBINDFRAMEBUFFERSEXT);
DECLARE_METHOD(GLCHECKFRAMEBUFFERSTATUSEXT);
#endif /* __GLATTRIBUTES_H */

150
gb.opengl/src/glu/GLUnurb.c Normal file
View File

@ -0,0 +1,150 @@
/***************************************************************************
GLUnurb.c
(c) 2005-2007 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#define __GLUNURB_C
#include "GLU.h"
/**************************************************************************/
BEGIN_METHOD(GLUBEGINCURVE, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluBeginCurve(thenurb);
END_METHOD
BEGIN_METHOD(GLUBEGINSURFACE, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluBeginSurface(thenurb);
END_METHOD
BEGIN_METHOD(GLUBEGINTRIM, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluBeginTrim(thenurb);
END_METHOD
BEGIN_METHOD(GLUDELETENURBSRENDERER, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluDeleteNurbsRenderer(thenurb);
END_METHOD
BEGIN_METHOD(GLUENDCURVE, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluEndCurve(thenurb);
END_METHOD
BEGIN_METHOD(GLUENDSURFACE, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluEndSurface(thenurb);
END_METHOD
BEGIN_METHOD(GLUENDTRIM, GB_OBJECT nurb)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluEndTrim(thenurb);
END_METHOD
BEGIN_METHOD(GLUNURBSCURVE, GB_OBJECT nurb; GB_INTEGER knotCount; GB_OBJECT knots; GB_INTEGER stride; GB_OBJECT control; GB_INTEGER order; GB_INTEGER type)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
GB_ARRAY knot = (GB_ARRAY) VARG(knots);
GB_ARRAY controll = (GB_ARRAY) VARG(control);
int i;
int count1 = GB.Array.Count(knot);
int count2 = GB.Array.Count(controll);
GLfloat param1[count1], param2[count2];
for (i=0; i<count1; i++)
param1[i] = *((float *)GB.Array.Get(knot,i));
for (i=0; i<count2; i++)
param2[i] = *((float *)GB.Array.Get(controll,i));
gluNurbsCurve(thenurb,VARG(knotCount),param1, VARG(stride), param2, VARG(order),VARG(type));
END_METHOD
BEGIN_METHOD(GLUNURBSPROPERTY, GB_OBJECT nurb; GB_INTEGER property; GB_FLOAT value)
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
gluNurbsProperty(thenurb, VARG(property), VARG(value));
END_METHOD
//gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
BEGIN_METHOD(GLUNURBSSURFACE, GB_OBJECT nurb; GB_INTEGER sKnotCount; GB_OBJECT sKnots; GB_INTEGER tKnotCount; GB_OBJECT tKnots; GB_INTEGER sStride; GB_INTEGER tStride; GB_INTEGER sOrder; GB_INTEGER tOrder; GB_INTEGER type; GB_OBJECT control)
GB_ARRAY sknot = (GB_ARRAY) VARG(sKnots);
GB_ARRAY tknot = (GB_ARRAY) VARG(tKnots);
GB_ARRAY controll = (GB_ARRAY) VARG(control);
int i;
int count1 = GB.Array.Count(sknot);
int count2 = GB.Array.Count(tknot);
int count3 = GB.Array.Count(controll);
GLfloat param1[count1], param2[count2],param3[count3];
GLUnurbsObj *thenurb;
thenurb=VARG(nurb);
for (i=0; i<count1; i++)
param1[i] = *((float *)GB.Array.Get(sknot,i));
for (i=0; i<count2; i++)
param2[i] = *((float *)GB.Array.Get(tknot,i));
for (i=0; i<count3; i++)
param3[i] = *((float *)GB.Array.Get(controll,i));
gluNurbsSurface(thenurb, VARG(sKnotCount), param1, VARG(tKnotCount), param2, VARG(sStride),VARG(tStride),param3, VARG(sOrder), VARG(tOrder), VARG(type));
END_METHOD
BEGIN_METHOD_VOID(GLUNEWNURBSRENDERER)
GLUnurbsObj *theNurb;
theNurb = gluNewNurbsRenderer();
GB.ReturnPointer(theNurb);
END_METHOD

View File

@ -0,0 +1,46 @@
/***************************************************************************
GLUnurb.h
(c) 2005-2007 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#ifndef __GLUNURB_H
#define __GLUNURB_H
#include "main.h"
DECLARE_METHOD(GLUBEGINCURVE);
DECLARE_METHOD(GLUBEGINSURFACE);
DECLARE_METHOD(GLUBEGINTRIM);
DECLARE_METHOD(GLUDELETENURBSRENDERER);
DECLARE_METHOD(GLUENDCURVE);
DECLARE_METHOD(GLUENDSURFACE);
DECLARE_METHOD(GLUENDTRIM);
/*skip ***DECLARE_METHOD(GLUGETNURBSPROPERTY);
skip ***DECLARE_METHOD(GLULOADSAMPLINGMATRICES);
skip ***DECLARE_METHOD(GLUNURBSCALLBACK);
skip ***DECLARE_METHOD(GLUNURBSCALLBACKDATA);
skip ***DECLARE_METHOD(GLUNURBSCALLBACKDATAEXT);*/
DECLARE_METHOD(GLUNURBSCURVE);
DECLARE_METHOD(GLUNURBSPROPERTY);
DECLARE_METHOD(GLUNURBSSURFACE);
DECLARE_METHOD(GLUNEWNURBSRENDERER);
//DECLARE_METHOD(GLUPWLCURVE);
#endif /* __GLUNURB_H */

View File

@ -0,0 +1,99 @@
/***************************************************************************
GLUcoordTransf.c
(c) 2005-2007 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#define __GLUQUADRATIC_C
#include "GLU.h"
/**************************************************************************/
BEGIN_METHOD_VOID(GLUNEWQUADRIC)
GLUquadricObj *quad;
quad = gluNewQuadric();
GB.ReturnPointer(quad);
END_METHOD
BEGIN_METHOD(GLUQUADRICNORMALS, GB_OBJECT Quad; GB_INTEGER Normal)
GLUquadricObj *quad;
quad = VARG(Quad);
gluQuadricNormals (quad, VARG(Normal));
END_METHOD
BEGIN_METHOD(GLUQUADRICTEXTURE, GB_OBJECT Quad; GB_BOOLEAN Texture)
GLUquadricObj *quad;
quad = VARG(Quad);
gluQuadricTexture (quad, VARG(Texture));
END_METHOD
BEGIN_METHOD(GLUDELETEQUADRIC, GB_OBJECT Quad)
GLUquadricObj *quad;
quad = VARG(Quad);
gluDeleteQuadric(quad);
END_METHOD
BEGIN_METHOD(GLUSPHERE, GB_OBJECT Quad; GB_FLOAT Radius; GB_INTEGER Slices; GB_INTEGER Stacks)
GLUquadricObj *quad;
quad = VARG(Quad);
gluSphere (quad, VARG(Radius), VARG(Slices), VARG(Stacks));
END_METHOD
BEGIN_METHOD(GLUCYLINDER, GB_OBJECT Quad; GB_FLOAT Base; GB_FLOAT Top; GB_FLOAT Height; \
GB_INTEGER Slices; GB_INTEGER Stacks)
GLUquadricObj *quad;
quad = VARG(Quad);
gluCylinder (quad, VARG(Base), VARG(Top), VARG(Height), VARG(Slices), VARG(Stacks));
END_METHOD
BEGIN_METHOD(GLUDISK, GB_OBJECT Quad; GB_FLOAT Inner; GB_FLOAT Outer; \
GB_INTEGER Slices; GB_INTEGER Loops)
GLUquadricObj *quad;
quad = VARG(Quad);
gluDisk (quad, VARG(Inner), VARG(Outer), VARG(Slices), VARG(Loops));
END_METHOD
BEGIN_METHOD(GLUPARTIALDISK, GB_OBJECT Quad; GB_FLOAT Inner; GB_FLOAT Outer; \
GB_INTEGER Slices; GB_INTEGER Loops; GB_FLOAT Start; GB_FLOAT Sweep)
GLUquadricObj *quad;
quad = VARG(Quad);
gluPartialDisk (quad, VARG(Inner), VARG(Outer), VARG(Slices), VARG(Loops), VARG(Start), VARG(Sweep));
END_METHOD

View File

@ -0,0 +1,38 @@
/***************************************************************************
GLUquadratic.h
(c) 2005-2007 Laurent Carlier <lordheavy@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#ifndef __GLUQUADRATIC_H
#define __GLUQUADRATIC_H
#include "main.h"
DECLARE_METHOD(GLUNEWQUADRIC);
DECLARE_METHOD(GLUQUADRICNORMALS);
DECLARE_METHOD(GLUQUADRICTEXTURE);
DECLARE_METHOD(GLUDELETEQUADRIC);
DECLARE_METHOD(GLUSPHERE);
DECLARE_METHOD(GLUCYLINDER);
DECLARE_METHOD(GLUDISK);
DECLARE_METHOD(GLUPARTIALDISK);
#endif /* __GLUQUADRATIC_H */