diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2012-01-29 11:46:11 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2012-01-29 11:46:11 +0100 |
commit | 578ad89703ef74539e74edc86f865064763882fb (patch) | |
tree | 283e146fc9ca78a765acae1099a1f9fd9ef84afd | |
parent | 793977c09139df30b3dcab7260ebd1f943084092 (diff) |
Import shader functions for win32.
-rw-r--r-- | gl.cpp | 42 | ||||
-rw-r--r-- | gl.h | 33 |
2 files changed, 75 insertions, 0 deletions
@@ -0,0 +1,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 @@ -3,4 +3,37 @@ #include <SFML/Window/OpenGL.hpp> +#ifdef WIN32 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_CLAMP_TO_EDGE 0x812F + +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 + +#define GLchar char + +/* program/shader */ +extern GLuint (APIENTRY *glCreateProgram)(void); +extern void (APIENTRY *glLinkProgram)(GLuint); +extern void (APIENTRY *glGetProgramiv)(GLuint, GLenum, GLint*); +extern void (APIENTRY *glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*); +extern void (APIENTRY *glUseProgram)(GLuint); +extern void (APIENTRY *glDeleteProgram)(GLuint); + +extern GLuint (APIENTRY *glCreateShader)(GLenum); +extern void (APIENTRY *glShaderSource)(GLuint, GLsizei, const GLchar**, const GLint*); +extern void (APIENTRY *glCompileShader)(GLuint); +extern void (APIENTRY *glGetShaderiv)(GLuint, GLenum, GLint*); +extern void (APIENTRY *glGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*); + +extern void (APIENTRY *glAttachShader)(GLuint, GLuint); +extern void (APIENTRY *glDetachShader)(GLuint, GLuint); +extern void (APIENTRY *glDeleteShader)(GLuint); + +void win32_gl_init(); +#endif + #endif |