summaryrefslogtreecommitdiff
path: root/src/gl/gl.c
blob: 8613e70e6a2de6684867c85ad0e4fed021b40cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "gl/glad/glad.h"
#include <GLFW/glfw3.h>
#include <lua.h>
#include <honeysuckle.h>


int gl_init(lua_State *L);
int gl_terminate(lua_State *L);


void setup_gl(lua_State *L, int honey_index)
{
	hs_create_table(L,
		hs_str_cfunc("init", gl_init),
		hs_str_cfunc("terminate", gl_terminate)
	);
	lua_setfield(L, honey_index, "gl");
}


int gl_init(lua_State *L)
{
	if (!glfwInit()) {
		hs_throw_error(L, "failed to initialize GLFW");
	}
	return 0;
}


int gl_terminate(lua_State *L)
{
	glfwTerminate();
	return 0;
}