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
|
#include "gl.h"
#include <SDL.h>
#ifdef WIN32
void (*glGenBuffers)(GLsizei, GLuint*);
void (*glDeleteBuffers)(GLsizei, GLuint*);
void (*glBindBuffer)(GLenum, GLuint);
void (*glBufferData)(GLenum, GLsizeiptr, const GLvoid*, GLenum);
GLvoid* (*glMapBuffer)(GLenum, GLenum);
GLboolean (*glUnmapBuffer)(GLenum);
/* uniform */
GLint (*glGetUniformLocation)(GLuint, const GLchar*);
void (*glUniform1i)(GLint, GLint);
void (*glUniform3f)(GLint, GLfloat, GLfloat, GLfloat);
/* texture */
void (*glActiveTexture)(GLenum);
/* program/shader */
GLuint (*glCreateProgram)(void);
void (*glLinkProgram)(GLuint);
void (*glGetProgramiv)(GLuint, GLenum, GLint*);
void (*glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*);
void (*glUseProgram)(GLuint);
void (*glDeleteProgram)(GLuint);
GLuint (*glCreateShader)(GLenum);
void (*glShaderSource)(GLuint, GLsizei, const GLchar**, const GLint*);
void (*glCompileShader)(GLuint);
void (*glGetShaderiv)(GLuint, GLenum, GLint*);
void (*glGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*);
void (*glAttachShader)(GLuint, GLuint);
void (*glDetachShader)(GLuint, GLuint);
void (*glDeleteShader)(GLuint);
//GL_DeleteBuffers glDeleteBuffers = NULL;
void win32_gl_init() {
glGenBuffers = (void(*)(GLsizei, GLuint*))SDL_GL_GetProcAddress("glGenBuffers");
glDeleteBuffers = (void(*)(GLsizei, GLuint*))SDL_GL_GetProcAddress("glDeleteBuffers");
glBindBuffer = (void(*)(GLenum, GLuint))SDL_GL_GetProcAddress("glBindBuffer");
glBufferData = (void(*)(GLenum, GLsizeiptr, const GLvoid*, GLenum))SDL_GL_GetProcAddress("glBufferData");
glMapBuffer = (GLvoid*(*)(GLenum, GLenum))SDL_GL_GetProcAddress("glMapBuffer");
glUnmapBuffer = (GLboolean(*)(GLenum))SDL_GL_GetProcAddress("glUnmapBuffer");
glGetUniformLocation = (GLint(*)(GLuint, const GLchar*))SDL_GL_GetProcAddress("glGetUniformLocation");
glUniform1i = (void(*)(GLint, GLint))SDL_GL_GetProcAddress("glUniform1i");
glUniform3f = (void(*)(GLint, GLfloat, GLfloat, GLfloat))SDL_GL_GetProcAddress("glUniform3f");
glActiveTexture = (void(*)(GLenum))SDL_GL_GetProcAddress("glActiveTexture");
glCreateProgram = (GLuint(*)(void))SDL_GL_GetProcAddress("glCreateProgram");
glLinkProgram = (void(*)(GLuint))SDL_GL_GetProcAddress("glLinkProgram");
glGetProgramiv = (void(*)(GLuint, GLenum, GLint*))SDL_GL_GetProcAddress("glGetProgramiv");
glGetProgramInfoLog = (void(*)(GLuint, GLsizei, GLsizei*, GLchar*))SDL_GL_GetProcAddress("glGetProgramInfoLog");
glUseProgram = (void(*)(GLuint))SDL_GL_GetProcAddress("glUseProgram");
glDeleteProgram = (void(*)(GLuint))SDL_GL_GetProcAddress("glDeleteProgram");
glCreateShader = (GLuint(*)(GLenum))SDL_GL_GetProcAddress("glCreateShader");
glShaderSource = (void(*)(GLuint, GLsizei, const GLchar**, const GLint*))SDL_GL_GetProcAddress("glShaderSource");
glCompileShader = (void(*)(GLuint))SDL_GL_GetProcAddress("glCompileShader");
glGetShaderiv = (void(*)(GLuint, GLenum, GLint*))SDL_GL_GetProcAddress("glGetShaderiv");
glGetShaderInfoLog = (void(*)(GLuint, GLsizei, GLsizei*, GLchar*))SDL_GL_GetProcAddress("glGetShaderInfoLog");
glAttachShader = (void(*)(GLuint, GLuint))SDL_GL_GetProcAddress("glAttachShader");
glDetachShader = (void(*)(GLuint, GLuint))SDL_GL_GetProcAddress("glDetachShader");
glDeleteShader = (void(*)(GLuint))SDL_GL_GetProcAddress("glDeleteShader");
}
#endif
|