blob: cee215db6d437fc66af1f28cc99bba7c59c1a714 (
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
35
36
37
38
39
40
41
42
43
44
45
|
/*
* Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
* SPDX-License-Identifier: MIT
*/
#include "eprintf.h"
#include "gl.h"
#define GL_FUNC(glname, rtype, name, ...) name##_func *name;
#include "glfunc.h"
#undef GL_FUNC
static void *load_func(const char *name, gl_loadfunc *load)
{
void *ret;
ret = load(name);
if (ret == NULL)
eprintf("Could not load OpenGL function: %s\n", name);
return ret;
}
void gl_load(gl_loadfunc *load)
{
#define GL_FUNC(glname, rtype, name, ...) \
name = (name##_func *)load_func(#glname, load);
#include "glfunc.h"
#undef GL_FUNC
}
const char *gl_strerror(GLenum error)
{
switch (error) {
case GL_NO_ERROR: return "No error";
case GL_INVALID_ENUM: return "Invalid enumeration";
case GL_INVALID_VALUE: return "Invalid value";
case GL_INVALID_OPERATION: return "Invalid operation";
case GL_STACK_OVERFLOW: return "Stack overflow";
case GL_STACK_UNDERFLOW: return "Stack underflow";
case GL_OUT_OF_MEMORY: return "Out of memory";
case GL_INVALID_FRAMEBUFFER_OPERATION: return "Invalid framebuffer operation";
case GL_CONTEXT_LOST: return "Context lost";
}
return "Unknown";
}
|