From 2df135f767971dd6caa857b5093147198dafa2d0 Mon Sep 17 00:00:00 2001 From: Laurent Carlier Date: Sun, 7 Aug 2011 16:02:41 +0000 Subject: [PATCH] [GB.OPENGL.GLSL] * BUG: Remove FrambufferObject extension functions from glsl component. [GB.OPENGL] * NEW: Add some FramebufferObject extension functions. git-svn-id: svn://localhost/gambas/trunk@3982 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.opengl/src/GL.c | 18 ++++++++++ gb.opengl/src/Makefile.am | 3 +- gb.opengl/src/framebufferobject.c | 56 +++++++++++++++++++++++++++++++ gb.opengl/src/framebufferobject.h | 33 ++++++++++++++++++ gb.opengl/src/glsl/GL.c | 6 ---- gb.opengl/src/glsl/GLattributes.c | 28 ---------------- gb.opengl/src/glsl/GLattributes.h | 4 --- 7 files changed, 109 insertions(+), 39 deletions(-) create mode 100644 gb.opengl/src/framebufferobject.c create mode 100644 gb.opengl/src/framebufferobject.h diff --git a/gb.opengl/src/GL.c b/gb.opengl/src/GL.c index 5c778f887..d0e15ee0c 100644 --- a/gb.opengl/src/GL.c +++ b/gb.opengl/src/GL.c @@ -272,6 +272,24 @@ GB_DESC Cgl[] = GB_STATIC_METHOD("GetIntegerv", "Integer[]", GLGETINTEGERV, "(Parameter)i]"), GB_STATIC_METHOD("GetString", "s", GLGETSTRING, "(Name)i"), + /*********************/ + /* Opengl Extensions */ + /*********************/ + /* See http://www.opengl.org/registry/ */ + + /* ARB extensions */ + + + /* EXT and Vendors extensions */ + + /* 310; GL_EXT_framebuffer_object (incomplete) */ + /* framebufferobject.c */ + GB_STATIC_METHOD("GenFramebuffersEXT", "i", GLGENFRAMEBUFFERSEXT, "(N)i"), + GB_STATIC_METHOD("FramebufferTexture2dEXT", NULL, GLFRAMEBUFFERTEXTURE2D, "(Target)i(Attachment)i(Textarget)i(Texture)i(Level)i"), + GB_STATIC_METHOD("BindFramebufferEXT", NULL, GLBINDFRAMEBUFFERSEXT, "(Target)i(Framebuffer)i"), + GB_STATIC_METHOD("CheckFramebufferStatusEXT", "i", GLCHECKFRAMEBUFFERSTATUSEXT, "(Target)i"), + + /********************/ /* opengl constants */ /********************/ diff --git a/gb.opengl/src/Makefile.am b/gb.opengl/src/Makefile.am index 0c4308cd1..60454e918 100644 --- a/gb.opengl/src/Makefile.am +++ b/gb.opengl/src/Makefile.am @@ -25,4 +25,5 @@ gb_opengl_la_SOURCES = \ GLpixelOperations.h GLpixelOperations.c \ GLrasterization.h GLrasterization.c \ GLtextureMapping.h GLtextureMapping.c \ - GLselectFeedback.h GLselectFeedback.c + GLselectFeedback.h GLselectFeedback.c \ + framebufferobject.h framebufferobject.c diff --git a/gb.opengl/src/framebufferobject.c b/gb.opengl/src/framebufferobject.c new file mode 100644 index 000000000..fbbd126d9 --- /dev/null +++ b/gb.opengl/src/framebufferobject.c @@ -0,0 +1,56 @@ +/*************************************************************************** + + framebufferobject.c + + (c) 2011 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#define __FBO_C + +#include "GL.h" + +BEGIN_METHOD(GLFRAMEBUFFERTEXTURE2DEXT, 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 + +// \ No newline at end of file diff --git a/gb.opengl/src/framebufferobject.h b/gb.opengl/src/framebufferobject.h new file mode 100644 index 000000000..043a57831 --- /dev/null +++ b/gb.opengl/src/framebufferobject.h @@ -0,0 +1,33 @@ +/*************************************************************************** + + framebufferobject.h + + (c) 2011 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __FBO_H +#define __FBO_H + +#include "main.h" +DECLARE_METHOD(GLGENFRAMEBUFFERSEXT); +DECLARE_METHOD(GLFRAMEBUFFERTEXTURE2DEXT); +DECLARE_METHOD(GLBINDFRAMEBUFFERSEXT); +DECLARE_METHOD(GLCHECKFRAMEBUFFERSTATUSEXT); + +#endif /* __FBO_H */ diff --git a/gb.opengl/src/glsl/GL.c b/gb.opengl/src/glsl/GL.c index 686fa9654..23362bfde 100644 --- a/gb.opengl/src/glsl/GL.c +++ b/gb.opengl/src/glsl/GL.c @@ -91,12 +91,6 @@ GB_DESC Cgl[] = GB_STATIC_METHOD("VertexAttrib3fv", NULL, GLVERTEXATTRIB3FV, "(Index)i(V)Float[]"), GB_STATIC_METHOD("VertexAttrib4f", NULL, GLVERTEXATTRIB4F, "(Index)i(X)f(Y)f(Z)f(W)f"), GB_STATIC_METHOD("VertexAttrib4fv", NULL, GLVERTEXATTRIB4FV, "(Index)i(V)Float[]"), - GB_STATIC_METHOD("GenFramebuffersEXT", "i", GLGENFRAMEBUFFERSEXT, "(N)i"), - GB_STATIC_METHOD("FramebufferTexture2d", NULL, GLFRAMEBUFFERTEXTURE2D, "(Target)i(Attachment)i(Textarget)i(Texture)i(Level)i"), - GB_STATIC_METHOD("BindFramebufferEXT", NULL, GLBINDFRAMEBUFFERSEXT, "(Target)i(Framebuffer)i"), - GB_STATIC_METHOD("CheckFramebufferStatusEXT", "i", GLCHECKFRAMEBUFFERSTATUSEXT, "(Target)i"), - - /* Contants */ GB_CONSTANT("GL_ACTIVE_ATTRIBUTES", "i", GL_ACTIVE_ATTRIBUTES), diff --git a/gb.opengl/src/glsl/GLattributes.c b/gb.opengl/src/glsl/GLattributes.c index 062e75cb5..b7f478fe3 100644 --- a/gb.opengl/src/glsl/GLattributes.c +++ b/gb.opengl/src/glsl/GLattributes.c @@ -172,31 +172,3 @@ BEGIN_METHOD( GLVERTEXATTRIB4FV, GB_INTEGER index; GB_OBJECT v) 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 - diff --git a/gb.opengl/src/glsl/GLattributes.h b/gb.opengl/src/glsl/GLattributes.h index a156dfe53..79e1b2ae4 100644 --- a/gb.opengl/src/glsl/GLattributes.h +++ b/gb.opengl/src/glsl/GLattributes.h @@ -33,9 +33,5 @@ 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 */