Merge glbuild_android into glbuild. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5189 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-05-16 09:12:12 +00:00
parent 04cb60c790
commit a979fa95a3
7 changed files with 365 additions and 1309 deletions

View file

@ -37,7 +37,6 @@ LOCAL_C_INCLUDES += $(TOP_DIR)/ $(TOP_DIR)/Libraries/liboggvorbis/include $(T
ANDROID_SRC = \
source/android/android-jni.cpp \
source/android/in_android.c \
build/src/glbuild_android.c \
build/src/jwzgles.c \
source/android/rg_etc1.cpp
@ -49,6 +48,7 @@ BUILD_SRC = \
build/src/crc32.c \
build/src/defs.c \
build/src/engine.c \
build/src/glbuild.c \
build/src/polymost.c \
build/src/mdsprite.c \
build/src/texcache.c \

View file

@ -4,8 +4,13 @@
#ifdef USE_OPENGL
#if !defined GEKKO
#if !defined GEKKO && !defined EDUKE32_GLES
# define DYNAMIC_GL
# define DYNAMIC_GLU
#endif
#if !defined GEKKO
# define DYNAMIC_GLEXT
#endif
#ifdef _WIN32
@ -24,6 +29,10 @@
# include <GL/glu.h>
#endif
#if !defined DYNAMIC_GLEXT
# define GL_GLEXT_PROTOTYPES
#endif
// get this header from http://oss.sgi.com/projects/ogl-sample/registry/
// if you are missing it
//#include <GL/glext.h>
@ -37,6 +46,10 @@
#error You should get an updated copy of glext.h from http://oss.sgi.com/projects/ogl-sample/registry/
#endif
#if defined EDUKE32_GLES
# include "jwzgles.h"
#endif
#ifndef APIENTRY
# define APIENTRY
#endif
@ -55,8 +68,33 @@
#define GL_TEXTURE_RECTANGLE 0x84F5
//////// dynamic/static API wrapping ////////
#if defined DYNAMIC_GL
#ifdef _WIN32
typedef HGLRC (WINAPI * bwglCreateContextProcPtr)(HDC);
extern bwglCreateContextProcPtr bwglCreateContext;
typedef BOOL (WINAPI * bwglDeleteContextProcPtr)(HGLRC);
extern bwglDeleteContextProcPtr bwglDeleteContext;
typedef PROC (WINAPI * bwglGetProcAddressProcPtr)(LPCSTR);
extern bwglGetProcAddressProcPtr bwglGetProcAddress;
typedef BOOL (WINAPI * bwglMakeCurrentProcPtr)(HDC,HGLRC);
extern bwglMakeCurrentProcPtr bwglMakeCurrent;
typedef BOOL (WINAPI * bwglSwapBuffersProcPtr)(HDC);
extern bwglSwapBuffersProcPtr bwglSwapBuffers;
typedef int32_t (WINAPI * bwglChoosePixelFormatProcPtr)(HDC,CONST PIXELFORMATDESCRIPTOR*);
extern bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
typedef int32_t (WINAPI * bwglDescribePixelFormatProcPtr)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
extern bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
typedef int32_t (WINAPI * bwglGetPixelFormatProcPtr)(HDC);
extern bwglGetPixelFormatProcPtr bwglGetPixelFormat;
typedef BOOL (WINAPI * bwglSetPixelFormatProcPtr)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*);
extern bwglSetPixelFormatProcPtr bwglSetPixelFormat;
#endif
typedef void (APIENTRY * bglClearColorProcPtr)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
extern bglClearColorProcPtr bglClearColor;
typedef void (APIENTRY * bglClearProcPtr)( GLbitfield mask );
@ -67,8 +105,6 @@ typedef void (APIENTRY * bglAlphaFuncProcPtr)( GLenum func, GLclampf ref );
extern bglAlphaFuncProcPtr bglAlphaFunc;
typedef void (APIENTRY * bglBlendFuncProcPtr)( GLenum sfactor, GLenum dfactor );
extern bglBlendFuncProcPtr bglBlendFunc;
typedef void (APIENTRY * bglBlendEquationProcPtr)( GLenum mode );
extern bglBlendEquationProcPtr bglBlendEquation;
typedef void (APIENTRY * bglCullFaceProcPtr)( GLenum mode );
extern bglCullFaceProcPtr bglCullFace;
typedef void (APIENTRY * bglFrontFaceProcPtr)( GLenum mode );
@ -205,8 +241,6 @@ typedef void (APIENTRY * bglBindTextureProcPtr)( GLenum target, GLuint texture )
extern bglBindTextureProcPtr bglBindTexture;
typedef void (APIENTRY * bglTexImage2DProcPtr)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
extern bglTexImage2DProcPtr bglTexImage2D;
typedef void (APIENTRY * bglTexImage3DProcPtr)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
extern bglTexImage3DProcPtr bglTexImage3D;
typedef void (APIENTRY * bglCopyTexImage2DProcPtr)( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
extern bglCopyTexImage2DProcPtr bglCopyTexImage2D;
typedef void (APIENTRY * bglCopyTexSubImage2DProcPtr)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
@ -221,10 +255,6 @@ typedef void (APIENTRY * bglGetTexParameterivProcPtr)( GLenum target, GLenum pna
extern bglGetTexParameterivProcPtr bglGetTexParameteriv;
typedef void (APIENTRY * bglGetTexLevelParameterivProcPtr)( GLenum target, GLint level, GLenum pname, GLint *params );
extern bglGetTexLevelParameterivProcPtr bglGetTexLevelParameteriv;
typedef void (APIENTRY * bglCompressedTexImage2DARBProcPtr)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
extern bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
typedef void (APIENTRY * bglGetCompressedTexImageARBProcPtr)(GLenum, GLint, GLvoid *);
extern bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
typedef void (APIENTRY * bglTexGenfvProcPtr)(GLenum coord, GLenum pname, const GLfloat *params);
extern bglTexGenfvProcPtr bglTexGenfv;
@ -270,6 +300,133 @@ extern bglStencilOpProcPtr bglStencilOp;
typedef void (APIENTRY * bglStencilFuncProcPtr)(GLenum func, GLint ref, GLuint mask);
extern bglStencilFuncProcPtr bglStencilFunc;
#else
#define bglClearColor glClearColor
#define bglClear glClear
#define bglColorMask glColorMask
#define bglAlphaFunc glAlphaFunc
#define bglBlendFunc glBlendFunc
#define bglCullFace glCullFace
#define bglFrontFace glFrontFace
#define bglPolygonOffset glPolygonOffset
#define bglPolygonMode glPolygonMode
#define bglEnable glEnable
#define bglDisable glDisable
#define bglGetDoublev glGetDoublev
#define bglGetFloatv glGetFloatv
#define bglGetIntegerv glGetIntegerv
#define bglPushAttrib glPushAttrib
#define bglPopAttrib glPopAttrib
#define bglGetError glGetError
#define bglGetString glGetString
#define bglHint glHint
#define bglDrawBuffer glDrawBuffer
#define bglReadBuffer glReadBuffer
#define bglScissor glScissor
#define bglClipPlane glClipPlane
// Depth
#define bglDepthFunc glDepthFunc
#define bglDepthMask glDepthMask
//#define bglDepthRange glDepthRange
// Matrix
#define bglMatrixMode glMatrixMode
#define bglOrtho glOrtho
#define bglFrustum glFrustum
#define bglViewport glViewport
#define bglPushMatrix glPushMatrix
#define bglPopMatrix glPopMatrix
#define bglLoadIdentity glLoadIdentity
#define bglLoadMatrixf glLoadMatrixf
#define bglLoadMatrixd glLoadMatrixd
#define bglMultMatrixf glMultMatrixf
#define bglMultMatrixd glMultMatrixd
#define bglRotatef glRotatef
#define bglScalef glScalef
#define bglTranslatef glTranslatef
// Drawing
#define bglBegin glBegin
#define bglEnd glEnd
#define bglVertex2f glVertex2f
#define bglVertex2i glVertex2i
#define bglVertex3f glVertex3f
#define bglVertex3d glVertex3d
#define bglVertex3fv glVertex3fv
#define bglVertex3dv glVertex3dv
#define bglRecti glRecti
#define bglColor3f glColor3f
#define bglColor4f glColor4f
#define bglColor4ub glColor4ub
#define bglTexCoord2d glTexCoord2d
#define bglTexCoord2f glTexCoord2f
#define bglTexCoord2i glTexCoord2i
#define bglNormal3f glNormal3f
// Lighting
#define bglShadeModel glShadeModel
#define bglLightfv glLightfv
// Raster funcs
#define bglReadPixels glReadPixels
#define bglRasterPos4i glRasterPos4i
#define bglDrawPixels glDrawPixels
#define bglPixelStorei glPixelStorei
// Texture mapping
#define bglTexEnvf glTexEnvf
#define bglGenTextures glGenTextures
#define bglDeleteTextures glDeleteTextures
#define bglBindTexture glBindTexture
#define bglTexImage2D glTexImage2D
#define bglCopyTexImage2D glCopyTexImage2D
#define bglCopyTexSubImage2D glCopyTexSubImage2D;
#define bglTexSubImage2D glTexSubImage2D
#define bglTexParameterf glTexParameterf
#define bglTexParameteri glTexParameteri
#define bglGetTexParameteriv glGetTexParameteriv
#define bglGetTexLevelParameteriv glGetTexLevelParameteriv
// Fog
#define bglFogf glFogf
#define bglFogi glFogi
#define bglFogfv glFogfv
// Display Lists
#define bglNewList glNewList
#define bglEndList glEndList
#define bglCallList glCallList
#define bglDeleteLists glDeleteLists
// Vertex Arrays
#define bglEnableClientState glEnableClientState
#define bglDisableClientState glDisableClientState
#define bglVertexPointer glVertexPointer
#define bglNormalPointer glNormalPointer
#define bglTexCoordPointer glTexCoordPointer
#define bglDrawElements glDrawElements
// Stencil Buffer
#define bglClearStencil glClearStencil
#define bglStencilOp glStencilOp
#define bglStencilFunc glStencilFunc
#endif
#if defined DYNAMIC_GLEXT
typedef void (APIENTRY * bglBlendEquationProcPtr)( GLenum mode );
extern bglBlendEquationProcPtr bglBlendEquation;
typedef void (APIENTRY * bglTexImage3DProcPtr)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
extern bglTexImage3DProcPtr bglTexImage3D;
typedef void (APIENTRY * bglCompressedTexImage2DARBProcPtr)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
extern bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
typedef void (APIENTRY * bglGetCompressedTexImageARBProcPtr)(GLenum, GLint, GLvoid *);
extern bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
// GPU Programs
typedef void (APIENTRY * bglGenProgramsARBProcPtr)(GLsizei, GLuint *);
extern bglGenProgramsARBProcPtr bglGenProgramsARB;
@ -518,204 +675,21 @@ typedef void (APIENTRY * bglDebugMessageCallbackARBProcPtr)(GLDEBUGPROCARB callb
extern bglDebugMessageCallbackARBProcPtr bglDebugMessageCallbackARB;
#endif
// GLU
#if defined __clang__ && defined __APPLE__
// XXX: OS X 10.9 deprecated GLUtesselator.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
typedef void (APIENTRY * bgluTessBeginContourProcPtr)(GLUtesselator* tess);
extern bgluTessBeginContourProcPtr bgluTessBeginContour;
typedef void (APIENTRY * bgluTessBeginPolygonProcPtr)(GLUtesselator* tess, GLvoid* data);
extern bgluTessBeginPolygonProcPtr bgluTessBeginPolygon;
typedef void (APIENTRY * bgluTessCallbackProcPtr)(GLUtesselator* tess, GLenum which, void (PR_CALLBACK CallBackFuncProcPtr)());
extern bgluTessCallbackProcPtr bgluTessCallback;
typedef void (APIENTRY * bgluTessEndContourProcPtr)(GLUtesselator* tess);
extern bgluTessEndContourProcPtr bgluTessEndContour;
typedef void (APIENTRY * bgluTessEndPolygonProcPtr)(GLUtesselator* tess);
extern bgluTessEndPolygonProcPtr bgluTessEndPolygon;
typedef void (APIENTRY * bgluTessNormalProcPtr)(GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
extern bgluTessNormalProcPtr bgluTessNormal;
typedef void (APIENTRY * bgluTessPropertyProcPtr)(GLUtesselator* tess, GLenum which, GLdouble data);
extern bgluTessPropertyProcPtr bgluTessProperty;
typedef void (APIENTRY * bgluTessVertexProcPtr)(GLUtesselator* tess, GLdouble *location, GLvoid* data);
extern bgluTessVertexProcPtr bgluTessVertex;
typedef GLUtesselator* (APIENTRY * bgluNewTessProcPtr)(void);
extern bgluNewTessProcPtr bgluNewTess;
typedef void (APIENTRY * bgluDeleteTessProcPtr)(GLUtesselator* tess);
extern bgluDeleteTessProcPtr bgluDeleteTess;
#if defined __clang__ && defined __APPLE__
#pragma clang diagnostic pop
#endif
typedef void (APIENTRY * bgluPerspectiveProcPtr)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
extern bgluPerspectiveProcPtr bgluPerspective;
typedef const GLubyte * (APIENTRY * bgluErrorStringProcPtr)(GLenum error);
extern bgluErrorStringProcPtr bgluErrorString;
typedef GLint (APIENTRY * bgluProjectProcPtr)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
extern bgluProjectProcPtr bgluProject;
typedef GLint (APIENTRY * bgluUnProjectProcPtr)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
extern bgluUnProjectProcPtr bgluUnProject;
#ifdef _WIN32
// Windows
typedef HGLRC (WINAPI * bwglCreateContextProcPtr)(HDC);
extern bwglCreateContextProcPtr bwglCreateContext;
typedef BOOL (WINAPI * bwglDeleteContextProcPtr)(HGLRC);
extern bwglDeleteContextProcPtr bwglDeleteContext;
typedef PROC (WINAPI * bwglGetProcAddressProcPtr)(LPCSTR);
extern bwglGetProcAddressProcPtr bwglGetProcAddress;
typedef BOOL (WINAPI * bwglMakeCurrentProcPtr)(HDC,HGLRC);
extern bwglMakeCurrentProcPtr bwglMakeCurrent;
typedef BOOL (WINAPI * bwglSwapBuffersProcPtr)(HDC);
extern bwglSwapBuffersProcPtr bwglSwapBuffers;
typedef int32_t (WINAPI * bwglChoosePixelFormatProcPtr)(HDC,CONST PIXELFORMATDESCRIPTOR*);
extern bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
typedef int32_t (WINAPI * bwglDescribePixelFormatProcPtr)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
extern bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
typedef int32_t (WINAPI * bwglGetPixelFormatProcPtr)(HDC);
extern bwglGetPixelFormatProcPtr bwglGetPixelFormat;
typedef BOOL (WINAPI * bwglSetPixelFormatProcPtr)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*);
extern bwglSetPixelFormatProcPtr bwglSetPixelFormat;
typedef BOOL (WINAPI * bwglSwapIntervalEXTProcPtr)(int32_t);
extern bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
typedef HGLRC (WINAPI * bwglCreateContextAttribsARBProcPtr)(HDC hDC, HGLRC hShareContext, const int *attribList);
extern bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
#endif
//////// glGenTextures/glDeleteTextures debugging ////////
void texdbg_bglGenTextures(GLsizei n, GLuint *textures, const char *srcfn);
void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *srcfn);
//#define DEBUG_TEXTURE_NAMES
# if defined DEBUGGINGAIDS && defined DEBUG_TEXTURE_NAMES
# define bglGenTextures(numtexs, texnamear) texdbg_bglGenTextures(numtexs, texnamear, __FILE__)
# define bglDeleteTextures(numtexs, texnamear) texdbg_bglDeleteTextures(numtexs, texnamear, __FILE__)
# endif
#else
#define bglClearColor glClearColor
#define bglClear glClear
#define bglColorMask glColorMask
#define bglAlphaFunc glAlphaFunc
#define bglBlendFunc glBlendFunc
#define bglBlendEquation glBlendEquation
#define bglCullFace glCullFace
#define bglFrontFace glFrontFace
#define bglPolygonOffset glPolygonOffset
#define bglPolygonMode glPolygonMode
#define bglEnable glEnable
#define bglDisable glDisable
#define bglGetDoublev glGetDoublev
#define bglGetFloatv glGetFloatv
#define bglGetIntegerv glGetIntegerv
#define bglPushAttrib glPushAttrib
#define bglPopAttrib glPopAttrib
#define bglGetError glGetError
#define bglGetString glGetString
#define bglHint glHint
#define bglDrawBuffer glDrawBuffer
#define bglReadBuffer glReadBuffer
#define bglScissor glScissor
#define bglClipPlane glClipPlane
// Depth
#define bglDepthFunc glDepthFunc
#define bglDepthMask glDepthMask
//#define bglDepthRange glDepthRange
// Matrix
#define bglMatrixMode glMatrixMode
#define bglOrtho glOrtho
#define bglFrustum glFrustum
#define bglViewport glViewport
#define bglPushMatrix glPushMatrix
#define bglPopMatrix glPopMatrix
#define bglLoadIdentity glLoadIdentity
#define bglLoadMatrixf glLoadMatrixf
#define bglLoadMatrixd glLoadMatrixd
#define bglMultMatrixf glMultMatrixf
#define bglMultMatrixd glMultMatrixd
#define bglRotatef glRotatef
#define bglScalef glScalef
#define bglTranslatef glTranslatef
// Drawing
#define bglBegin glBegin
#define bglEnd glEnd
#define bglVertex2f glVertex2f
#define bglVertex2i glVertex2i
#define bglVertex3f glVertex3f
#define bglVertex3d glVertex3d
#define bglVertex3fv glVertex3fv
#define bglVertex3dv glVertex3dv
#define bglRecti glRecti
#define bglColor3f glColor3f
#define bglColor4f glColor4f
#define bglColor4ub glColor4ub
#define bglTexCoord2d glTexCoord2d
#define bglTexCoord2f glTexCoord2f
#define bglTexCoord2i glTexCoord2i
#define bglNormal3f glNormal3f
// Lighting
#define bglShadeModel glShadeModel
#define bglLightfv glLightfv
// Raster funcs
#define bglReadPixels glReadPixels
#define bglRasterPos4i glRasterPos4i
#define bglDrawPixels glDrawPixels
#define bglPixelStorei glPixelStorei
// Texture mapping
#define bglTexEnvf glTexEnvf
#define bglGenTextures glGenTextures
#define bglDeleteTextures glDeleteTextures
#define bglBindTexture glBindTexture
#define bglTexImage2D glTexImage2D
#define bglTexImage3D glTexImage3D
#define bglCopyTexImage2D glCopyTexImage2D
#define bglCopyTexSubImage2D glCopyTexSubImage2D;
#define bglTexSubImage2D glTexSubImage2D
#define bglTexParameterf glTexParameterf
#define bglTexParameteri glTexParameteri
#define bglGetTexParameteriv glGetTexParameteriv
#define bglGetTexLevelParameteriv glGetTexLevelParameteriv
#define bglCompressedTexImage2DARB glCompressedTexImage2DARB
#define bglGetCompressedTexImageARB glGetCompressedTexImageARB
// Fog
#define bglFogf glFogf
#define bglFogi glFogi
#define bglFogfv glFogfv
// Display Lists
#define bglNewList glNewList
#define bglEndList glEndList
#define bglCallList glCallList
#define bglDeleteLists glDeleteLists
// Vertex Arrays
#define bglEnableClientState glEnableClientState
#define bglDisableClientState glDisableClientState
#define bglVertexPointer glVertexPointer
#define bglNormalPointer glNormalPointer
#define bglTexCoordPointer glTexCoordPointer
#define bglDrawElements glDrawElements
// Stencil Buffer
#define bglClearStencil glClearStencil
#define bglStencilOp glStencilOp
#define bglStencilFunc glStencilFunc
// GPU Programs
#define bglGenProgramsARB glGenProgramsARB
#define bglBindProgramARB glBindProgramARB
@ -843,6 +817,55 @@ void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *src
#define bglGetActiveAttribARB glGetActiveAttribARB
#define bglGetAttribLocationARB glGetAttribLocationARB
#endif
#if defined DYNAMIC_GLU
// GLU
#if defined __clang__ && defined __APPLE__
// XXX: OS X 10.9 deprecated GLUtesselator.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
typedef void (APIENTRY * bgluTessBeginContourProcPtr)(GLUtesselator* tess);
extern bgluTessBeginContourProcPtr bgluTessBeginContour;
typedef void (APIENTRY * bgluTessBeginPolygonProcPtr)(GLUtesselator* tess, GLvoid* data);
extern bgluTessBeginPolygonProcPtr bgluTessBeginPolygon;
typedef void (APIENTRY * bgluTessCallbackProcPtr)(GLUtesselator* tess, GLenum which, void (PR_CALLBACK CallBackFuncProcPtr)());
extern bgluTessCallbackProcPtr bgluTessCallback;
typedef void (APIENTRY * bgluTessEndContourProcPtr)(GLUtesselator* tess);
extern bgluTessEndContourProcPtr bgluTessEndContour;
typedef void (APIENTRY * bgluTessEndPolygonProcPtr)(GLUtesselator* tess);
extern bgluTessEndPolygonProcPtr bgluTessEndPolygon;
typedef void (APIENTRY * bgluTessNormalProcPtr)(GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
extern bgluTessNormalProcPtr bgluTessNormal;
typedef void (APIENTRY * bgluTessPropertyProcPtr)(GLUtesselator* tess, GLenum which, GLdouble data);
extern bgluTessPropertyProcPtr bgluTessProperty;
typedef void (APIENTRY * bgluTessVertexProcPtr)(GLUtesselator* tess, GLdouble *location, GLvoid* data);
extern bgluTessVertexProcPtr bgluTessVertex;
typedef GLUtesselator* (APIENTRY * bgluNewTessProcPtr)(void);
extern bgluNewTessProcPtr bgluNewTess;
typedef void (APIENTRY * bgluDeleteTessProcPtr)(GLUtesselator* tess);
extern bgluDeleteTessProcPtr bgluDeleteTess;
#if defined __clang__ && defined __APPLE__
#pragma clang diagnostic pop
#endif
typedef void (APIENTRY * bgluPerspectiveProcPtr)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
extern bgluPerspectiveProcPtr bgluPerspective;
typedef const GLubyte * (APIENTRY * bgluErrorStringProcPtr)(GLenum error);
extern bgluErrorStringProcPtr bgluErrorString;
typedef GLint (APIENTRY * bgluProjectProcPtr)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
extern bgluProjectProcPtr bgluProject;
typedef GLint (APIENTRY * bgluUnProjectProcPtr)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
extern bgluUnProjectProcPtr bgluUnProject;
#else
#define bgluTessBeginContour gluTessBeginContour
#define bgluTessBeginPolygon gluTessBeginPolygon
#define bgluTessCallback gluTessCallback
@ -863,6 +886,20 @@ void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *src
#endif
//////// glGenTextures/glDeleteTextures debugging ////////
void texdbg_bglGenTextures(GLsizei n, GLuint *textures, const char *srcfn);
void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *srcfn);
//#define DEBUG_TEXTURE_NAMES
#if defined DEBUGGINGAIDS && defined DEBUG_TEXTURE_NAMES
# undef bglGenTextures
# undef bglDeleteTextures
# define bglGenTextures(numtexs, texnamear) texdbg_bglGenTextures(numtexs, texnamear, __FILE__)
# define bglDeleteTextures(numtexs, texnamear) texdbg_bglDeleteTextures(numtexs, texnamear, __FILE__)
#endif
#endif //USE_OPENGL
#ifdef _WIN32

View file

@ -15785,7 +15785,8 @@ void clearallviews(int32_t dacol)
//
void plotpixel(int32_t x, int32_t y, char col)
{
#ifdef USE_OPENGL
// XXX: if we ever want the editor to work under GL ES, find a replacement for the raster functions
#if defined USE_OPENGL && !defined EDUKE32_GLES
if (getrendermode() >= REND_POLYMOST && in3dmode())
{
palette_t p = getpal(col);

View file

@ -7,10 +7,24 @@
#if defined USE_OPENGL
#ifdef RENDERTYPESDL
# include "sdlayer.h"
#endif
#if defined DYNAMIC_GL
#ifdef RENDERTYPESDL
#include "sdlayer.h"
#ifdef _WIN32
bwglCreateContextProcPtr bwglCreateContext;
bwglDeleteContextProcPtr bwglDeleteContext;
bwglGetProcAddressProcPtr bwglGetProcAddress;
bwglMakeCurrentProcPtr bwglMakeCurrent;
bwglSwapBuffersProcPtr bwglSwapBuffers;
bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
bwglGetPixelFormatProcPtr bwglGetPixelFormat;
bwglSetPixelFormatProcPtr bwglSetPixelFormat;
#endif
bglClearColorProcPtr bglClearColor;
@ -18,7 +32,6 @@ bglClearProcPtr bglClear;
bglColorMaskProcPtr bglColorMask;
bglAlphaFuncProcPtr bglAlphaFunc;
bglBlendFuncProcPtr bglBlendFunc;
bglBlendEquationProcPtr bglBlendEquation;
bglCullFaceProcPtr bglCullFace;
bglFrontFaceProcPtr bglFrontFace;
bglPolygonOffsetProcPtr bglPolygonOffset;
@ -93,7 +106,6 @@ bglGenTexturesProcPtr bglGenTextures;
bglDeleteTexturesProcPtr bglDeleteTextures;
bglBindTextureProcPtr bglBindTexture;
bglTexImage2DProcPtr bglTexImage2D;
bglTexImage3DProcPtr bglTexImage3D;
bglCopyTexImage2DProcPtr bglCopyTexImage2D;
bglCopyTexSubImage2DProcPtr bglCopyTexSubImage2D;
bglTexSubImage2DProcPtr bglTexSubImage2D;
@ -101,8 +113,6 @@ bglTexParameterfProcPtr bglTexParameterf;
bglTexParameteriProcPtr bglTexParameteri;
bglGetTexParameterivProcPtr bglGetTexParameteriv;
bglGetTexLevelParameterivProcPtr bglGetTexLevelParameteriv;
bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
bglTexGenfvProcPtr bglTexGenfv;
// Fog
@ -130,6 +140,16 @@ bglClearStencilProcPtr bglClearStencil;
bglStencilOpProcPtr bglStencilOp;
bglStencilFuncProcPtr bglStencilFunc;
#endif
#if defined DYNAMIC_GLEXT
bglBlendEquationProcPtr bglBlendEquation;
bglTexImage3DProcPtr bglTexImage3D;
bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
// GPU Programs
bglGenProgramsARBProcPtr bglGenProgramsARB;
bglBindProgramARBProcPtr bglBindProgramARB;
@ -263,6 +283,15 @@ bglDebugMessageControlARBProcPtr bglDebugMessageControlARB;
bglDebugMessageCallbackARBProcPtr bglDebugMessageCallbackARB;
#endif
#ifdef _WIN32
bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
#endif
#endif
#if defined DYNAMIC_GLU
// GLU
bgluTessBeginContourProcPtr bgluTessBeginContour;
bgluTessBeginPolygonProcPtr bgluTessBeginPolygon;
@ -282,36 +311,22 @@ bgluErrorStringProcPtr bgluErrorString;
bgluProjectProcPtr bgluProject;
bgluUnProjectProcPtr bgluUnProject;
#ifdef _WIN32
// Windows
bwglCreateContextProcPtr bwglCreateContext;
bwglDeleteContextProcPtr bwglDeleteContext;
bwglGetProcAddressProcPtr bwglGetProcAddress;
bwglMakeCurrentProcPtr bwglMakeCurrent;
bwglSwapBuffersProcPtr bwglSwapBuffers;
bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
bwglGetPixelFormatProcPtr bwglGetPixelFormat;
bwglSetPixelFormatProcPtr bwglSetPixelFormat;
bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
#else
#include <dlfcn.h>
#endif
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT || defined DYNAMIC_GLU
# if !defined _WIN32
# include <dlfcn.h>
# endif
#endif
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
#if !defined RENDERTYPESDL && defined _WIN32
static HMODULE hGLDLL;
#endif
#if defined _WIN32
static HMODULE hGLUDLL;
#else
static void *gluhandle = NULL;
#endif
char *gldriver = NULL, *glulibrary = NULL;
char *gldriver = NULL;
static void *getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extension)
{
@ -337,8 +352,15 @@ static void *getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extens
#define GETPROCEXT(s) getproc_(s,&err,1,1)
#define GETPROCEXTSOFT(s) getproc_(s,&err,0,1)
#endif
int32_t loadgldriver(const char *driver)
{
#if defined EDUKE32_GLES
jwzgles_reset();
#endif
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
int32_t err=0;
#if !defined RENDERTYPESDL && defined _WIN32
@ -373,7 +395,9 @@ int32_t loadgldriver(const char *driver)
}
#endif
gldriver = Bstrdup(driver);
#endif
#if defined DYNAMIC_GL
#ifdef _WIN32
bwglCreateContext = (bwglCreateContextProcPtr) GETPROC("wglCreateContext");
bwglDeleteContext = (bwglDeleteContextProcPtr) GETPROC("wglDeleteContext");
@ -499,16 +523,23 @@ int32_t loadgldriver(const char *driver)
bglClearStencil = (bglClearStencilProcPtr) GETPROC("glClearStencil");
bglStencilOp = (bglStencilOpProcPtr) GETPROC("glStencilOp");
bglStencilFunc = (bglStencilFuncProcPtr) GETPROC("glStencilFunc");
#endif
loadglextensions();
loadglulibrary(getenv("BUILD_GLULIB"));
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
if (err) unloadgldriver();
return err;
#else
UNREFERENCED_PARAMETER(driver);
return 0;
#endif
}
int32_t loadglextensions(void)
{
#if defined DYNAMIC_GLEXT
int32_t err = 0;
#if !defined RENDERTYPESDL && defined _WIN32
if (!hGLDLL) return 0;
@ -657,13 +688,28 @@ int32_t loadglextensions(void)
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) GETPROCEXTSOFT("wglSwapIntervalEXT");
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB");
#endif
#if defined EDUKE32_GLES
// XXX: Replace with a proper GL ES solution,
// along with the following "unkludgeable" functions that are used in POLYMER=0 builds:
// glDeleteBuffersARB, glGenBuffersARB, glBindBufferARB,
// glMapBufferARB, glUnmapBufferARB, glBufferDataARB,
// glClientActiveTextureARB,
// glGetCompressedTexImageARB, glCompressedTexImage2DARB
bglActiveTextureARB = (bglActiveTextureARBProcPtr) glActiveTexture;
#endif
return err;
#else
return 0;
#endif
}
int32_t unloadgldriver(void)
{
unloadglulibrary();
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
#if !defined RENDERTYPESDL && defined _WIN32
if (!hGLDLL) return 0;
#endif
@ -675,13 +721,27 @@ int32_t unloadgldriver(void)
FreeLibrary(hGLDLL);
hGLDLL = NULL;
#endif
#endif
#if defined DYNAMIC_GL
#ifdef _WIN32
bwglCreateContext = (bwglCreateContextProcPtr) NULL;
bwglDeleteContext = (bwglDeleteContextProcPtr) NULL;
bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL;
bwglMakeCurrent = (bwglMakeCurrentProcPtr) NULL;
bwglSwapBuffers = (bwglSwapBuffersProcPtr) NULL;
bwglChoosePixelFormat = (bwglChoosePixelFormatProcPtr) NULL;
bwglDescribePixelFormat = (bwglDescribePixelFormatProcPtr) NULL;
bwglGetPixelFormat = (bwglGetPixelFormatProcPtr) NULL;
bwglSetPixelFormat = (bwglSetPixelFormatProcPtr) NULL;
#endif
bglClearColor = (bglClearColorProcPtr) NULL;
bglClear = (bglClearProcPtr) NULL;
bglColorMask = (bglColorMaskProcPtr) NULL;
bglAlphaFunc = (bglAlphaFuncProcPtr) NULL;
bglBlendFunc = (bglBlendFuncProcPtr) NULL;
bglBlendEquation = (bglBlendEquationProcPtr) NULL;
bglCullFace = (bglCullFaceProcPtr) NULL;
bglFrontFace = (bglFrontFaceProcPtr) NULL;
bglPolygonOffset = (bglPolygonOffsetProcPtr) NULL;
@ -756,7 +816,6 @@ int32_t unloadgldriver(void)
bglDeleteTextures = (bglDeleteTexturesProcPtr) NULL;
bglBindTexture = (bglBindTextureProcPtr) NULL;
bglTexImage2D = (bglTexImage2DProcPtr) NULL;
bglTexImage3D = (bglTexImage3DProcPtr) NULL;
bglCopyTexImage2D = (bglCopyTexImage2DProcPtr) NULL;
bglCopyTexSubImage2D = (bglCopyTexSubImage2DProcPtr) NULL;
bglTexSubImage2D = (bglTexSubImage2DProcPtr) NULL;
@ -764,8 +823,7 @@ int32_t unloadgldriver(void)
bglTexParameteri = (bglTexParameteriProcPtr) NULL;
bglGetTexParameteriv = (bglGetTexParameterivProcPtr) NULL;
bglGetTexLevelParameteriv = (bglGetTexLevelParameterivProcPtr) NULL;
bglCompressedTexImage2DARB = (bglCompressedTexImage2DARBProcPtr) NULL;
bglGetCompressedTexImageARB = (bglGetCompressedTexImageARBProcPtr) NULL;
bglTexGenfv = (bglTexGenfvProcPtr) NULL;
// Fog
bglFogf = (bglFogfProcPtr) NULL;
@ -784,12 +842,21 @@ int32_t unloadgldriver(void)
bglVertexPointer = (bglVertexPointerProcPtr) NULL;
bglNormalPointer = (bglNormalPointerProcPtr) NULL;
bglTexCoordPointer = (bglTexCoordPointerProcPtr) NULL;
bglDrawArrays = (bglDrawArraysProcPtr) NULL;
bglDrawElements = (bglDrawElementsProcPtr) NULL;
// Stencil Buffer
bglClearStencil = (bglClearStencilProcPtr) NULL;
bglStencilOp = (bglStencilOpProcPtr) NULL;
bglStencilFunc = (bglStencilFuncProcPtr) NULL;
#endif
#if defined DYNAMIC_GLEXT
bglBlendEquation = (bglBlendEquationProcPtr) NULL;
bglTexImage3D = (bglTexImage3DProcPtr) NULL;
bglCompressedTexImage2DARB = (bglCompressedTexImage2DARBProcPtr) NULL;
bglGetCompressedTexImageARB = (bglGetCompressedTexImageARBProcPtr) NULL;
// GPU Programs
bglGenProgramsARB = (bglGenProgramsARBProcPtr) NULL;
@ -918,23 +985,30 @@ int32_t unloadgldriver(void)
bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) NULL;
bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) NULL;
#ifdef _WIN32
bwglCreateContext = (bwglCreateContextProcPtr) NULL;
bwglDeleteContext = (bwglDeleteContextProcPtr) NULL;
bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL;
bwglMakeCurrent = (bwglMakeCurrentProcPtr) NULL;
// Debug Output
#ifndef __APPLE__
bglDebugMessageControlARB = (bglDebugMessageControlARBProcPtr) NULL;
bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) NULL;
#endif
bwglSwapBuffers = (bwglSwapBuffersProcPtr) NULL;
bwglChoosePixelFormat = (bwglChoosePixelFormatProcPtr) NULL;
bwglDescribePixelFormat = (bwglDescribePixelFormatProcPtr) NULL;
bwglGetPixelFormat = (bwglGetPixelFormatProcPtr) NULL;
bwglSetPixelFormat = (bwglSetPixelFormatProcPtr) NULL;
#ifdef _WIN32
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) NULL;
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) NULL;
#endif
#endif
return 0;
}
#if defined DYNAMIC_GLU
#if defined _WIN32
static HMODULE hGLUDLL;
#else
static void *gluhandle = NULL;
#endif
char *glulibrary = NULL;
static void *glugetproc_(const char *s, int32_t *err, int32_t fatal)
{
void *t;
@ -952,9 +1026,11 @@ static void *glugetproc_(const char *s, int32_t *err, int32_t fatal)
}
#define GLUGETPROC(s) glugetproc_(s,&err,1)
#define GLUGETPROCSOFT(s) glugetproc_(s,&err,0)
#endif
int32_t loadglulibrary(const char *driver)
{
#if defined DYNAMIC_GLU
int32_t err=0;
#if defined _WIN32
@ -976,11 +1052,16 @@ int32_t loadglulibrary(const char *driver)
#if defined _WIN32
hGLUDLL = LoadLibrary(driver);
if (!hGLUDLL) goto fail;
if (!hGLUDLL)
#else
gluhandle = dlopen(driver, RTLD_NOW|RTLD_GLOBAL);
if (!gluhandle) goto fail;
if (!gluhandle)
#endif
{
initprintf("Failed loading \"%s\"\n",driver);
return -1;
}
glulibrary = Bstrdup(driver);
bgluTessBeginContour = (bgluTessBeginContourProcPtr) GLUGETPROC("gluTessBeginContour");
@ -1003,14 +1084,15 @@ int32_t loadglulibrary(const char *driver)
if (err) unloadglulibrary();
return err;
fail:
initprintf("Failed loading \"%s\"\n",driver);
return -1;
#else
UNREFERENCED_PARAMETER(driver);
return 0;
#endif
}
int32_t unloadglulibrary(void)
{
#if defined DYNAMIC_GLU
#if defined _WIN32
if (!hGLUDLL) return 0;
#endif
@ -1043,6 +1125,7 @@ int32_t unloadglulibrary(void)
bgluProject = (bgluProjectProcPtr) NULL;
bgluUnProject = (bgluUnProjectProcPtr) NULL;
#endif
return 0;
}
@ -1142,16 +1225,4 @@ void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *src
}
# endif // defined DEBUGGINGAIDS
#else
int32_t loadgldriver(const char *driver) { UNREFERENCED_PARAMETER(driver); return 0; };
int32_t loadglextensions(void) { return 0; };
int32_t unloadgldriver(void) { return 0; };
int32_t loadglulibrary(const char *driver) { UNREFERENCED_PARAMETER(driver); return 0; };
int32_t unloadglulibrary(void) { return 0; };
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -398,7 +398,6 @@
<ClCompile Include="build\src\dynamicgtk.c" />
<ClCompile Include="build\src\engine.c" />
<ClCompile Include="build\src\glbuild.c" />
<ClCompile Include="build\src\glbuild_android.c" />
<ClCompile Include="build\src\gtkbits.c" />
<ClCompile Include="build\src\hightile.c" />
<ClCompile Include="build\src\jwzgles.c" />

View file

@ -899,9 +899,6 @@
<ClCompile Include="build\src\jwzgles.c">
<Filter>build\source</Filter>
</ClCompile>
<ClCompile Include="build\src\glbuild_android.c">
<Filter>eduke32\source\android</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.msvc">