mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
Load OpenGL ES 1.1 function procs
This commit is contained in:
parent
e657dbd6b2
commit
a83ae01d93
2 changed files with 53 additions and 38 deletions
|
@ -45,31 +45,31 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
|||
// GL function loader, based on https://gist.github.com/rygorous/16796a0c876cf8a5f542caddb55bce8a
|
||||
// get missing functions from code/SDL2/include/SDL_opengl.h
|
||||
|
||||
// OpenGL 1.0
|
||||
#define QGL_1_0_PROCS \
|
||||
// OpenGL 1.0/1.1 and OpenGL ES 1.0
|
||||
#define QGL_1_1_PROCS \
|
||||
GLE(void, AlphaFunc, GLenum func, GLclampf ref) \
|
||||
GLE(void, Begin, GLenum mode) \
|
||||
GLE(void, BindTexture, GLenum target, GLuint texture) \
|
||||
GLE(void, BlendFunc, GLenum sfactor, GLenum dfactor) \
|
||||
GLE(void, ClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) \
|
||||
GLE(void, ClearDepth, GLclampd depth) \
|
||||
GLE(void, Clear, GLbitfield mask) \
|
||||
GLE(void, ClearStencil, GLint s) \
|
||||
GLE(void, ClipPlane, GLenum plane, const GLdouble *equation) \
|
||||
GLE(void, Color3f, GLfloat red, GLfloat green, GLfloat blue) \
|
||||
GLE(void, Color4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) \
|
||||
GLE(void, Color4ubv, const GLubyte *v) \
|
||||
GLE(void, ColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) \
|
||||
GLE(void, ColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, CopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) \
|
||||
GLE(void, CullFace, GLenum mode) \
|
||||
GLE(void, DeleteTextures, GLsizei n, const GLuint *textures) \
|
||||
GLE(void, DepthFunc, GLenum func) \
|
||||
GLE(void, DepthMask, GLboolean flag) \
|
||||
GLE(void, DepthRange, GLclampd near_val, GLclampd far_val) \
|
||||
GLE(void, DisableClientState, GLenum cap) \
|
||||
GLE(void, Disable, GLenum cap) \
|
||||
GLE(void, DrawBuffer, GLenum mode) \
|
||||
GLE(void, DrawArrays, GLenum mode, GLint first, GLsizei count) \
|
||||
GLE(void, DrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) \
|
||||
GLE(void, EnableClientState, GLenum cap) \
|
||||
GLE(void, Enable, GLenum cap) \
|
||||
GLE(void, End, void) \
|
||||
GLE(void, Finish, void) \
|
||||
GLE(void, Flush, void) \
|
||||
GLE(void, Frustum, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) \
|
||||
GLE(void, GenTextures, GLsizei n, GLuint *textures ) \
|
||||
GLE(void, GetBooleanv, GLenum pname, GLboolean *params) \
|
||||
GLE(GLenum, GetError, void) \
|
||||
GLE(void, GetIntegerv, GLenum pname, GLint *params) \
|
||||
|
@ -78,8 +78,6 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
|||
GLE(void, LoadIdentity, void) \
|
||||
GLE(void, LoadMatrixf, const GLfloat *m) \
|
||||
GLE(void, MatrixMode, GLenum mode) \
|
||||
GLE(void, Ortho, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) \
|
||||
GLE(void, PolygonMode, GLenum face, GLenum mode) \
|
||||
GLE(void, PolygonOffset, GLfloat factor, GLfloat units) \
|
||||
GLE(void, PopMatrix, void) \
|
||||
GLE(void, PushMatrix, void) \
|
||||
|
@ -89,33 +87,43 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
|||
GLE(void, StencilFunc, GLenum func, GLint ref, GLuint mask) \
|
||||
GLE(void, StencilMask, GLuint mask) \
|
||||
GLE(void, StencilOp, GLenum fail, GLenum zfail, GLenum zpass) \
|
||||
GLE(void, TexCoord2f, GLfloat s, GLfloat t) \
|
||||
GLE(void, TexCoord2fv, const GLfloat *v) \
|
||||
GLE(void, TexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, TexEnvf, GLenum target, GLenum pname, GLfloat param) \
|
||||
GLE(void, TexImage2D, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) \
|
||||
GLE(void, TexParameterf, GLenum target, GLenum pname, GLfloat param) \
|
||||
GLE(void, TexParameteri, GLenum target, GLenum pname, GLint param) \
|
||||
GLE(void, TexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
|
||||
GLE(void, Translatef, GLfloat x, GLfloat y, GLfloat z) \
|
||||
GLE(void, VertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, Viewport, GLint x, GLint y, GLsizei width, GLsizei height) \
|
||||
|
||||
// OpenGL 1.0/1.1 but not OpenGL ES 1.x
|
||||
#define QGL_DESKTOP_1_1_PROCS \
|
||||
GLE(void, ArrayElement, GLint i) \
|
||||
GLE(void, Begin, GLenum mode) \
|
||||
GLE(void, ClearDepth, GLclampd depth) \
|
||||
GLE(void, ClipPlane, GLenum plane, const GLdouble *equation) \
|
||||
GLE(void, Color3f, GLfloat red, GLfloat green, GLfloat blue) \
|
||||
GLE(void, Color4ubv, const GLubyte *v) \
|
||||
GLE(void, DepthRange, GLclampd near_val, GLclampd far_val) \
|
||||
GLE(void, DrawBuffer, GLenum mode) \
|
||||
GLE(void, End, void) \
|
||||
GLE(void, Frustum, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) \
|
||||
GLE(void, Ortho, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) \
|
||||
GLE(void, PolygonMode, GLenum face, GLenum mode) \
|
||||
GLE(void, TexCoord2f, GLfloat s, GLfloat t) \
|
||||
GLE(void, TexCoord2fv, const GLfloat *v) \
|
||||
GLE(void, Vertex2f, GLfloat x, GLfloat y) \
|
||||
GLE(void, Vertex3f, GLfloat x, GLfloat y, GLfloat z) \
|
||||
GLE(void, Vertex3fv, const GLfloat *v) \
|
||||
GLE(void, Viewport, GLint x, GLint y, GLsizei width, GLsizei height) \
|
||||
|
||||
// OpenGL 1.1
|
||||
#define QGL_1_1_PROCS \
|
||||
GLE(void, GenTextures, GLsizei n, GLuint *textures ) \
|
||||
GLE(void, DeleteTextures, GLsizei n, const GLuint *textures) \
|
||||
GLE(void, BindTexture, GLenum target, GLuint texture) \
|
||||
GLE(void, EnableClientState, GLenum cap) \
|
||||
GLE(void, DisableClientState, GLenum cap) \
|
||||
GLE(void, ArrayElement, GLint i) \
|
||||
GLE(void, DrawArrays, GLenum mode, GLint first, GLsizei count) \
|
||||
GLE(void, DrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) \
|
||||
GLE(void, TexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
|
||||
GLE(void, CopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) \
|
||||
GLE(void, VertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, ColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, TexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
// OpenGL ES 1.1 but not desktop OpenGL 1.x
|
||||
#define QGL_ES_1_1_PROCS \
|
||||
GLE(void, ClearDepthf, GLclampf depth) \
|
||||
GLE(void, ClipPlanef, GLenum plane, const GLfloat *equation) \
|
||||
GLE(void, DepthRangef, GLclampf near_val, GLclampf far_val) \
|
||||
GLE(void, Frustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near_val, GLfloat far_val) \
|
||||
GLE(void, Orthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near_val, GLfloat far_val) \
|
||||
|
||||
// OpenGL 1.3, was GL_ARB_texture_compression
|
||||
#define QGL_1_3_PROCS \
|
||||
|
@ -294,8 +302,9 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
|||
GLE(GLvoid, NamedFramebufferRenderbufferEXT, GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) \
|
||||
|
||||
#define GLE(ret, name, ...) typedef ret APIENTRY name##proc(__VA_ARGS__); extern name##proc * qgl##name;
|
||||
QGL_1_0_PROCS;
|
||||
QGL_1_1_PROCS;
|
||||
QGL_DESKTOP_1_1_PROCS;
|
||||
QGL_ES_1_1_PROCS;
|
||||
QGL_1_3_PROCS;
|
||||
QGL_1_5_PROCS;
|
||||
QGL_2_0_PROCS;
|
||||
|
|
|
@ -64,8 +64,9 @@ void (APIENTRYP qglLockArraysEXT) (GLint first, GLsizei count);
|
|||
void (APIENTRYP qglUnlockArraysEXT) (void);
|
||||
|
||||
#define GLE(ret, name, ...) name##proc * qgl##name;
|
||||
QGL_1_0_PROCS;
|
||||
QGL_1_1_PROCS;
|
||||
QGL_DESKTOP_1_1_PROCS;
|
||||
QGL_ES_1_1_PROCS;
|
||||
QGL_3_0_PROCS;
|
||||
#undef GLE
|
||||
|
||||
|
@ -265,11 +266,15 @@ static qboolean GLimp_GetProcAddresses( void ) {
|
|||
sscanf( version, "%d.%d", &qglMajorVersion, &qglMinorVersion );
|
||||
}
|
||||
|
||||
// require OpenGL 1.1 or OpenGL ES 1.0
|
||||
// FIXME: Not all of these functions are available in OpenGL ES
|
||||
if ( QGL_VERSION_ATLEAST( 1, 1 ) /*|| QGLES_VERSION_ATLEAST( 1, 0 )*/ ) {
|
||||
QGL_1_0_PROCS;
|
||||
if ( QGL_VERSION_ATLEAST( 1, 1 ) ) {
|
||||
QGL_1_1_PROCS;
|
||||
QGL_DESKTOP_1_1_PROCS;
|
||||
} else if ( qglesMajorVersion == 1 && qglesMinorVersion >= 1 ) {
|
||||
// OpenGL ES 1.1 (2.0 is not backward compatible)
|
||||
QGL_1_1_PROCS;
|
||||
QGL_ES_1_1_PROCS;
|
||||
// error so this doesn't segfault due to NULL desktop GL functions being used
|
||||
Com_Error( ERR_FATAL, "Unsupported OpenGL Version: %s\n", version );
|
||||
} else {
|
||||
Com_Error( ERR_FATAL, "Unsupported OpenGL Version: %s\n", version );
|
||||
}
|
||||
|
@ -298,8 +303,9 @@ static void GLimp_ClearProcAddresses( void ) {
|
|||
qglesMajorVersion = 0;
|
||||
qglesMinorVersion = 0;
|
||||
|
||||
QGL_1_0_PROCS;
|
||||
QGL_1_1_PROCS;
|
||||
QGL_DESKTOP_1_1_PROCS;
|
||||
QGL_ES_1_1_PROCS;
|
||||
QGL_3_0_PROCS;
|
||||
|
||||
#undef GLE
|
||||
|
|
Loading…
Reference in a new issue