aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2018-05-04 19:57:22 +0100
committerTomasz Kramkowski <tk@the-tk.com>2018-05-04 20:05:52 +0100
commitd1d4c8678b313708b91ba0342db84d33c0bb0677 (patch)
tree9f4a0fcdf2be9fdefd2a976c35376f2a2b00fa09
parentbc01efbb0c2f01871cbfdf8bfd779c6262e34c17 (diff)
downloadfaqe-d1d4c8678b313708b91ba0342db84d33c0bb0677.tar.gz
faqe-d1d4c8678b313708b91ba0342db84d33c0bb0677.tar.xz
faqe-d1d4c8678b313708b91ba0342db84d33c0bb0677.zip
Replace manual definitions of GL types and enums with GL/gl.h
This is cumbersome and pointless. The goal is to write a simple loader not to rewrite the entire OpenGL header file.
-rw-r--r--Makefile3
-rw-r--r--gl.h78
2 files changed, 2 insertions, 79 deletions
diff --git a/Makefile b/Makefile
index 498123c..235ec3f 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,7 @@ LINMATH_PATH ?= ../linmath
PKG_CONFIG ?= pkg-config
LN ?= ln -sf
-LIBS := sdl2 libpng
-CPPFLAGS += -D__gl_h_
+LIBS := gl libpng sdl2
CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBS)) -std=c11 -MMD -MP
LDFLAGS += -Wl,--as-needed
LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBS)) -lm
diff --git a/gl.h b/gl.h
index 76e78d9..2b31aa9 100644
--- a/gl.h
+++ b/gl.h
@@ -5,83 +5,7 @@
#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_DEPTH_BUFFER_BIT = 0x100,
- GL_COLOR_BUFFER_BIT = 0x4000,
-};
-
-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,
- GL_INVALID_OPERATION,
- GL_STACK_OVERFLOW,
- GL_STACK_UNDERFLOW,
- GL_OUT_OF_MEMORY,
- GL_INVALID_FRAMEBUFFER_OPERATION,
- GL_CONTEXT_LOST,
- GL_CULL_FACE = 0x0b44,
- GL_DEPTH_TEST = 0x0b71,
- GL_TEXTURE_2D = 0x0de1,
- GL_UNSIGNED_BYTE = 0x1401,
- GL_UNSIGNED_INT = 0x1405,
- GL_FLOAT = 0x1406,
- GL_RGB = 0x1907,
- GL_LINE = 0x1B01,
- GL_NEAREST = 0x2600,
- GL_LINEAR,
- GL_NEAREST_MIPMAP_NEAREST = 0x2700,
- GL_LINEAR_MIPMAP_NEAREST,
- GL_NEAREST_MIPMAP_LINEAR,
- GL_LINEAR_MIPMAP_LINEAR,
- GL_TEXTURE_MAG_FILTER = 0x2800,
- GL_TEXTURE_MIN_FILTER,
- GL_TEXTURE_WRAP_S,
- GL_TEXTURE_WRAP_T,
- GL_CLAMP = 0x2900,
- GL_REPEAT,
- GL_TEXTURE0 = 0x84c0,
- 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,
- GL_FRAMEBUFFER_SRGB = 0x8db9,
-};
+#include <GL/gl.h>
typedef void *gl_loadfunc(const char *name);
void gl_load(gl_loadfunc *load);