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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#ifndef MGL_GL_H
#define MGL_GL_H
#include "gl_macro.h"
#include <stdint.h>
#include <sys/types.h>
typedef struct _XVisualInfo _XVisualInfo;
typedef struct _XDisplay Display;
typedef struct __GLXcontextRec *GLXContext;
typedef unsigned long GLXDrawable;
typedef struct __GLXFBConfigRec *GLXFBConfig;
typedef struct {
void *handle;
GLXContext (*glXCreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, int direct);
int (*glXMakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
void (*glXDestroyContext)(Display *dpy, GLXContext ctx);
void (*glXSwapBuffers)(Display *dpy, GLXDrawable drawable);
GLXFBConfig* (*glXChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
_XVisualInfo* (*glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
void (*glViewport)(int x, int y, int width, int height);
void (*glScissor)(int x, int y, int width, int height);
void (*glClearColor)(float red, float green, float blue, float alpha);
void (*glClear)(unsigned int mask);
void (*glEnable)(unsigned int cap);
void (*glBlendFunc)(unsigned int sfactor, unsigned int dfactor);
void (*glGenTextures)(int n, unsigned int *textures);
void (*glDeleteTextures)(int n, const unsigned int *textures);
void (*glTexImage2D)(unsigned int target, int level, int internalFormat, int width, int height, int border, unsigned int format, unsigned int type, const void *pixels);
void (*glTexSubImage2D)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned int format, unsigned int type, const void *pixels);
void (*glBindTexture)(unsigned int target, unsigned int texture);
void (*glTexParameteri)(unsigned int target, unsigned int pname, int param);
void (*glHint)(unsigned int target, unsigned int mode);
void (*glBegin)(unsigned int mode);
void (*glEnd)(void);
void (*glVertex3f)(float x, float y, float z);
void (*glColor4ub)(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
void (*glTexCoord2f)(float s, float t);
void (*glOrtho)(double left, double right, double bottom, double top, double near_val, double far_val);
void (*glMatrixMode)(unsigned int mode);
void (*glPushMatrix)(void);
void (*glPopMatrix)(void);
void (*glLoadIdentity)(void);
void (*glLoadMatrixf)(const float *m);
void (*glTranslatef)(float x, float y, float z);
void (*glRotatef)(float angle, float x, float y, float z);
void (*glGenBuffers)(int n, unsigned int *buffers);
void (*glBindBuffer)(unsigned int target, unsigned int buffer);
void (*glDeleteBuffers)(int n, const unsigned int *buffers);
void (*glBufferData)(unsigned int target, ssize_t size, const void *data, unsigned int usage);
void (*glBufferSubData)(unsigned int target, ssize_t offset, ssize_t size, const void *data);
void (*glDrawArrays)(unsigned int mode, int first, int count);
void (*glEnableClientState)(unsigned int cap);
void (*glVertexPointer)(int size, unsigned int type, int stride, const void *ptr);
void (*glColorPointer)(int size, unsigned int type, int stride, const void *ptr);
void (*glTexCoordPointer)(int size, unsigned int type, int stride, const void *ptr);
void (*glCompileShader)(unsigned int shader);
unsigned int (*glCreateProgram)(void);
unsigned int (*glCreateShader)(unsigned int type);
void (*glDeleteProgram)(unsigned int program);
void (*glDeleteShader)(unsigned int shader);
void (*glGetShaderiv)(unsigned int shader, unsigned int pname, int *params);
void (*glGetShaderInfoLog)(unsigned int shader, int bufSize, int *length, char *infoLog);
void (*glGetProgramiv)(unsigned int program, unsigned int pname, int *params);
void (*glGetProgramInfoLog)(unsigned int program, int bufSize, int *length, char *infoLog);
void (*glLinkProgram)(unsigned int program);
void (*glShaderSource)(unsigned int shader, int count, const char *const*string, const int *length);
void (*glUseProgram)(unsigned int program);
void (*glAttachShader)(unsigned int program, unsigned int shader);
int (*glGetUniformLocation)(unsigned int program, const char *name);
void (*glUniform1f)(int location, float v0);
void (*glUniform2f)(int location, float v0, float v1);
unsigned int (*glGetError)(void);
const unsigned char* (*glGetString)(unsigned int name);
void (*glGetIntegerv)(unsigned int pname, int *params);
void (*glPixelStorei)(unsigned int pname, int param);
void (*glFlush)(void);
void (*glFinish)(void);
/* Optional*/
void (*glXSwapIntervalEXT)(Display * dpy, GLXDrawable drawable, int interval);
int (*glXSwapIntervalMESA)(unsigned int interval);
int (*glXSwapIntervalSGI)(int interval);
} mgl_gl;
int mgl_gl_load(mgl_gl *self);
void mgl_gl_unload(mgl_gl *self);
#endif /* MGL_GL_H */
|