From 4dbca3f22dae2d3c59b68355c587b19fcae4b850 Mon Sep 17 00:00:00 2001 From: Laurent Carlier Date: Thu, 24 Dec 2009 12:24:01 +0000 Subject: [PATCH] [GB.OPENGL.GLSL] * NEW: Add missing method Gl.GetProgramInfoLog() git-svn-id: svn://localhost/gambas/trunk@2511 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.opengl/src/glsl/GL.c | 1 + gb.opengl/src/glsl/GLprogram.c | 21 +++++++++++++++++++++ gb.opengl/src/glsl/GLprogram.h | 1 + 3 files changed, 23 insertions(+) diff --git a/gb.opengl/src/glsl/GL.c b/gb.opengl/src/glsl/GL.c index a82cb74dc..a33517454 100644 --- a/gb.opengl/src/glsl/GL.c +++ b/gb.opengl/src/glsl/GL.c @@ -48,6 +48,7 @@ GB_DESC Cgl[] = /* GLprogram.c */ GB_STATIC_METHOD("CreateProgram", "i", GLCREATEPROGRAM, NULL), GB_STATIC_METHOD("DeleteProgram", NULL, GLDELETEPROGRAM, "(Program)i"), + GB_STATIC_METHOD("GetProgramInfoLog", "s", GLGETPROGRAMINFOLOG, "(Program)i"), GB_STATIC_METHOD("GetProgramiv", "Integer[]", GLGETPROGRAMIV, "(Program)i(Pname)i"), GB_STATIC_METHOD("IsProgram", "b", GLISPROGRAM, "(Program)i"), GB_STATIC_METHOD("LinkProgram", NULL, GLLINKPROGRAM, "(Program)i"), diff --git a/gb.opengl/src/glsl/GLprogram.c b/gb.opengl/src/glsl/GLprogram.c index 5df85e228..6ff08679c 100644 --- a/gb.opengl/src/glsl/GLprogram.c +++ b/gb.opengl/src/glsl/GLprogram.c @@ -38,6 +38,27 @@ BEGIN_METHOD(GLDELETEPROGRAM, GB_INTEGER program) END_METHOD +BEGIN_METHOD(GLGETPROGRAMINFOLOG, GB_INTEGER program) + + GLint length; + + glGetProgramiv(VARG(program), GL_INFO_LOG_LENGTH, &length); + + if (!length) + { + GB.ReturnNull(); + return; + } + else + { + GLchar log[length]; + + glGetProgramInfoLog(VARG(program), length, NULL, log); + GB.ReturnNewZeroString((const char *)log); + } + +END_METHOD + BEGIN_METHOD(GLGETPROGRAMIV, GB_INTEGER program; GB_INTEGER pname) GLint value; diff --git a/gb.opengl/src/glsl/GLprogram.h b/gb.opengl/src/glsl/GLprogram.h index 23e512ba4..bdb98e671 100644 --- a/gb.opengl/src/glsl/GLprogram.h +++ b/gb.opengl/src/glsl/GLprogram.h @@ -27,6 +27,7 @@ DECLARE_METHOD(GLCREATEPROGRAM); DECLARE_METHOD(GLDELETEPROGRAM); +DECLARE_METHOD(GLGETPROGRAMINFOLOG); DECLARE_METHOD(GLGETPROGRAMIV); DECLARE_METHOD(GLISPROGRAM); DECLARE_METHOD(GLLINKPROGRAM);