From c27b8eb64a6c05b9017b983b59f3f8769135bdcf Mon Sep 17 00:00:00 2001 From: Tomek Date: Mon, 1 Aug 2011 15:43:09 +0000 Subject: [PATCH] [GB.OPENGL] * BUG: Missing glu and glsl files git-svn-id: svn://localhost/gambas/trunk@3961 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.opengl/src/glsl/GLattributes.c | 202 ++++++++++++++++++++++++++++++ gb.opengl/src/glsl/GLattributes.h | 41 ++++++ gb.opengl/src/glu/GLUnurb.c | 150 ++++++++++++++++++++++ gb.opengl/src/glu/GLUnurb.h | 46 +++++++ gb.opengl/src/glu/GLUquadratic.c | 99 +++++++++++++++ gb.opengl/src/glu/GLUquadratic.h | 38 ++++++ 6 files changed, 576 insertions(+) create mode 100644 gb.opengl/src/glsl/GLattributes.c create mode 100644 gb.opengl/src/glsl/GLattributes.h create mode 100644 gb.opengl/src/glu/GLUnurb.c create mode 100644 gb.opengl/src/glu/GLUnurb.h create mode 100644 gb.opengl/src/glu/GLUquadratic.c create mode 100644 gb.opengl/src/glu/GLUquadratic.h diff --git a/gb.opengl/src/glsl/GLattributes.c b/gb.opengl/src/glsl/GLattributes.c new file mode 100644 index 000000000..062e75cb5 --- /dev/null +++ b/gb.opengl/src/glsl/GLattributes.c @@ -0,0 +1,202 @@ +/*************************************************************************** + + GLuniform.c + + (c) 2009 Laurent Carlier + + 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 + + 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 */ diff --git a/gb.opengl/src/glu/GLUnurb.c b/gb.opengl/src/glu/GLUnurb.c new file mode 100644 index 000000000..0305fd836 --- /dev/null +++ b/gb.opengl/src/glu/GLUnurb.c @@ -0,0 +1,150 @@ +/*************************************************************************** + + GLUnurb.c + + (c) 2005-2007 Laurent Carlier + + 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 + + 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 */ diff --git a/gb.opengl/src/glu/GLUquadratic.c b/gb.opengl/src/glu/GLUquadratic.c new file mode 100644 index 000000000..79623441f --- /dev/null +++ b/gb.opengl/src/glu/GLUquadratic.c @@ -0,0 +1,99 @@ +/*************************************************************************** + + GLUcoordTransf.c + + (c) 2005-2007 Laurent Carlier + + 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 + + diff --git a/gb.opengl/src/glu/GLUquadratic.h b/gb.opengl/src/glu/GLUquadratic.h new file mode 100644 index 000000000..54f99d7d6 --- /dev/null +++ b/gb.opengl/src/glu/GLUquadratic.h @@ -0,0 +1,38 @@ +/*************************************************************************** + + GLUquadratic.h + + (c) 2005-2007 Laurent Carlier + + 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 */