[GB.OPENGL]

* BUG: Fix Gl.GenFramebuffersEXT() method
* NEW: Add methods Gl.BindRenderbufferEXT(), Gl.GenRenderbuffersEXT() and Gl.IsRenderbufferEXT()



git-svn-id: svn://localhost/gambas/trunk@3987 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Laurent Carlier 2011-08-07 18:53:36 +00:00
parent 7ff239e8d8
commit 2e9f0c57b8
3 changed files with 69 additions and 21 deletions

View File

@ -325,10 +325,13 @@ GB_DESC Cgl[] =
/* 310; GL_EXT_framebuffer_object (incomplete) */
/* framebufferobject.c */
GB_STATIC_METHOD("GenFramebuffersEXT", "i", GLGENFRAMEBUFFERSEXT, "(N)i"),
GB_STATIC_METHOD("FramebufferTexture2dEXT", NULL, GLFRAMEBUFFERTEXTURE2DEXT, "(Target)i(Attachment)i(Textarget)i(Texture)i(Level)i"),
GB_STATIC_METHOD("BindFramebufferEXT", NULL, GLBINDFRAMEBUFFERSEXT, "(Target)i(Framebuffer)i"),
GB_STATIC_METHOD("BindFramebufferEXT", NULL, GLBINDFRAMEBUFFEREXT, "(Target)i(Framebuffer)i"),
GB_STATIC_METHOD("BindRenderbufferEXT",NULL, GLBINDRENDERBUFFEREXT, "(Target)i(Renderbuffer)i"),
GB_STATIC_METHOD("CheckFramebufferStatusEXT", "i", GLCHECKFRAMEBUFFERSTATUSEXT, "(Target)i"),
GB_STATIC_METHOD("FramebufferTexture2dEXT", NULL, GLFRAMEBUFFERTEXTURE2DEXT, "(Target)i(Attachment)i(TexTarget)i(Texture)i(Level)i"),
GB_STATIC_METHOD("GenFramebuffersEXT", "Integer[]", GLGENFRAMEBUFFERSEXT, "(Count)i"),
GB_STATIC_METHOD("GenRenderbuffersEXT", "Integer[]", GLGENRENDERBUFFERSEXT, "(Count)i"),
GB_STATIC_METHOD("IsRenderbufferEXT", "b", GLISRENDERBUFFEREXT, "(Renderbuffer)i"),
// Old constant naming support

View File

@ -25,26 +25,18 @@
#include "GL.h"
BEGIN_METHOD(GLFRAMEBUFFERTEXTURE2DEXT, GB_INTEGER Target; GB_INTEGER Attachment; GB_INTEGER Textarget; GB_INTEGER Texture; GB_INTEGER Level)
glFramebufferTexture2DEXT(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)
BEGIN_METHOD(GLBINDFRAMEBUFFEREXT, GB_INTEGER Target; GB_INTEGER Framebuffer)
glBindFramebufferEXT(VARG(Target), VARG(Framebuffer));
END_METHOD
BEGIN_METHOD(GLBINDRENDERBUFFEREXT, GB_INTEGER Target; GB_INTEGER Renderbuffer)
glBindRenderbufferEXT(VARG(Target), VARG(Renderbuffer));
END_METHOD
BEGIN_METHOD(GLCHECKFRAMEBUFFERSTATUSEXT, GB_INTEGER Target)
GLuint result;
@ -53,4 +45,54 @@ BEGIN_METHOD(GLCHECKFRAMEBUFFERSTATUSEXT, GB_INTEGER Target)
END_METHOD
BEGIN_METHOD(GLFRAMEBUFFERTEXTURE2DEXT, GB_INTEGER Target; GB_INTEGER Attachment; GB_INTEGER Textarget; GB_INTEGER Texture; GB_INTEGER Level)
glFramebufferTexture2DEXT(VARG(Target), VARG(Attachment), VARG(Textarget), VARG(Texture), VARG(Level));
END_METHOD
BEGIN_METHOD(GLGENFRAMEBUFFERSEXT, GB_INTEGER count)
GLuint framebuffers[VARG(count)];
int i, count = VARG(count);
GB_ARRAY iArray;
if (count<=0)
return;
GB.Array.New(&iArray , GB_T_INTEGER , count);
glGenFramebuffersEXT(VARG(count), framebuffers);
for (i=0;i<count; i++)
*((GLuint *)GB.Array.Get(iArray, i)) = framebuffers[i];
GB.ReturnObject(iArray);
END_METHOD
BEGIN_METHOD(GLGENRENDERBUFFERSEXT, GB_INTEGER count)
GLuint renderbuffers[VARG(count)];
int i, count = VARG(count);
GB_ARRAY iArray;
if (count<=0)
return;
GB.Array.New(&iArray , GB_T_INTEGER , count);
glGenRenderbuffersEXT(VARG(count), renderbuffers);
for (i=0;i<count; i++)
*((GLuint *)GB.Array.Get(iArray, i)) = renderbuffers[i];
GB.ReturnObject(iArray);
END_METHOD
BEGIN_METHOD(GLISRENDERBUFFEREXT, GB_INTEGER buffer)
GB.ReturnBoolean(glIsRenderbufferEXT(VARG(buffer)));
END_METHOD
//

View File

@ -25,9 +25,12 @@
#define __FBO_H
#include "main.h"
DECLARE_METHOD(GLGENFRAMEBUFFERSEXT);
DECLARE_METHOD(GLFRAMEBUFFERTEXTURE2DEXT);
DECLARE_METHOD(GLBINDFRAMEBUFFERSEXT);
DECLARE_METHOD(GLBINDFRAMEBUFFEREXT);
DECLARE_METHOD(GLBINDRENDERBUFFEREXT);
DECLARE_METHOD(GLCHECKFRAMEBUFFERSTATUSEXT);
DECLARE_METHOD(GLFRAMEBUFFERTEXTURE2DEXT);
DECLARE_METHOD(GLGENFRAMEBUFFERSEXT);
DECLARE_METHOD(GLGENRENDERBUFFERSEXT);
DECLARE_METHOD(GLISRENDERBUFFEREXT);
#endif /* __FBO_H */