diff --git a/gb.opengl/src/GL.c b/gb.opengl/src/GL.c index 5cf495823..9d5b551bb 100644 --- a/gb.opengl/src/GL.c +++ b/gb.opengl/src/GL.c @@ -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 diff --git a/gb.opengl/src/framebufferobject.c b/gb.opengl/src/framebufferobject.c index b2ea7147f..ea7d51a1f 100644 --- a/gb.opengl/src/framebufferobject.c +++ b/gb.opengl/src/framebufferobject.c @@ -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