aboutsummaryrefslogtreecommitdiffstats
path: root/gl.h
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2018-03-30 15:35:05 +0100
committerTomasz Kramkowski <tk@the-tk.com>2018-03-30 15:35:05 +0100
commit83b3fe86b1c13f40a6be4580b4079980030a54a7 (patch)
treed3ea228b9ac42d7ed34ba8699167bf8ff29931e1 /gl.h
parent93c76bf190d843ef77c71682570f28e9fb871a08 (diff)
downloadfaqe-83b3fe86b1c13f40a6be4580b4079980030a54a7.tar.gz
faqe-83b3fe86b1c13f40a6be4580b4079980030a54a7.tar.xz
faqe-83b3fe86b1c13f40a6be4580b4079980030a54a7.zip
Simplify gl loading by removing m4 and merging gldefs.h
m4 has been removed, loadgl.c.in is now gl.c, gldefs.h and loadgl.h.in have now been merged into gl.h. loadgl.m4 has been transformed into glfunc.h which is being used in the way of a bie index file to generate information at 3 places. lgl_load is now gl_load and doesn't return anything, the jongjmp.h method of error handling was pre-emptive and for now this much simpler system will suffice. This means that lgl_strerror is no longer neede.
Diffstat (limited to 'gl.h')
-rw-r--r--gl.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/gl.h b/gl.h
new file mode 100644
index 0000000..30e7862
--- /dev/null
+++ b/gl.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
+#ifndef GL_H
+#define GL_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+typedef uint8_t GLboolean;
+typedef int8_t GLbyte;
+typedef uint8_t GLubyte;
+typedef char GLchar;
+typedef int16_t GLshort;
+typedef uint16_t GLushort;
+typedef int32_t GLint;
+typedef uint32_t GLuint;
+typedef int32_t GLfixed;
+typedef int64_t GLint64;
+typedef uint64_t GLuint64;
+typedef int32_t GLsizei;
+typedef int32_t GLenum;
+typedef ptrdiff_t GLintptr;
+typedef ptrdiff_t GLsizeiptr;
+typedef struct gl_sync *GLsync;
+typedef uint32_t GLbitfield;
+typedef uint16_t GLhalf;
+typedef float GLfloat;
+typedef float GLclampf;
+typedef double GLdouble;
+typedef double GLclampd;
+
+enum {
+ GL_NO_ERROR = 0,
+ GL_FALSE = 0,
+ GL_TRUE = 1,
+ GL_TRIANGLES = 0x0004,
+ GL_FRONT_AND_BACK = 0x0408,
+ GL_INVALID_ENUM = 0x0500,
+ GL_INVALID_VALUE = 0x0501,
+ GL_INVALID_OPERATION = 0x0502,
+ GL_STACK_OVERFLOW = 0x0503,
+ GL_STACK_UNDERFLOW = 0x0504,
+ GL_OUT_OF_MEMORY = 0x0505,
+ GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506,
+ GL_CONTEXT_LOST = 0x0507,
+ GL_UNSIGNED_INT = 0x1405,
+ GL_FLOAT = 0x1406,
+ GL_LINE = 0x1B01,
+ GL_COLOR_BUFFER_BIT = 0x4000,
+ GL_ARRAY_BUFFER = 0x8892,
+ GL_ELEMENT_ARRAY_BUFFER = 0x8893,
+ GL_STREAM_DRAW = 0x88e0,
+ GL_STATIC_DRAW = 0x88e4,
+ GL_DYNAMIC_DRAW = 0x88e8,
+ GL_FRAGMENT_SHADER = 0x8b30,
+ GL_VERTEX_SHADER = 0x8b31,
+ GL_COMPILE_STATUS = 0x8b81,
+ GL_LINK_STATUS = 0x8b82,
+};
+
+typedef void *gl_loadfunc(const char *name);
+void gl_load(gl_loadfunc *load);
+const char *gl_strerror(GLenum error);
+
+#define _GL_FUNC(rtype, name, type, ...) \
+ typedef rtype type(__VA_ARGS__); \
+ extern type *name;
+#define GL_FUNC(glname, rtype, name, ...) _GL_FUNC(rtype, name, name##_func, __VA_ARGS__)
+#include "glfunc.h"
+#undef GL_FUNC
+#undef _GL_FUNC
+
+#endif // GL_H