summaryrefslogtreecommitdiff
path: root/gl.cpp
blob: c0bdcbbd8d9fbdd3f0485057acb0aea87006a148 (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
#include "gl.h"

#ifdef WIN32

/* program/shader */
GLuint (APIENTRY *glCreateProgram)(void);
void (APIENTRY *glLinkProgram)(GLuint);
void (APIENTRY *glGetProgramiv)(GLuint, GLenum, GLint*);
void (APIENTRY *glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*);
void (APIENTRY *glUseProgram)(GLuint);
void (APIENTRY *glDeleteProgram)(GLuint);

GLuint (APIENTRY *glCreateShader)(GLenum);
void (APIENTRY *glShaderSource)(GLuint, GLsizei, const GLchar**, const GLint*);
void (APIENTRY *glCompileShader)(GLuint);
void (APIENTRY *glGetShaderiv)(GLuint, GLenum, GLint*);
void (APIENTRY *glGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*);

void (APIENTRY *glAttachShader)(GLuint, GLuint);
void (APIENTRY *glDetachShader)(GLuint, GLuint);
void (APIENTRY *glDeleteShader)(GLuint);

void win32_gl_init() {
	glCreateProgram = (GLuint(APIENTRY*)(void))wglGetProcAddress("glCreateProgram");
	glLinkProgram = (void(APIENTRY*)(GLuint))wglGetProcAddress("glLinkProgram");
	glGetProgramiv = (void(APIENTRY*)(GLuint, GLenum, GLint*))wglGetProcAddress("glGetProgramiv");
	glGetProgramInfoLog = (void(APIENTRY*)(GLuint, GLsizei, GLsizei*, GLchar*))wglGetProcAddress("glGetProgramInfoLog");
	glUseProgram = (void(APIENTRY*)(GLuint))wglGetProcAddress("glUseProgram");
	glDeleteProgram = (void(APIENTRY*)(GLuint))wglGetProcAddress("glDeleteProgram");

	glCreateShader = (GLuint(APIENTRY*)(GLenum))wglGetProcAddress("glCreateShader");
	glShaderSource = (void(APIENTRY*)(GLuint, GLsizei, const GLchar**, const GLint*))wglGetProcAddress("glShaderSource");
	glCompileShader = (void(APIENTRY*)(GLuint))wglGetProcAddress("glCompileShader");
	glGetShaderiv = (void(APIENTRY*)(GLuint, GLenum, GLint*))wglGetProcAddress("glGetShaderiv");
	glGetShaderInfoLog = (void(APIENTRY*)(GLuint, GLsizei, GLsizei*, GLchar*))wglGetProcAddress("glGetShaderInfoLog");

	glAttachShader = (void(APIENTRY*)(GLuint, GLuint))wglGetProcAddress("glAttachShader");
	glDetachShader = (void(APIENTRY*)(GLuint, GLuint))wglGetProcAddress("glDetachShader");
	glDeleteShader = (void(APIENTRY*)(GLuint))wglGetProcAddress("glDeleteShader");
}

#endif