Don't load non-core GL functions for OpenGL 3.2 core context
Also declare the GL functions in tr_local.h so there is compile error for non-core GL functions instead of SEGFAULT from dereferencing a NULL pointer. Disable the non-functional stencil shadow code that hasn't been updated to use OpenGL 3.2 core compatible drawing.
This commit is contained in:
parent
255c33b367
commit
7391215bd4
5 changed files with 74 additions and 27 deletions
|
@ -45,27 +45,22 @@ 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/1.1 and OpenGL ES 1.0
|
||||
// OpenGL 1.0/1.1, OpenGL ES 1.0, and OpenGL 3.2 core profile
|
||||
#define QGL_1_1_PROCS \
|
||||
GLE(void, AlphaFunc, GLenum func, GLclampf ref) \
|
||||
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, Clear, GLbitfield mask) \
|
||||
GLE(void, ClearStencil, GLint s) \
|
||||
GLE(void, Color4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) \
|
||||
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, DisableClientState, GLenum cap) \
|
||||
GLE(void, Disable, GLenum cap) \
|
||||
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, Finish, void) \
|
||||
GLE(void, Flush, void) \
|
||||
|
@ -75,42 +70,53 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
|||
GLE(void, GetIntegerv, GLenum pname, GLint *params) \
|
||||
GLE(const GLubyte *, GetString, GLenum name) \
|
||||
GLE(void, LineWidth, GLfloat width) \
|
||||
GLE(void, LoadIdentity, void) \
|
||||
GLE(void, LoadMatrixf, const GLfloat *m) \
|
||||
GLE(void, MatrixMode, GLenum mode) \
|
||||
GLE(void, PolygonOffset, GLfloat factor, GLfloat units) \
|
||||
GLE(void, PopMatrix, void) \
|
||||
GLE(void, PushMatrix, void) \
|
||||
GLE(void, ReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) \
|
||||
GLE(void, Scissor, GLint x, GLint y, GLsizei width, GLsizei height) \
|
||||
GLE(void, ShadeModel, GLenum mode) \
|
||||
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, 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
|
||||
// OpenGL 1.0/1.1 and OpenGL ES 1.x but not OpenGL 3.2 core profile
|
||||
#define QGL_1_1_FIXED_FUNCTION_PROCS \
|
||||
GLE(void, AlphaFunc, GLenum func, GLclampf ref) \
|
||||
GLE(void, Color4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) \
|
||||
GLE(void, ColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, DisableClientState, GLenum cap) \
|
||||
GLE(void, EnableClientState, GLenum cap) \
|
||||
GLE(void, LoadIdentity, void) \
|
||||
GLE(void, LoadMatrixf, const GLfloat *m) \
|
||||
GLE(void, MatrixMode, GLenum mode) \
|
||||
GLE(void, PopMatrix, void) \
|
||||
GLE(void, PushMatrix, void) \
|
||||
GLE(void, ShadeModel, GLenum mode) \
|
||||
GLE(void, TexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
GLE(void, TexEnvf, GLenum target, GLenum pname, GLfloat param) \
|
||||
GLE(void, VertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
|
||||
|
||||
// OpenGL 1.0/1.1 and 3.2 core profile but not OpenGL ES 1.x
|
||||
#define QGL_DESKTOP_1_1_PROCS \
|
||||
GLE(void, ClearDepth, GLclampd depth) \
|
||||
GLE(void, DepthRange, GLclampd near_val, GLclampd far_val) \
|
||||
GLE(void, DrawBuffer, GLenum mode) \
|
||||
GLE(void, PolygonMode, GLenum face, GLenum mode) \
|
||||
|
||||
// OpenGL 1.0/1.1 but not OpenGL 3.2 core profile or OpenGL ES 1.x
|
||||
#define QGL_DESKTOP_1_1_FIXED_FUNCTION_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) \
|
||||
|
@ -301,9 +307,11 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
|
|||
GLE(GLvoid, NamedFramebufferTexture2DEXT, GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level) \
|
||||
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;
|
||||
#define GLE(ret, name, ...) typedef ret APIENTRY name##proc(__VA_ARGS__);
|
||||
QGL_1_1_PROCS;
|
||||
QGL_1_1_FIXED_FUNCTION_PROCS;
|
||||
QGL_DESKTOP_1_1_PROCS;
|
||||
QGL_DESKTOP_1_1_FIXED_FUNCTION_PROCS;
|
||||
QGL_ES_1_1_PROCS;
|
||||
QGL_1_3_PROCS;
|
||||
QGL_1_5_PROCS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue