summaryrefslogtreecommitdiff
path: root/src/gl/drawing.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-10-07 21:34:18 -0500
committersanine <sanine.not@pm.me>2022-10-07 21:34:18 -0500
commit3dbe9332e47c143a237db12440f134caebd1cfbe (patch)
tree1afdb3b24c1ddf2528b1cff14dfc0868789c1396 /src/gl/drawing.c
parentff14b4a939511d42aa0ca46ea2139637b74e6e8a (diff)
add basic framebuffers and additional float uniforms
Diffstat (limited to 'src/gl/drawing.c')
-rw-r--r--src/gl/drawing.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gl/drawing.c b/src/gl/drawing.c
index e6b1e13..0d21ee8 100644
--- a/src/gl/drawing.c
+++ b/src/gl/drawing.c
@@ -9,6 +9,9 @@ int gl_draw_arrays(lua_State *L);
int gl_draw_elements(lua_State *L);
int gl_set_clear_color(lua_State *L);
int gl_clear(lua_State *L);
+int gl_gen_framebuffers(lua_State *L);
+int gl_bind_framebuffer(lua_State *L);
+int gl_framebuffer_texture_2d(lua_State *L);
void setup_drawing(lua_State *L, int gl_index)
{
@@ -79,3 +82,34 @@ int gl_set_viewport(lua_State *L)
glViewport(x, y, w, h);
return 0;
}
+
+
+int gl_gen_framebuffers(lua_State *L)
+{
+ int framebuffer;
+ glGenFramebuffers(1, &framebuffer);
+ lua_pushinteger(L, framebuffer);
+ return 1;
+}
+
+
+int gl_bind_framebuffer(lua_State *L)
+{
+ int target = luaL_checkinteger(L, 1);
+ int framebuffer = luaL_checkinteger(L, 2);
+ glBindFramebuffer(target, framebuffer);
+ return 0;
+}
+
+
+int gl_framebuffer_texture_2d(lua_State *L)
+{
+ int target = luaL_checkinteger(L, 1);
+ int attachment = luaL_checkinteger(L, 2);
+ int textarget = luaL_checkinteger(L, 3);
+ int texture = luaL_checkinteger(L, 4);
+ int level = luaL_checkinteger(L, 5);
+
+ glFramebufferTexture2D(target, attachment, textarget, texture, level);
+ return 0;
+}