aboutsummaryrefslogtreecommitdiffstats
path: root/loadgl.h
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2018-03-26 16:38:09 +0100
committerTomasz Kramkowski <tk@the-tk.com>2018-03-26 19:49:24 +0100
commitca761a910c25197b10aeadcb0120dae132442d56 (patch)
treef28b134d78b87628178fb28130728c56c9949f26 /loadgl.h
downloadfaqe-ca761a910c25197b10aeadcb0120dae132442d56.tar.gz
faqe-ca761a910c25197b10aeadcb0120dae132442d56.tar.xz
faqe-ca761a910c25197b10aeadcb0120dae132442d56.zip
init commit
Diffstat (limited to 'loadgl.h')
-rw-r--r--loadgl.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/loadgl.h b/loadgl.h
new file mode 100644
index 0000000..01acdfa
--- /dev/null
+++ b/loadgl.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
+#ifndef LOADGL_H
+#define LOADGL_H
+
+#include "gldefs.h"
+
+typedef void *lgl_loadfunc(const char *name);
+
+enum lgl_status {
+ LGL_OK,
+ LGL_MISSING,
+};
+
+enum lgl_status lgl_load(lgl_loadfunc *load);
+const char *lgl_strerror(enum lgl_status status);
+
+#define _LGL_INTERFACE(rett, name, func, ...) \
+ typedef rett func(__VA_ARGS__); \
+ extern func *name;
+#define LGL_INTERFACE(rett, name, ...) _LGL_INTERFACE(rett, name, name##_func, __VA_ARGS__)
+
+LGL_INTERFACE(void, gl_viewport, GLint x, GLint y, GLsizei width, GLsizei height);
+LGL_INTERFACE(void, gl_clearcolor, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+LGL_INTERFACE(void, gl_clear, GLbitfield mask);
+/* LGL_INTERFACE(GLboolean, gl_isbuf, GLuint buffer); */
+LGL_INTERFACE(void, gl_buf_gen, GLsizei n, GLuint *buffers);
+/* LGL_INTERFACE(void, gl_buf_del, GLsizei n, GLuint *buffers); */
+LGL_INTERFACE(void, gl_buf_bind, GLenum target, GLuint buffer);
+LGL_INTERFACE(void, gl_buf_data, GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+LGL_INTERFACE(GLuint, gl_shdr_create, GLenum type);
+LGL_INTERFACE(void, gl_shdr_del, GLuint shader);
+/* LGL_INTERFACE(GLboolean, gl_isshdr, GLuint shader); */
+LGL_INTERFACE(void, gl_shdr_source, GLuint shader, GLsizei count, const char * const *string, const GLint *length);
+LGL_INTERFACE(void, gl_shdr_compile, GLuint shader);
+LGL_INTERFACE(void, gl_shdr_param, GLuint shader, GLenum pname, GLint *params);
+LGL_INTERFACE(void, gl_shdr_infolog, GLuint shader, GLsizei size, GLsizei *len, char *data);
+LGL_INTERFACE(GLuint, gl_prog_create, void);
+LGL_INTERFACE(void, gl_prog_del, GLuint program);
+LGL_INTERFACE(void, gl_prog_attachshdr, GLuint program, GLuint shader);
+LGL_INTERFACE(void, gl_prog_link, GLuint program);
+LGL_INTERFACE(void, gl_prog_use, GLuint program);
+LGL_INTERFACE(void, gl_prog_param, GLuint prog, GLenum pname, GLint *params);
+LGL_INTERFACE(void, gl_prog_infolog, GLuint prog, GLsizei size, GLsizei *len, char *data);
+LGL_INTERFACE(void, gl_va_define, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *data);
+LGL_INTERFACE(void, gl_va_enable, GLuint index);
+LGL_INTERFACE(void, gl_va_disable, GLuint index);
+LGL_INTERFACE(void, gl_va_gen, GLsizei n, GLuint *arrays);
+LGL_INTERFACE(void, gl_va_bind, GLuint va);
+LGL_INTERFACE(void, gl_draw_arrays, GLenum mode, GLint first, GLsizei count);
+LGL_INTERFACE(void, gl_draw_elems, GLenum mode, GLsizei count, GLenum type, const void *indices);
+LGL_INTERFACE(void, gl_poly_mode, GLenum face, GLenum mode);
+
+#endif // LOADGL_H