gl-fun.h: Allow to alternatively be compiled with GLES2 headers
Requires your typical "GLES2/{gl2,gl2ext,gl2platform}.h bundle. Define "GLES2_HEADER" to use.
This commit is contained in:
parent
ca9f83c6de
commit
492be508da
|
@ -42,6 +42,7 @@ This binding only exists for testing purposes and does nothing (the engine quits
|
||||||
* SDL_sound (latest hg, apply provided patches!)
|
* SDL_sound (latest hg, apply provided patches!)
|
||||||
* pixman
|
* pixman
|
||||||
* zlib (only ruby bindings)
|
* zlib (only ruby bindings)
|
||||||
|
* OpenGL header (alternatively GLES2 with `DEFINES+=GLES2_HEADER`)
|
||||||
|
|
||||||
mkxp employs Qt's qmake build system, so you'll need to install that beforehand. Alternatively, you can build with cmake (FIXME: add cmake instructions).
|
mkxp employs Qt's qmake build system, so you'll need to install that beforehand. Alternatively, you can build with cmake (FIXME: add cmake instructions).
|
||||||
|
|
||||||
|
|
72
src/gl-fun.h
72
src/gl-fun.h
|
@ -22,7 +22,12 @@
|
||||||
#ifndef GLFUN_H
|
#ifndef GLFUN_H
|
||||||
#define GLFUN_H
|
#define GLFUN_H
|
||||||
|
|
||||||
|
#ifdef GLES2_HEADER
|
||||||
|
#include <SDL_opengles2.h>
|
||||||
|
#define APIENTRYP GL_APIENTRYP
|
||||||
|
#else
|
||||||
#include <SDL_opengl.h>
|
#include <SDL_opengl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Etc */
|
/* Etc */
|
||||||
typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
|
typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
|
||||||
|
@ -51,8 +56,64 @@ typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GL
|
||||||
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||||
|
|
||||||
/* Debug callback */
|
/* Debug callback */
|
||||||
typedef void (APIENTRY * GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void *userParam);
|
typedef void (APIENTRY * _GLDEBUGPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void *userParam);
|
||||||
typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
|
typedef void (APIENTRYP _PFNGLDEBUGMESSAGECALLBACKPROC) (_GLDEBUGPROC callback, const void *userParam);
|
||||||
|
|
||||||
|
#ifdef GLES2_HEADER
|
||||||
|
#define GL_NUM_EXTENSIONS 0x821D
|
||||||
|
|
||||||
|
/* Buffer object */
|
||||||
|
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);
|
||||||
|
typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||||
|
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
|
||||||
|
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
|
||||||
|
|
||||||
|
/* Shader */
|
||||||
|
typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
|
||||||
|
typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths);
|
||||||
|
typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||||
|
typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
|
||||||
|
typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param);
|
||||||
|
typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
|
||||||
|
|
||||||
|
/* Program */
|
||||||
|
typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
|
||||||
|
typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
|
||||||
|
typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||||
|
typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);
|
||||||
|
typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
|
||||||
|
|
||||||
|
/* Uniform */
|
||||||
|
typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
||||||
|
typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||||
|
|
||||||
|
/* Vertex attribute */
|
||||||
|
typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);
|
||||||
|
typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint);
|
||||||
|
typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);
|
||||||
|
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
|
||||||
|
|
||||||
|
/* Framebuffer object */
|
||||||
|
#define GL_READ_FRAMEBUFFER 0x8CA8
|
||||||
|
#define GL_DRAW_FRAMEBUFFER 0x8CA9
|
||||||
|
typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint* framebuffers);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);
|
||||||
|
typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
|
||||||
|
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||||
|
typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||||
|
|
||||||
|
/* Vertex array object */
|
||||||
|
typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays);
|
||||||
|
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays);
|
||||||
|
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GL_20_FUN \
|
#define GL_20_FUN \
|
||||||
/* Etc */ \
|
/* Etc */ \
|
||||||
|
@ -79,7 +140,7 @@ typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, co
|
||||||
GL_FUN(TexSubImage2D, PFNGLTEXSUBIMAGE2DPROC) \
|
GL_FUN(TexSubImage2D, PFNGLTEXSUBIMAGE2DPROC) \
|
||||||
GL_FUN(TexParameteri, PFNGLTEXPARAMETERIPROC) \
|
GL_FUN(TexParameteri, PFNGLTEXPARAMETERIPROC) \
|
||||||
GL_FUN(ActiveTexture, PFNGLACTIVETEXTUREPROC) \
|
GL_FUN(ActiveTexture, PFNGLACTIVETEXTUREPROC) \
|
||||||
/* Buffer objcet */ \
|
/* Buffer object */ \
|
||||||
GL_FUN(GenBuffers, PFNGLGENBUFFERSPROC) \
|
GL_FUN(GenBuffers, PFNGLGENBUFFERSPROC) \
|
||||||
GL_FUN(DeleteBuffers, PFNGLDELETEBUFFERSPROC) \
|
GL_FUN(DeleteBuffers, PFNGLDELETEBUFFERSPROC) \
|
||||||
GL_FUN(BindBuffer, PFNGLBINDBUFFERPROC) \
|
GL_FUN(BindBuffer, PFNGLBINDBUFFERPROC) \
|
||||||
|
@ -118,8 +179,7 @@ typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, co
|
||||||
GL_FUN(GenFramebuffers, PFNGLGENFRAMEBUFFERSPROC) \
|
GL_FUN(GenFramebuffers, PFNGLGENFRAMEBUFFERSPROC) \
|
||||||
GL_FUN(DeleteFramebuffers, PFNGLDELETEFRAMEBUFFERSPROC) \
|
GL_FUN(DeleteFramebuffers, PFNGLDELETEFRAMEBUFFERSPROC) \
|
||||||
GL_FUN(BindFramebuffer, PFNGLBINDFRAMEBUFFERPROC) \
|
GL_FUN(BindFramebuffer, PFNGLBINDFRAMEBUFFERPROC) \
|
||||||
GL_FUN(FramebufferTexture2D, PFNGLFRAMEBUFFERTEXTURE2DPROC) \
|
GL_FUN(FramebufferTexture2D, PFNGLFRAMEBUFFERTEXTURE2DPROC)
|
||||||
GL_FUN(FramebufferRenderbuffer, PFNGLFRAMEBUFFERRENDERBUFFERPROC)
|
|
||||||
|
|
||||||
#define GL_FBO_BLIT_FUN \
|
#define GL_FBO_BLIT_FUN \
|
||||||
GL_FUN(BlitFramebuffer, PFNGLBLITFRAMEBUFFERPROC)
|
GL_FUN(BlitFramebuffer, PFNGLBLITFRAMEBUFFERPROC)
|
||||||
|
@ -131,7 +191,7 @@ typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, co
|
||||||
GL_FUN(BindVertexArray, PFNGLBINDVERTEXARRAYPROC)
|
GL_FUN(BindVertexArray, PFNGLBINDVERTEXARRAYPROC)
|
||||||
|
|
||||||
#define GL_DEBUG_KHR_FUN \
|
#define GL_DEBUG_KHR_FUN \
|
||||||
GL_FUN(DebugMessageCallback, PFNGLDEBUGMESSAGECALLBACKPROC)
|
GL_FUN(DebugMessageCallback, _PFNGLDEBUGMESSAGECALLBACKPROC)
|
||||||
|
|
||||||
|
|
||||||
struct GLFunctions
|
struct GLFunctions
|
||||||
|
|
Loading…
Reference in New Issue