diff --git a/engine/Makefile b/engine/Makefile index 240e609c..0a353cda 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -343,7 +343,9 @@ else GNUC_FUNCS= -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp endif -BASE_CFLAGS=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D_DIR) -I$(PROGS_DIR) -I$(BOTLIB_DIR) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include -I$(LIBS_DIR)/sdl/include -I/usr/include/SDL -I$(LIBS_DIR)/sdl/include/SDL -I./libs/freetype2/include -I./libs/freetype2/include/freetype -I./libs/speex -DBOTLIB $(SVNREVISION) +SDL_INCLUDES=-I$(LIBS_DIR)/sdl/include -I/usr/include/SDL -I$(LIBS_DIR)/sdl/include/SDL +BOTLIB_CFLAGS=-I$(BOTLIB_DIR) -DBOTLIB +BASE_CFLAGS=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D_DIR) -I$(PROGS_DIR) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) -I./libs/freetype2/include -I./libs/freetype2/include/freetype -I./libs/speex $(BOTLIB_CFLAGS) $(SVNREVISION) CLIENT_ONLY_CFLAGS=-DCLIENTONLY SERVER_ONLY_CFLAGS=-DSERVERONLY JOINT_CFLAGS= @@ -1114,6 +1116,38 @@ ifeq ($(FTE_TARGET),droid) GL_EXE_NAME=libftedroid.so endif +ifeq ($(FTE_TARGET),web) + RELEASE_CFLAGS=-O1 -DOMIT_QCC -DGL_STATIC + CC=emcc -DFTE_TARGET_WEB -s TOTAL_MEMORY=268435456 -s FULL_ES2=1 + #-s ASM_JS=1 + #BASELDFLAGS= + + #mostly we inherit the sdl defaults. because we can, however emscripten does not support sdl cd code. + GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_null.o sys_sdl.o in_sdl.o + SDL_INCLUDES= + + SV_DIR=sv_web + #SV_LDFLAGS=-lz + #SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) svmodel.o + SV_EXE_NAME=libftesv.js + + #SV_LDFLAGS= + + STRIP=echo + SPEEXCFLAGS= + SPEEX_OBS= + #GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) cd_null.o + #GL_LDFLAGS=$(GLLDFLAGS) + GLB_DIR=gl_web + GL_EXE_NAME=../ftewebgl.html + + IMAGELDFLAGS= + OGGVORBISLDFLAGS= + + BOTLIB_CFLAGS= + NODEPS = 1 +endif + SV_DIR?=sv_sdl -include Makefile_private @@ -1157,8 +1191,7 @@ VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(COMMON_DIR) : $(SERVER_DIR) ifneq ($(findstring -DSPEEX_STATIC, $(CFLAGS)),) #add these to statically link libspeex - VPATH += : $(BASE_DIR)/libs/speex/libspeex - BASE_CFLAGS += -DSPEEX_STATIC -I$(BASE_DIR)/libs/speex/include -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" + BASE_CFLAGS += $(SPEEXCFLAGS) CLIENT_OBJS += $(SPEEX_OBJS) endif diff --git a/engine/client/in_sdl.c b/engine/client/in_sdl.c index 97def7cc..7c89cd39 100644 --- a/engine/client/in_sdl.c +++ b/engine/client/in_sdl.c @@ -251,7 +251,22 @@ void Sys_SendKeyEvents(void) case SDL_KEYUP: case SDL_KEYDOWN: - IN_KeyEvent(0, event.key.state, tbl_sdltoquake[event.key.keysym.sym], event.key.keysym.unicode); + { + int u = event.key.keysym.unicode; + int s = event.key.keysym.sym; + int qs; + if (s < sizeof(tbl_sdltoquake) / sizeof(tbl_sdltoquake[0])) + qs = tbl_sdltoquake[s]; + else + qs = 0; +#ifdef FTE_TARGET_WEB + //emscripten doesn't support unicode, but does pretend to. override it so we get something usable. + u = qs; + if (u < 32 || u > 127) + u = 0; +#endif + IN_KeyEvent(0, event.key.state, s, u); + } break; case SDL_MOUSEMOTION: diff --git a/engine/client/quakedef.h b/engine/client/quakedef.h index fac9c3f7..82de3055 100644 --- a/engine/client/quakedef.h +++ b/engine/client/quakedef.h @@ -128,7 +128,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif #else -#include + #ifdef FTE_TARGET_WEB + #define setjmp(x) 0 + #define longjmp(b,r) abort() + typedef int jmp_buf; + #else + #include + #endif #endif #include #ifdef __cplusplus diff --git a/engine/client/snd_sdl.c b/engine/client/snd_sdl.c index 4be539ab..9b9246e5 100644 --- a/engine/client/snd_sdl.c +++ b/engine/client/snd_sdl.c @@ -102,12 +102,20 @@ static int SDL_InitCard(soundcardinfo_t *sc, int cardnum) desired.userdata = sc; memcpy(&obtained, &desired, sizeof(obtained)); - +#ifdef FTE_TARGET_WEB + if ( SDL_OpenAudio(&desired, NULL) < 0 ) + { + Con_Printf("SDL: SNDDMA_Init: couldn't open sound device (%s).\n", SDL_GetError()); + return false; + } + obtained = desired; +#else if ( SDL_OpenAudio(&desired, &obtained) < 0 ) { Con_Printf("SDL: SNDDMA_Init: couldn't open sound device (%s).\n", SDL_GetError()); return false; } +#endif sc->sn.numchannels = obtained.channels; sc->sn.speed = obtained.freq; sc->sn.samplebits = obtained.format&0xff; diff --git a/engine/client/sys_sdl.c b/engine/client/sys_sdl.c index 07f12dc0..a75ae21e 100644 --- a/engine/client/sys_sdl.c +++ b/engine/client/sys_sdl.c @@ -405,7 +405,7 @@ int Sys_FileTime (char *path) void Sys_Init(void) { - SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_CDROM | SDL_INIT_NOPARACHUTE); + SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE); } void Sys_Shutdown(void) { @@ -476,6 +476,21 @@ void Sys_CloseTerminal (void) #include #endif + +#ifdef FTE_TARGET_WEB +void Sys_MainLoop(void) +{ + static float oldtime; + float newtime, time; + newtime = Sys_DoubleTime (); + if (!oldtime) + oldtime = newtime; + time = newtime - oldtime; + Host_Frame (time); + oldtime = newtime; +} +#endif + int QDECL main(int argc, char **argv) { float time, newtime, oldtime; @@ -534,6 +549,10 @@ int QDECL main(int argc, char **argv) oldtime = Sys_DoubleTime (); +#ifdef FTE_TARGET_WEB + //-1 fps should give vsync + emscripten_set_main_loop(Sys_MainLoop, -1, false); +#else //client console should now be initialized. /* main window message loop */ @@ -568,6 +587,7 @@ int QDECL main(int argc, char **argv) Sys_Sleep(sleeptime); } } +#endif return 0; } @@ -708,3 +728,44 @@ void Sys_Sleep (double seconds) SDL_Delay(seconds * 1000); } +#ifdef FTE_TARGET_WEB +//emscripten does not support the full set of sdl functions, so we stub the extras. +int SDL_GetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable) +{ + return -1; +} +int SDL_SetGammaRamp(const Uint16 *redtable, const Uint16 *greentable, const Uint16 *bluetable) +{ + return -1; +} +//SDL_GL_GetAttribute +void SDL_UnloadObject(void *object) +{ +} +void *SDL_LoadObject(const char *sofile) +{ + return NULL; +} +void *SDL_LoadFunction(void *handle, const char *name) +{ + return NULL; +} +Uint8 SDL_GetAppState(void) +{ + return SDL_APPACTIVE; +} +#define socklen_t int +int getsockname(int socket, struct sockaddr *address, socklen_t *address_len) +{ + return -1; +} +int getpeername(int socket, struct sockaddr *address, socklen_t *address_len) +{ + return -1; +} +ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len) +{ + return -1; +} +#endif + diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 4fb087f9..704a8392 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -58,6 +58,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NO_ZLIB #endif +#ifdef FTE_TARGET_WEB + //no Sys_LoadLibrary support, so we might as well kill this stuff off. + #define NO_PNG + #define NO_JPEG + #define NO_OGG + #define NO_ZLIB + #define NO_FREETYPE +#endif + #ifdef HAVE_CONFIG_H //if it was configured properly, then we have a more correct list of features we want to use. #include "config.h" #else @@ -251,6 +260,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif +#ifdef FTE_TARGET_WEB +#undef VOICECHAT +#endif + #ifdef ANDROID #undef RTLIGHTS #ifndef SPEEX_STATIC diff --git a/engine/common/mathlib.c b/engine/common/mathlib.c index 261fd74a..c4c93b26 100644 --- a/engine/common/mathlib.c +++ b/engine/common/mathlib.c @@ -428,7 +428,7 @@ int Vector4Compare (const vec4_t v1, const vec4_t v2) return 1; } - +/* void _VectorMA (const vec3_t veca, const float scale, const vec3_t vecb, vec3_t vecc) { vecc[0] = veca[0] + scale*vecb[0]; @@ -462,7 +462,7 @@ void _VectorCopy (vec3_t in, vec3_t out) out[1] = in[1]; out[2] = in[2]; } - +*/ void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross) { cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; diff --git a/engine/common/mathlib.h b/engine/common/mathlib.h index c63a2ced..3ba63805 100644 --- a/engine/common/mathlib.h +++ b/engine/common/mathlib.h @@ -113,10 +113,10 @@ typedef struct { -vec_t _DotProduct (vec3_t v1, vec3_t v2); -void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); -void _VectorCopy (vec3_t in, vec3_t out); -void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); +//vec_t _DotProduct (vec3_t v1, vec3_t v2); +//void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); +//void _VectorCopy (vec3_t in, vec3_t out); +//void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs); float anglemod (float a); void QDECL AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index ae7fa998..25cd3435 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -22,6 +22,7 @@ struct sockaddr; #include "quakedef.h" #include "netinc.h" +#include #ifdef _WIN32 #define USE_GETHOSTNAME_LOCALLISTING @@ -137,7 +138,7 @@ int NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s) memset (s, 0, sizeof(struct sockaddr_in)); ((struct sockaddr_in*)s)->sin_family = AF_INET; - *(int *)&((struct sockaddr_in*)s)->sin_addr = INADDR_BROADCAST; + *(int *)&((struct sockaddr_in*)s)->sin_addr = 0xffffffff;//INADDR_BROADCAST; ((struct sockaddr_in*)s)->sin_port = a->port; return sizeof(struct sockaddr_in); diff --git a/engine/common/netinc.h b/engine/common/netinc.h index 2b112bef..4dde4d38 100644 --- a/engine/common/netinc.h +++ b/engine/common/netinc.h @@ -166,3 +166,7 @@ #define INADDR_LOOPBACK 0x7f000001 #endif +#if defined(FTE_TARGET_WEB) + #undef IPPROTO_IPV6 +#endif + diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index ab634c45..a52778ea 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -384,7 +384,7 @@ void GL_MTBind(int tmu, int target, texid_t texnum) shaderstate.currenttextures[tmu] = texnum.num; if (target) - bindTexFunc (target, texnum.num); + qglBindTexture (target, texnum.num); #ifndef FORCESTATE if (shaderstate.curtexturetype[tmu] != target && !gl_config.nofixedfunc) @@ -413,7 +413,7 @@ void GL_LazyBind(int tmu, int target, texid_t texnum) #endif { if (shaderstate.curtexturetype[tmu]) - bindTexFunc (shaderstate.curtexturetype[tmu], texnum.num); + qglBindTexture (shaderstate.curtexturetype[tmu], texnum.num); if (gl_config.nofixedfunc) { shaderstate.curtexturetype[tmu] = target; @@ -429,7 +429,7 @@ void GL_LazyBind(int tmu, int target, texid_t texnum) } if (target) - bindTexFunc (target, texnum.num); + qglBindTexture (target, texnum.num); } } diff --git a/engine/gl/gl_vidcommon.c b/engine/gl/gl_vidcommon.c index 533cd1ff..195df312 100644 --- a/engine/gl/gl_vidcommon.c +++ b/engine/gl/gl_vidcommon.c @@ -4,40 +4,23 @@ #include "gl_draw.h" #include "shader.h" -//standard 1.1 opengl calls -void (APIENTRY *qglAlphaFunc) (GLenum func, GLclampf ref); -void (APIENTRY *qglBegin) (GLenum mode); +#ifndef GL_STATIC +//standard gles2 opengl calls. void (APIENTRY *qglBlendFunc) (GLenum sfactor, GLenum dfactor); -void (APIENTRY *qglCallList) (GLuint list); void (APIENTRY *qglClear) (GLbitfield mask); void (APIENTRY *qglClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -void (APIENTRY *qglClearDepth) (GLclampd depth); void (APIENTRY *qglClearStencil) (GLint s); -void (APIENTRY *qglClipPlane) (GLenum plane, const GLdouble *equation); -void (APIENTRY *qglColor3f) (GLfloat red, GLfloat green, GLfloat blue); -void (APIENTRY *qglColor3ub) (GLubyte red, GLubyte green, GLubyte blue); -void (APIENTRY *qglColor4f) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -void (APIENTRY *qglColor4fv) (const GLfloat *v); -void (APIENTRY *qglColor4ub) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -void (APIENTRY *qglColor4ubv) (const GLubyte *v); void (APIENTRY *qglColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void (APIENTRY *qglCopyTexImage2D) (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void (APIENTRY *qglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); void (APIENTRY *qglCullFace) (GLenum mode); void (APIENTRY *qglDepthFunc) (GLenum func); void (APIENTRY *qglDepthMask) (GLboolean flag); -void (APIENTRY *qglDepthRange) (GLclampd zNear, GLclampd zFar); void (APIENTRY *qglDepthRangef) (GLclampf zNear, GLclampf zFar); void (APIENTRY *qglDisable) (GLenum cap); -void (APIENTRY *qglDrawBuffer) (GLenum mode); -void (APIENTRY *qglDrawPixels) (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); void (APIENTRY *qglEnable) (GLenum cap); -void (APIENTRY *qglEnd) (void); -void (APIENTRY *qglEndList) (void); void (APIENTRY *qglFinish) (void); void (APIENTRY *qglFlush) (void); -void (APIENTRY *qglFrustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLuint (APIENTRY *qglGenLists) (GLsizei range); void (APIENTRY *qglGenTextures) (GLsizei n, GLuint *textures); void (APIENTRY *qglGetBooleanv) (GLenum pname, GLboolean *params); GLenum (APIENTRY *qglGetError) (void); @@ -45,6 +28,55 @@ void (APIENTRY *qglGetFloatv) (GLenum pname, GLfloat *params); void (APIENTRY *qglGetIntegerv) (GLenum pname, GLint *params); const GLubyte * (APIENTRY *qglGetString) (GLenum name); void (APIENTRY *qglHint) (GLenum target, GLenum mode); +void (APIENTRY *qglPolygonOffset) (GLfloat factor, GLfloat units); +void (APIENTRY *qglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +void (APIENTRY *qglTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +void (APIENTRY *qglTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +void (APIENTRY *qglTexParameteri) (GLenum target, GLenum pname, GLint param); +void (APIENTRY *qglTexParameterf) (GLenum target, GLenum pname, GLfloat param); +void (APIENTRY *qglTexParameteriv) (GLenum target, GLenum pname, const GLint *params); +void (APIENTRY *qglTexParameterfv) (GLenum target, GLenum pname, const GLfloat *params); +void (APIENTRY *qglViewport) (GLint x, GLint y, GLsizei width, GLsizei height); +void (APIENTRY *qglDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +void (APIENTRY *qglDrawArrays) (GLenum mode, GLint first, GLsizei count); +void (APIENTRY *qglScissor) (GLint x, GLint y, GLsizei width, GLsizei height); +void (APIENTRY *qglStencilOp) (GLenum fail, GLenum zfail, GLenum zpass); +void (APIENTRY *qglStencilFunc) (GLenum func, GLint ref, GLuint mask); +void (APIENTRY *qglDeleteTextures) (GLsizei n, const GLuint *textures); + +void (APIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint* ids); +void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids); +void (APIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint id); +void (APIENTRY *qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint* ids); +void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId, GLint level); +FTEPFNGLVERTEXATTRIBPOINTER qglVertexAttribPointer; +FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv; +FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray; +FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray; +void (APIENTRY *qglStencilOpSeparateATI) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + +//quick hack that made quake work on both 1+ext and 1.1 gl implementations. +BINDTEXFUNCPTR qglBindTexture; +#endif +//standard 1.1 opengl calls +void (APIENTRY *qglAlphaFunc) (GLenum func, GLclampf ref); +void (APIENTRY *qglBegin) (GLenum mode); +void (APIENTRY *qglCallList) (GLuint list); +void (APIENTRY *qglClearDepth) (GLclampd depth); +void (APIENTRY *qglClipPlane) (GLenum plane, const GLdouble *equation); +void (APIENTRY *qglColor3f) (GLfloat red, GLfloat green, GLfloat blue); +void (APIENTRY *qglColor3ub) (GLubyte red, GLubyte green, GLubyte blue); +void (APIENTRY *qglColor4f) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +void (APIENTRY *qglColor4fv) (const GLfloat *v); +void (APIENTRY *qglColor4ub) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +void (APIENTRY *qglColor4ubv) (const GLubyte *v); +void (APIENTRY *qglDepthRange) (GLclampd zNear, GLclampd zFar); +void (APIENTRY *qglDrawBuffer) (GLenum mode); +void (APIENTRY *qglDrawPixels) (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +void (APIENTRY *qglEnd) (void); +void (APIENTRY *qglEndList) (void); +void (APIENTRY *qglFrustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLuint (APIENTRY *qglGenLists) (GLsizei range); void (APIENTRY *qglLoadIdentity) (void); void (APIENTRY *qglLoadMatrixf) (const GLfloat *m); void (APIENTRY *qglNormal3f) (GLfloat nx, GLfloat ny, GLfloat nz); @@ -54,11 +86,9 @@ void (APIENTRY *qglMultMatrixf) (const GLfloat *m); void (APIENTRY *qglNewList) (GLuint list, GLenum mode); void (APIENTRY *qglOrtho) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); void (APIENTRY *qglPolygonMode) (GLenum face, GLenum mode); -void (APIENTRY *qglPolygonOffset) (GLfloat factor, GLfloat units); void (APIENTRY *qglPopMatrix) (void); void (APIENTRY *qglPushMatrix) (void); void (APIENTRY *qglReadBuffer) (GLenum mode); -void (APIENTRY *qglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); void (APIENTRY *qglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); void (APIENTRY *qglScalef) (GLfloat x, GLfloat y, GLfloat z); void (APIENTRY *qglShadeModel) (GLenum mode); @@ -70,34 +100,22 @@ void (APIENTRY *qglTexEnvfv) (GLenum target, GLenum pname, const GLfloat *param) void (APIENTRY *qglTexEnvi) (GLenum target, GLenum pname, GLint param); void (APIENTRY *qglTexGeni) (GLenum coord, GLenum pname, GLint param); void (APIENTRY *qglTexGenfv) (GLenum coord, GLenum pname, const GLfloat *param); -void (APIENTRY *qglTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); void (APIENTRY *qglTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -void (APIENTRY *qglTexParameteri) (GLenum target, GLenum pname, GLint param); -void (APIENTRY *qglTexParameterf) (GLenum target, GLenum pname, GLfloat param); -void (APIENTRY *qglTexParameteriv) (GLenum target, GLenum pname, const GLint *params); -void (APIENTRY *qglTexParameterfv) (GLenum target, GLenum pname, const GLfloat *params); -void (APIENTRY *qglTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); void (APIENTRY *qglTranslatef) (GLfloat x, GLfloat y, GLfloat z); void (APIENTRY *qglVertex2f) (GLfloat x, GLfloat y); void (APIENTRY *qglVertex3f) (GLfloat x, GLfloat y, GLfloat z); void (APIENTRY *qglVertex3fv) (const GLfloat *v); -void (APIENTRY *qglViewport) (GLint x, GLint y, GLsizei width, GLsizei height); void (APIENTRY *qglGetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint *params); void (APIENTRY *qglDrawRangeElements) (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -void (APIENTRY *qglDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); void (APIENTRY *qglArrayElement) (GLint i); void (APIENTRY *qglVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); void (APIENTRY *qglNormalPointer) (GLenum type, GLsizei stride, const GLvoid *pointer); void (APIENTRY *qglTexCoordPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); void (APIENTRY *qglColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -void (APIENTRY *qglDrawArrays) (GLenum mode, GLint first, GLsizei count); void (APIENTRY *qglDisableClientState) (GLenum array); void (APIENTRY *qglEnableClientState) (GLenum array); -void (APIENTRY *qglScissor) (GLint x, GLint y, GLsizei width, GLsizei height); -void (APIENTRY *qglStencilOp) (GLenum fail, GLenum zfail, GLenum zpass); -void (APIENTRY *qglStencilFunc) (GLenum func, GLint ref, GLuint mask); void (APIENTRY *qglPushAttrib) (GLbitfield mask); void (APIENTRY *qglPopAttrib) (void); @@ -105,8 +123,6 @@ void (APIENTRY *qglFogf) (GLenum pname, GLfloat param); void (APIENTRY *qglFogi) (GLenum pname, GLint param); void (APIENTRY *qglFogfv) (GLenum pname, const GLfloat *params); -void (APIENTRY *qglDeleteTextures) (GLsizei n, const GLuint *textures); - void (APIENTRY *qglGenBuffersARB)(GLsizei n, GLuint* ids); void (APIENTRY *qglDeleteBuffersARB)(GLsizei n, GLuint* ids); void (APIENTRY *qglBindBufferARB)(GLenum target, GLuint id); @@ -120,14 +136,9 @@ void (APIENTRY *qglBindVertexArray)(GLuint vaoarray); const GLubyte * (APIENTRY * qglGetStringi) (GLenum name, GLuint index); -void (APIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint* ids); -void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids); -void (APIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint id); void (APIENTRY *qglGenRenderbuffersEXT)(GLsizei n, GLuint* ids); -void (APIENTRY *qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint* ids); void (APIENTRY *qglBindRenderbufferEXT)(GLenum target, GLuint id); void (APIENTRY *qglRenderbufferStorageEXT)(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height); -void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId, GLint level); void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId); GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target); @@ -159,10 +170,6 @@ FTEPFNGLGETINFOLOGARBPROC qglGetProgramInfoLog_; FTEPFNGLLINKPROGRAMARBPROC qglLinkProgramARB; FTEPFNGLBINDATTRIBLOCATIONARBPROC qglBindAttribLocationARB; FTEPFNGLGETATTRIBLOCATIONARBPROC qglGetAttribLocationARB; -FTEPFNGLVERTEXATTRIBPOINTER qglVertexAttribPointer; -FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv; -FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray; -FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray; FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB; FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB; FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv; @@ -192,11 +199,8 @@ FTEPFNGLPNTRIANGLESIATIPROC qglPNTrianglesiATI; FTEPFNGLPNTRIANGLESFATIPROC qglPNTrianglesfATI; //stencil shadowing -void (APIENTRY *qglStencilOpSeparateATI) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); FTEPFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT; -//quick hack that made quake work on both 1 and 1.1 gl implementations. -BINDTEXFUNCPTR bindTexFunc; #define GLchar char #if defined(_DEBUG) && !defined(DEBUG) @@ -376,15 +380,26 @@ void APIENTRY GL_ClientActiveTextureStub(GLenum texid) #define getglext(name) getglfunction(name) void GL_CheckExtensions (void *(*getglfunction) (char *name)) { + qboolean webgl = false; unsigned int gl_major_version = 0; unsigned int gl_minor_version = 0; memset(&gl_config, 0, sizeof(gl_config)); - if (!strncmp(gl_version, "OpenGL ES", 9)) + if (!strncmp(gl_version, "WebGL", 5)) + { + gl_config.gles = true; + webgl = true; + } + else if (!strncmp(gl_version, "OpenGL ES", 9)) gl_config.gles = true; else gl_config.gles = false; + if (webgl) + { + gl_major_version = 2; + gl_minor_version = 0; + } if (!gl_config.gles) { if (qglGetError()) @@ -499,8 +514,17 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglSelectTextureSGIS = NULL; mtexid0 = 0; - //no GL_ATI_separate_stencil - qglStencilOpSeparateATI = NULL; +#ifndef GL_STATIC + qglGenFramebuffersEXT = NULL; + qglDeleteFramebuffersEXT = NULL; + qglBindFramebufferEXT = NULL; + qglGenRenderbuffersEXT = NULL; + qglDeleteRenderbuffersEXT = NULL; + qglBindRenderbufferEXT = NULL; + qglRenderbufferStorageEXT = NULL; + qglFramebufferTexture2DEXT = NULL; + +#endif //no GL_EXT_stencil_two_side qglActiveStencilFaceEXT = NULL; @@ -517,15 +541,6 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglGenProgramsARB = NULL; */ - qglGenFramebuffersEXT = NULL; - qglDeleteFramebuffersEXT = NULL; - qglBindFramebufferEXT = NULL; - qglGenRenderbuffersEXT = NULL; - qglDeleteRenderbuffersEXT = NULL; - qglBindRenderbufferEXT = NULL; - qglRenderbufferStorageEXT = NULL; - qglFramebufferTexture2DEXT = NULL; - r_config.texture_non_power_of_two = false; gl_config.sgis_generate_mipmap = false; @@ -617,12 +632,14 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) if ((gl_config.gles && gl_config.glversion >= 2) || GL_CheckExtension("GL_EXT_stencil_wrap")) gl_config.ext_stencil_wrap = true; +#ifndef GL_STATIC qglStencilOpSeparateATI = NULL; - qglActiveStencilFaceEXT = NULL; if ((gl_config.gles && gl_config.glversion >= 2) || gl_config.glversion >= 3) //theoretically that should be a 2 not 3. qglStencilOpSeparateATI = (void *) getglext("glStencilOpSeparate"); else if (GL_CheckExtension("GL_ATI_separate_stencil")) qglStencilOpSeparateATI = (void *) getglext("glStencilOpSeparateATI"); +#endif + qglActiveStencilFaceEXT = NULL; if (GL_CheckExtension("GL_EXT_stencil_two_side")) qglActiveStencilFaceEXT = (void *) getglext("glActiveStencilFaceEXT"); @@ -657,12 +674,14 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglPNTrianglesiATI = (void *)getglext("glPNTrianglesiATI"); } +#ifndef GL_STATIC if (GL_CheckExtension("GL_EXT_texture_object")) { - bindTexFunc = (void *)getglext("glBindTextureEXT"); - if (!bindTexFunc) //grrr - bindTexFunc = (void *)getglext("glBindTexture"); + qglBindTexture = (void *)getglext("glBindTextureEXT"); + if (!qglBindTexture) //grrr + qglBindTexture = (void *)getglext("glBindTexture"); } +#endif if (GL_CheckExtension("GL_EXT_compiled_vertex_array")) { @@ -701,6 +720,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglUnmapBufferARB = (void *)getglext("glUnmapBufferARB"); } +#ifndef GL_STATIC if (Cvar_Get("gl_blacklist_debug_glsl", "0", CVAR_RENDERERLATCH, "gl blacklists")->ival && !gl_config.nofixedfunc) { Con_Printf(CON_NOTICE "GLSL disabled\n"); @@ -823,6 +843,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) Con_DPrintf("GLSL available\n"); } +#endif //we only use vao with shaders anyway. if (!gl_config.arb_shader_objects) { @@ -847,6 +868,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglBindVertexArray = NULL; } +#ifndef GL_STATIC if (GL_CheckExtension("GL_EXT_framebuffer_object")) { gl_config.ext_framebuffer_objects = true; @@ -877,6 +899,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglCheckFramebufferStatusEXT = (void *)getglext("glCheckFramebufferStatusOES"); } */ +#endif #ifdef DEBUG if (GL_CheckExtension("GL_ARB_debug_output")) { @@ -1421,14 +1444,49 @@ GLint GLSlang_GetUniformLocation (int prog, char *name) //the vid routines have initialised a window, and now they are giving us a reference to some of of GetProcAddress to get pointers to the funcs. void GL_Init(void *(*getglfunction) (char *name)) { - qglAlphaFunc = (void *)getglcore("glAlphaFunc"); - qglBegin = (void *)getglcore("glBegin"); +#ifndef GL_STATIC + qglBindTexture = (void *)getglcore("glBindTexture"); //for compleateness qglBlendFunc = (void *)getglcore("glBlendFunc"); - bindTexFunc = (void *)getglcore("glBindTexture"); //for compleateness qglClear = (void *)getglcore("glClear"); qglClearColor = (void *)getglcore("glClearColor"); - qglClearDepth = (void *)getglcore("glClearDepth"); qglClearStencil = (void *)getglcore("glClearStencil"); + qglColorMask = (void *)getglcore("glColorMask"); + qglCopyTexImage2D = (void *)getglcore("glCopyTexImage2D"); + qglCopyTexSubImage2D= (void *)getglcore("glCopyTexSubImage2D"); + qglCullFace = (void *)getglcore("glCullFace"); + qglDepthFunc = (void *)getglcore("glDepthFunc"); + qglDepthMask = (void *)getglcore("glDepthMask"); + qglDepthRangef = (void *)getglcore("glDepthRangef"); + qglDisable = (void *)getglcore("glDisable"); + qglEnable = (void *)getglcore("glEnable"); + qglFinish = (void *)getglcore("glFinish"); + qglFlush = (void *)getglcore("glFlush"); + qglGenTextures = (void *)getglcore("glGenTextures"); + qglGetFloatv = (void *)getglcore("glGetFloatv"); + qglGetIntegerv = (void *)getglcore("glGetIntegerv"); + qglGetString = (void *)getglcore("glGetString"); + qglHint = (void *)getglcore("glHint"); + qglReadPixels = (void *)getglcore("glReadPixels"); + qglTexImage2D = (void *)getglcore("glTexImage2D"); + qglTexSubImage2D = (void *)getglcore("glTexSubImage2D"); + qglTexParameteri = (void *)getglcore("glTexParameteri"); + qglTexParameterf = (void *)getglcore("glTexParameterf"); + qglTexParameteriv = (void *)getglcore("glTexParameteriv"); + qglTexParameterfv = (void *)getglcore("glTexParameterfv"); + qglViewport = (void *)getglcore("glViewport"); + qglGetBooleanv = (void *)getglcore("glGetBooleanv"); + qglGetError = (void *)getglcore("glGetError"); + qglDeleteTextures = (void *)getglcore("glDeleteTextures"); + qglDrawElements = (void *)getglcore("glDrawElements"); + qglDrawArrays = (void *)getglcore("glDrawArrays"); + qglStencilOp = (void *)getglcore("glStencilOp"); + qglStencilFunc = (void *)getglcore("glStencilFunc"); + qglScissor = (void *)getglcore("glScissor"); + qglPolygonOffset = (void *)getglext("glPolygonOffset"); +#endif + qglAlphaFunc = (void *)getglcore("glAlphaFunc"); + qglBegin = (void *)getglcore("glBegin"); + qglClearDepth = (void *)getglcore("glClearDepth"); qglClipPlane = (void *)getglcore("glClipPlane"); qglColor3f = (void *)getglcore("glColor3f"); qglColor3ub = (void *)getglcore("glColor3ub"); @@ -1436,28 +1494,12 @@ void GL_Init(void *(*getglfunction) (char *name)) qglColor4fv = (void *)getglcore("glColor4fv"); qglColor4ub = (void *)getglcore("glColor4ub"); qglColor4ubv = (void *)getglcore("glColor4ubv"); - qglColorMask = (void *)getglcore("glColorMask"); - qglCopyTexImage2D = (void *)getglcore("glCopyTexImage2D"); - qglCopyTexSubImage2D= (void *)getglcore("glCopyTexSubImage2D"); - qglCullFace = (void *)getglcore("glCullFace"); - qglDepthFunc = (void *)getglcore("glDepthFunc"); - qglDepthMask = (void *)getglcore("glDepthMask"); qglDepthRange = (void *)getglcore("glDepthRange"); - qglDepthRangef = (void *)getglcore("glDepthRangef"); - qglDisable = (void *)getglcore("glDisable"); qglDrawBuffer = (void *)getglcore("glDrawBuffer"); qglDrawPixels = (void *)getglcore("glDrawPixels"); - qglEnable = (void *)getglcore("glEnable"); qglEnd = (void *)getglcore("glEnd"); - qglFinish = (void *)getglcore("glFinish"); - qglFlush = (void *)getglcore("glFlush"); qglFrustum = (void *)getglcore("glFrustum"); - qglGenTextures = (void *)getglcore("glGenTextures"); - qglGetFloatv = (void *)getglcore("glGetFloatv"); - qglGetIntegerv = (void *)getglcore("glGetIntegerv"); - qglGetString = (void *)getglcore("glGetString"); qglGetTexLevelParameteriv = (void *)getglcore("glGetTexLevelParameteriv"); - qglHint = (void *)getglcore("glHint"); qglLoadIdentity = (void *)getglcore("glLoadIdentity"); qglLoadMatrixf = (void *)getglcore("glLoadMatrixf"); qglNormal3f = (void *)getglcore("glNormal3f"); @@ -1469,7 +1511,6 @@ void GL_Init(void *(*getglfunction) (char *name)) qglPopMatrix = (void *)getglcore("glPopMatrix"); qglPushMatrix = (void *)getglcore("glPushMatrix"); qglReadBuffer = (void *)getglcore("glReadBuffer"); - qglReadPixels = (void *)getglcore("glReadPixels"); qglRotatef = (void *)getglcore("glRotatef"); qglScalef = (void *)getglcore("glScalef"); qglShadeModel = (void *)getglcore("glShadeModel"); @@ -1481,31 +1522,19 @@ void GL_Init(void *(*getglfunction) (char *name)) qglTexEnvi = (void *)getglcore("glTexEnvi"); qglTexGeni = (void *)getglcore("glTexGeni"); qglTexGenfv = (void *)getglcore("glTexGenfv"); - qglTexImage2D = (void *)getglcore("glTexImage2D"); qglTexImage3D = (void *)getglext("glTexImage3D"); - qglTexParameteri = (void *)getglcore("glTexParameteri"); - qglTexParameterf = (void *)getglcore("glTexParameterf"); - qglTexParameteriv = (void *)getglcore("glTexParameteriv"); - qglTexParameterfv = (void *)getglcore("glTexParameterfv"); - qglTexSubImage2D = (void *)getglcore("glTexSubImage2D"); qglTranslatef = (void *)getglcore("glTranslatef"); qglVertex2f = (void *)getglcore("glVertex2f"); qglVertex3f = (void *)getglcore("glVertex3f"); qglVertex3fv = (void *)getglcore("glVertex3fv"); - qglViewport = (void *)getglcore("glViewport"); - qglGetBooleanv = (void *)getglcore("glGetBooleanv"); - qglGetError = (void *)getglcore("glGetError"); - qglDeleteTextures = (void *)getglcore("glDeleteTextures"); //various vertex array stuff. - qglDrawElements = (void *)getglcore("glDrawElements"); qglArrayElement = (void *)getglcore("glArrayElement"); qglVertexPointer = (void *)getglcore("glVertexPointer"); qglNormalPointer = (void *)getglcore("glNormalPointer"); qglTexCoordPointer = (void *)getglcore("glTexCoordPointer"); qglColorPointer = (void *)getglcore("glColorPointer"); - qglDrawArrays = (void *)getglcore("glDrawArrays"); qglEnableClientState = (void *)getglcore("glEnableClientState"); qglDisableClientState = (void *)getglcore("glDisableClientState"); @@ -1514,18 +1543,14 @@ void GL_Init(void *(*getglfunction) (char *name)) qglDrawRangeElements = GL_DrawRangeElementsEmul; //fixme: definatly make non-core - qglStencilOp = (void *)getglcore("glStencilOp"); - qglStencilFunc = (void *)getglcore("glStencilFunc"); qglPushAttrib = (void *)getglcore("glPushAttrib"); qglPopAttrib = (void *)getglcore("glPopAttrib"); - qglScissor = (void *)getglcore("glScissor"); //does this need to be non-core as well? qglFogi = (void *)getglcore("glFogi"); qglFogf = (void *)getglcore("glFogf"); qglFogfv = (void *)getglcore("glFogfv"); - qglPolygonOffset = (void *)getglext("glPolygonOffset"); qglGetStringi = (void *)getglext("glGetStringi"); diff --git a/engine/gl/gl_vidsdl.c b/engine/gl/gl_vidsdl.c index b461ee6d..25739734 100644 --- a/engine/gl/gl_vidsdl.c +++ b/engine/gl/gl_vidsdl.c @@ -34,7 +34,9 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) Con_Printf("SDL GLVID_Init\n"); SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE); +#ifndef FTE_TARGET_WEB SDL_SetVideoMode( 0, 0, 0, 0 ); //to get around some SDL bugs +#endif SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); @@ -70,8 +72,6 @@ Con_Printf("Getting gamma\n"); return false; } - SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &gl_stencilbits); - ActiveApp = true; GLVID_SetPalette (palette); diff --git a/engine/gl/glquake.h b/engine/gl/glquake.h index 47e9719c..712254f4 100644 --- a/engine/gl/glquake.h +++ b/engine/gl/glquake.h @@ -86,7 +86,7 @@ extern r_config_t r_config; #elif defined(__MACOSX__) //apple, you suck. #include - #elif defined(NACL) + #elif defined(NACL) || defined(FTE_TARGET_WEB) #include #define GLclampd GLclampf #define GLdouble GLfloat @@ -171,10 +171,12 @@ typedef void (APIENTRYP FTEPFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0 typedef void (APIENTRY * FTEPFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); typedef void (APIENTRY * FTEPFNGLUNLOCKARRAYSEXTPROC) (void); -extern BINDTEXFUNCPTR bindTexFunc; +#ifndef GL_STATIC +extern BINDTEXFUNCPTR qglBindTexture; extern DELTEXFUNCPTR delTexFunc; extern TEXSUBIMAGEPTR TexSubImage2DFunc; extern void (APIENTRY *qglStencilOpSeparateATI) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +#endif extern FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2DARB; extern FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImageARB; extern FTEPFNGLPNTRIANGLESIATIPROC qglPNTrianglesiATI; @@ -321,16 +323,8 @@ void GL_TexEnv(GLenum mode); #define GL_TEXTURE0_SGIS 0x835E #define GL_TEXTURE1_SGIS 0x835F -typedef void (APIENTRY *lpMTexFUNC) (GLenum en, GLfloat f1, GLfloat f2); -typedef void (APIENTRY *lpSelTexFUNC) (GLenum en); -extern lpMTexFUNC qglMTexCoord2fSGIS; -extern lpSelTexFUNC qglSelectTextureSGIS; extern int gl_stencilbits; -extern FTEPFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT; - -extern lpMTexFUNC qglMTexCoord2fSGIS; -extern lpSelTexFUNC qglSelectTextureSGIS; extern int gl_mtexarbable; //max texture units @@ -439,23 +433,236 @@ void R_NetGraph (void); #if defined(GLQUAKE) +#ifdef GL_STATIC +//these are the functions that are valid in gles2. +//other functions should never actually be used. +#define qglActiveTexture glActiveTexture +#define qglAttachShader glAttachShader +#define qglBindAttribLocation glBindAttribLocation +#define qglBindBuffer glBindBuffer +#define qglBindFramebuffer glBindFramebuffer +#define qglBindRenderbuffer glBindRenderbuffer +#define qglBindTexture glBindTexture +#define qglBlendColor glBlendColor +#define qglBlendEquation glBlendEquation +#define qglBlendEquationSeparate glBlendEquationSeparate +#define qglBlendFunc glBlendFunc +#define qglBlendFuncSeparate glBlendFuncSeparate +#define qglBufferData glBufferData +#define qglBufferSubData glBufferSubData +#define qglCheckFramebufferStatus glCheckFramebufferStatus +#define qglClear glClear +#define qglClearColor glClearColor +#define qglClearDepthf glClearDepthf +#define qglClearStencil glClearStencil +#define qglColorMask glColorMask +#define qglCompileShader glCompileShader +#define qglCompressedTexImage2D glCompressedTexImage2D +#define qglCompressedTexSubImage2D glCompressedTexSubImage2D +#define qglCopyTexImage2D glCopyTexImage2D +#define qglCopyTexSubImage2D glCopyTexSubImage2D +#define qglCreateProgram glCreateProgram +#define qglCreateShader glCreateShader +#define qglCullFace glCullFace +#define qglDeleteBuffers glDeleteBuffers +#define qglDeleteFramebuffers glDeleteFramebuffers +#define qglDeleteProgram glDeleteProgram +#define qglDeleteRenderbuffers glDeleteRenderbuffers +#define qglDeleteShader glDeleteShader +#define qglDeleteTextures glDeleteTextures +#define qglDepthFunc glDepthFunc +#define qglDepthMask glDepthMask +#define qglDepthRangef glDepthRangef +#define qglDetachShader glDetachShader +#define qglDisable glDisable +#define qglDisableVertexAttribArray glDisableVertexAttribArray +#define qglDrawArrays glDrawArrays +#define qglDrawElements glDrawElements +#define qglEnable glEnable +#define qglEnableVertexAttribArray glEnableVertexAttribArray +#define qglFinish glFinish +#define qglFlush glFlush +#define qglFramebufferRenderbuffer glFramebufferRenderbuffer +#define qglFramebufferTexture2D glFramebufferTexture2D +#define qglFrontFace glFrontFace +#define qglGenBuffers glGenBuffers +#define qglGenerateMipmap glGenerateMipmap +#define qglGenFramebuffers glGenFramebuffers +#define qglGenRenderbuffers glGenRenderbuffers +#define qglGenTextures glGenTextures +#define qglGetActiveAttrib glGetActiveAttrib +#define qglGetActiveUniform glGetActiveUniform +#define qglGetAttachedShaders glGetAttachedShaders +#define qglGetAttribLocation glGetAttribLocation +#define qglGetBooleanv glGetBooleanv +#define qglGetBufferParameteriv glGetBufferParameteriv +#define qglGetError glGetError +#define qglGetFloatv glGetFloatv +#define qglGetFramebufferAttachmentParameteriv glGetFramebufferAttachmentParameteriv +#define qglGetIntegerv glGetIntegerv +#define qglGetProgramiv glGetProgramiv +#define qglGetProgramInfoLog glGetProgramInfoLog +#define qglGetRenderbufferParameteriv glGetRenderbufferParameteriv +#define qglGetShaderiv glGetShaderiv +#define qglGetShaderInfoLog glGetShaderInfoLog +#define qglGetShaderPrecisionFormat glGetShaderPrecisionFormat +#define qglGetShaderSource glGetShaderSource +#define qglGetString glGetString +#define qglGetTexParameterfv glGetTexParameterfv +#define qglGetTexParameteriv glGetTexParameteriv +#define qglGetUniformfv glGetUniformfv +#define qglGetUniformiv glGetUniformiv +#define qglGetUniformLocation glGetUniformLocation +#define qglGetVertexAttribfv glGetVertexAttribfv +#define qglGetVertexAttribiv glGetVertexAttribiv +#define qglGetVertexAttribPointerv glGetVertexAttribPointerv +#define qglHint glHint +#define qglIsBuffer glIsBuffer +#define qglIsEnabled glIsEnabled +#define qglIsFramebuffer glIsFramebuffer +#define qglIsProgram glIsProgram +#define qglIsRenderbuffer glIsRenderbuffer +#define qglIsShader glIsShader +#define qglIsTexture glIsTexture +#define qglLineWidth glLineWidth +#define qglLinkProgram glLinkProgram +#define qglPixelStorei glPixelStorei +#define qglPolygonOffset glPolygonOffset +#define qglReadPixels glReadPixels +#define qglReleaseShaderCompiler glReleaseShaderCompiler +#define qglRenderbufferStorage glRenderbufferStorage +#define qglSampleCoverage glSampleCoverage +#define qglScissor glScissor +#define qglShaderBinary glShaderBinary +#define qglShaderSource glShaderSource +#define qglStencilFunc glStencilFunc +#define qglStencilFuncSeparate glStencilFuncSeparate +#define qglStencilMask glStencilMask +#define qglStencilMaskSeparate glStencilMaskSeparate +#define qglStencilOp glStencilOp +#define qglStencilOpSeparate glStencilOpSeparate +#define qglTexImage2D glTexImage2D +#define qglTexParameterf glTexParameterf +#define qglTexParameterfv glTexParameterfv +#define qglTexParameteri glTexParameteri +#define qglTexParameteriv glTexParameteriv +#define qglTexSubImage2D glTexSubImage2D +#define qglUniform1f glUniform1f +#define qglUniform1fv glUniform1fv +#define qglUniform1i glUniform1i +#define qglUniform1iv glUniform1iv +#define qglUniform2f glUniform2f +#define qglUniform2fv glUniform2fv +#define qglUniform2i glUniform2i +#define qglUniform2iv glUniform2iv +#define qglUniform3f glUniform3f +#define qglUniform3fv glUniform3fv +#define qglUniform3i glUniform3i +#define qglUniform3iv glUniform3iv +#define qglUniform4f glUniform4f +#define qglUniform4fv glUniform4fv +#define qglUniform4i glUniform4i +#define qglUniform4iv glUniform4iv +#define qglUniformMatrix2fv glUniformMatrix2fv +#define qglUniformMatrix3fv glUniformMatrix3fv +#define qglUniformMatrix4fv glUniformMatrix4fv +#define qglUseProgram glUseProgram +#define qglValidateProgram glValidateProgram +#define qglVertexAttrib1f glVertexAttrib1f +#define qglVertexAttrib1fv glVertexAttrib1fv +#define qglVertexAttrib2f glVertexAttrib2f +#define qglVertexAttrib2fv glVertexAttrib2fv +#define qglVertexAttrib3f glVertexAttrib3f +#define qglVertexAttrib3fv glVertexAttrib3fv +#define qglVertexAttrib4f glVertexAttrib4f +#define qglVertexAttrib4fv glVertexAttrib4fv +#define qglVertexAttribPointer glVertexAttribPointer +#define qglViewport glViewport + +#define qglStencilOpSeparateATI qglStencilOpSeparate +#define qglGenFramebuffersEXT qglGenFramebuffers +#define qglBindFramebufferEXT qglBindFramebuffer +#define qglFramebufferTexture2DEXT qglFramebufferTexture2D +#define qglDeleteRenderbuffersEXT qglDeleteRenderbuffers +//#define qglCompressedTexImage2DARB qglCompressedTexImage2D +#else +extern void (APIENTRY *qglBindTexture) (GLenum target, GLuint texture); +extern void (APIENTRY *qglBlendFunc) (GLenum sfactor, GLenum dfactor); +extern void (APIENTRY *qglClear) (GLbitfield mask); +extern void (APIENTRY *qglClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +extern void (APIENTRY *qglClearDepthf) (GLclampf depth); +extern void (APIENTRY *qglClearStencil) (GLint s); +extern void (APIENTRY *qglColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +extern void (APIENTRY *qglCopyTexImage2D) (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +extern void (APIENTRY *qglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +extern void (APIENTRY *qglCullFace) (GLenum mode); +extern void (APIENTRY *qglDeleteTextures) (GLsizei n, const GLuint *textures); +extern void (APIENTRY *qglDepthFunc) (GLenum func); +extern void (APIENTRY *qglDepthMask) (GLboolean flag); +extern void (APIENTRY *qglDepthRangef) (GLclampf zNear, GLclampf zFar); +extern void (APIENTRY *qglDisable) (GLenum cap); +extern void (APIENTRY *qglDrawArrays) (GLenum mode, GLint first, GLsizei count); +extern void (APIENTRY *qglDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +extern void (APIENTRY *qglEnable) (GLenum cap); +extern void (APIENTRY *qglFinish) (void); +extern void (APIENTRY *qglFlush) (void); +extern void (APIENTRY *qglFrontFace) (GLenum mode); +extern void (APIENTRY *qglGenTextures) (GLsizei n, GLuint *textures); +extern void (APIENTRY *qglGetBooleanv) (GLenum pname, GLboolean *params); +extern GLenum (APIENTRY *qglGetError) (void); +extern void (APIENTRY *qglGetFloatv) (GLenum pname, GLfloat *params); +extern void (APIENTRY *qglGetIntegerv) (GLenum pname, GLint *params); +extern const GLubyte * (APIENTRY *qglGetString) (GLenum name); +extern void (APIENTRY *qglGetTexParameterfv) (GLenum target, GLenum pname, GLfloat *params); +extern void (APIENTRY *qglGetTexParameteriv) (GLenum target, GLenum pname, GLint *params); +extern void (APIENTRY *qglHint) (GLenum target, GLenum mode); +extern GLboolean (APIENTRY *qglIsEnabled) (GLenum cap); +extern GLboolean (APIENTRY *qglIsTexture) (GLuint texture); +extern void (APIENTRY *qglLineWidth) (GLfloat width); +extern void (APIENTRY *qglPixelStorei) (GLenum pname, GLint param); +extern void (APIENTRY *qglPolygonOffset) (GLfloat factor, GLfloat units); +extern void (APIENTRY *qglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +extern void (APIENTRY *qglScissor) (GLint x, GLint y, GLsizei width, GLsizei height); +extern void (APIENTRY *qglStencilFunc) (GLenum func, GLint ref, GLuint mask); +extern void (APIENTRY *qglStencilMask) (GLuint mask); +extern void (APIENTRY *qglStencilOp) (GLenum fail, GLenum zfail, GLenum zpass); +extern void (APIENTRY *qglTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +extern void (APIENTRY *qglTexParameterf) (GLenum target, GLenum pname, GLfloat param); +extern void (APIENTRY *qglTexParameterfv) (GLenum target, GLenum pname, const GLfloat *params); +extern void (APIENTRY *qglTexParameteri) (GLenum target, GLenum pname, GLint param); +extern void (APIENTRY *qglTexParameteriv) (GLenum target, GLenum pname, const GLint *params); +extern void (APIENTRY *qglTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +extern void (APIENTRY *qglViewport) (GLint x, GLint y, GLsizei width, GLsizei height); + +extern void (APIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint* ids); +extern void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids); +extern void (APIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint id); +extern void (APIENTRY *qglGenRenderbuffersEXT)(GLsizei n, GLuint* ids); +extern void (APIENTRY *qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint* ids); +extern void (APIENTRY *qglBindRenderbufferEXT)(GLenum target, GLuint id); +extern void (APIENTRY *qglRenderbufferStorageEXT)(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height); +extern void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId, GLint level); +extern void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId); +extern GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target); + +extern FTEPFNGLVERTEXATTRIBPOINTER qglVertexAttribPointer; +extern FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv; +extern FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray; +extern FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray; + +#endif + +//non-gles2 gl functions extern void (APIENTRY *qglAccum) (GLenum op, GLfloat value); extern void (APIENTRY *qglAlphaFunc) (GLenum func, GLclampf ref); extern GLboolean (APIENTRY *qglAreTexturesResident) (GLsizei n, const GLuint *textures, GLboolean *residences); extern void (APIENTRY *qglArrayElement) (GLint i); -extern void (APIENTRY *qglBegin) (GLenum mode); -extern void (APIENTRY *qglBindTexture) (GLenum target, GLuint texture); extern void (APIENTRY *qglBitmap) (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); -extern void (APIENTRY *qglBlendFunc) (GLenum sfactor, GLenum dfactor); extern void (APIENTRY *qglCallList) (GLuint list); extern void (APIENTRY *qglCallLists) (GLsizei n, GLenum type, const GLvoid *lists); -extern void (APIENTRY *qglClear) (GLbitfield mask); extern void (APIENTRY *qglClearAccum) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -extern void (APIENTRY *qglClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -extern void (APIENTRY *qglClearDepthf) (GLclampf depth); extern void (APIENTRY *qglClearDepth) (GLclampd depth); extern void (APIENTRY *qglClearIndex) (GLfloat c); -extern void (APIENTRY *qglClearStencil) (GLint s); extern void (APIENTRY *qglClipPlane) (GLenum plane, const GLdouble *equation); extern void (APIENTRY *qglColor3b) (GLbyte red, GLbyte green, GLbyte blue); extern void (APIENTRY *qglColor3bv) (const GLbyte *v); @@ -489,33 +696,19 @@ extern void (APIENTRY *qglColor4ui) (GLuint red, GLuint green, GLuint blue, GLui extern void (APIENTRY *qglColor4uiv) (const GLuint *v); extern void (APIENTRY *qglColor4us) (GLushort red, GLushort green, GLushort blue, GLushort alpha); extern void (APIENTRY *qglColor4usv) (const GLushort *v); -extern void (APIENTRY *qglColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); extern void (APIENTRY *qglColorMaterial) (GLenum face, GLenum mode); extern void (APIENTRY *qglColorPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); extern void (APIENTRY *qglCopyPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); extern void (APIENTRY *qglCopyTexImage1D) (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); -extern void (APIENTRY *qglCopyTexImage2D) (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); extern void (APIENTRY *qglCopyTexSubImage1D) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -extern void (APIENTRY *qglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -extern void (APIENTRY *qglCullFace) (GLenum mode); extern void (APIENTRY *qglDeleteLists) (GLuint list, GLsizei range); -extern void (APIENTRY *qglDeleteTextures) (GLsizei n, const GLuint *textures); -extern void (APIENTRY *qglDepthFunc) (GLenum func); -extern void (APIENTRY *qglDepthMask) (GLboolean flag); extern void (APIENTRY *qglDepthRange) (GLclampd zNear, GLclampd zFar); -extern void (APIENTRY *qglDepthRangef) (GLclampf zNear, GLclampf zFar); -extern void (APIENTRY *qglDisable) (GLenum cap); extern void (APIENTRY *qglDisableClientState) (GLenum array); -extern void (APIENTRY *qglDrawArrays) (GLenum mode, GLint first, GLsizei count); extern void (APIENTRY *qglDrawBuffer) (GLenum mode); -extern void (APIENTRY *qglDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); extern void (APIENTRY *qglDrawPixels) (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); extern void (APIENTRY *qglEdgeFlag) (GLboolean flag); extern void (APIENTRY *qglEdgeFlagPointer) (GLsizei stride, const GLvoid *pointer); extern void (APIENTRY *qglEdgeFlagv) (const GLboolean *flag); -extern void (APIENTRY *qglEnable) (GLenum cap); -extern void (APIENTRY *qglEnableClientState) (GLenum array); -extern void (APIENTRY *qglEnd) (void); extern void (APIENTRY *qglEndList) (void); extern void (APIENTRY *qglEvalCoord1d) (GLdouble u); extern void (APIENTRY *qglEvalCoord1dv) (const GLdouble *u); @@ -530,22 +723,14 @@ extern void (APIENTRY *qglEvalMesh2) (GLenum mode, GLint i1, GLint i2, GLint j1, extern void (APIENTRY *qglEvalPoint1) (GLint i); extern void (APIENTRY *qglEvalPoint2) (GLint i, GLint j); extern void (APIENTRY *qglFeedbackBuffer) (GLsizei size, GLenum type, GLfloat *buffer); -extern void (APIENTRY *qglFinish) (void); -extern void (APIENTRY *qglFlush) (void); extern void (APIENTRY *qglFogf) (GLenum pname, GLfloat param); extern void (APIENTRY *qglFogfv) (GLenum pname, const GLfloat *params); extern void (APIENTRY *qglFogi) (GLenum pname, GLint param); extern void (APIENTRY *qglFogiv) (GLenum pname, const GLint *params); -extern void (APIENTRY *qglFrontFace) (GLenum mode); extern void (APIENTRY *qglFrustum) (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); extern GLuint (APIENTRY *qglGenLists) (GLsizei range); -extern void (APIENTRY *qglGenTextures) (GLsizei n, GLuint *textures); -extern void (APIENTRY *qglGetBooleanv) (GLenum pname, GLboolean *params); extern void (APIENTRY *qglGetClipPlane) (GLenum plane, GLdouble *equation); extern void (APIENTRY *qglGetDoublev) (GLenum pname, GLdouble *params); -extern GLenum (APIENTRY *qglGetError) (void); -extern void (APIENTRY *qglGetFloatv) (GLenum pname, GLfloat *params); -extern void (APIENTRY *qglGetIntegerv) (GLenum pname, GLint *params); extern void (APIENTRY *qglGetLightfv) (GLenum light, GLenum pname, GLfloat *params); extern void (APIENTRY *qglGetLightiv) (GLenum light, GLenum pname, GLint *params); extern void (APIENTRY *qglGetMapdv) (GLenum target, GLenum query, GLdouble *v); @@ -558,7 +743,6 @@ extern void (APIENTRY *qglGetPixelMapuiv) (GLenum map, GLuint *values); extern void (APIENTRY *qglGetPixelMapusv) (GLenum map, GLushort *values); extern void (APIENTRY *qglGetPointerv) (GLenum pname, GLvoid* *params); extern void (APIENTRY *qglGetPolygonStipple) (GLubyte *mask); -extern const GLubyte * (APIENTRY *qglGetString) (GLenum name); extern void (APIENTRY *qglGetTexEnvfv) (GLenum target, GLenum pname, GLfloat *params); extern void (APIENTRY *qglGetTexEnviv) (GLenum target, GLenum pname, GLint *params); extern void (APIENTRY *qglGetTexGendv) (GLenum coord, GLenum pname, GLdouble *params); @@ -567,9 +751,6 @@ extern void (APIENTRY *qglGetTexGeniv) (GLenum coord, GLenum pname, GLint *param extern void (APIENTRY *qglGetTexImage) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); extern void (APIENTRY *qglGetTexLevelParameterfv) (GLenum target, GLint level, GLenum pname, GLfloat *params); extern void (APIENTRY *qglGetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint *params); -extern void (APIENTRY *qglGetTexParameterfv) (GLenum target, GLenum pname, GLfloat *params); -extern void (APIENTRY *qglGetTexParameteriv) (GLenum target, GLenum pname, GLint *params); -extern void (APIENTRY *qglHint) (GLenum target, GLenum mode); extern void (APIENTRY *qglIndexMask) (GLuint mask); extern void (APIENTRY *qglIndexPointer) (GLenum type, GLsizei stride, const GLvoid *pointer); extern void (APIENTRY *qglIndexd) (GLdouble c); @@ -584,9 +765,7 @@ extern void (APIENTRY *qglIndexub) (GLubyte c); extern void (APIENTRY *qglIndexubv) (const GLubyte *c); extern void (APIENTRY *qglInitNames) (void); extern void (APIENTRY *qglInterleavedArrays) (GLenum format, GLsizei stride, const GLvoid *pointer); -extern GLboolean (APIENTRY *qglIsEnabled) (GLenum cap); extern GLboolean (APIENTRY *qglIsList) (GLuint list); -extern GLboolean (APIENTRY *qglIsTexture) (GLuint texture); extern void (APIENTRY *qglLightModelf) (GLenum pname, GLfloat param); extern void (APIENTRY *qglLightModelfv) (GLenum pname, const GLfloat *params); extern void (APIENTRY *qglLightModeli) (GLenum pname, GLint param); @@ -596,7 +775,6 @@ extern void (APIENTRY *qglLightfv) (GLenum light, GLenum pname, const GLfloat *p extern void (APIENTRY *qglLighti) (GLenum light, GLenum pname, GLint param); extern void (APIENTRY *qglLightiv) (GLenum light, GLenum pname, const GLint *params); extern void (APIENTRY *qglLineStipple) (GLint factor, GLushort pattern); -extern void (APIENTRY *qglLineWidth) (GLfloat width); extern void (APIENTRY *qglListBase) (GLuint base); extern void (APIENTRY *qglLoadIdentity) (void); extern void (APIENTRY *qglLoadMatrixd) (const GLdouble *m); @@ -636,13 +814,11 @@ extern void (APIENTRY *qglPixelMapfv) (GLenum map, GLsizei mapsize, const GLfloa extern void (APIENTRY *qglPixelMapuiv) (GLenum map, GLsizei mapsize, const GLuint *values); extern void (APIENTRY *qglPixelMapusv) (GLenum map, GLsizei mapsize, const GLushort *values); extern void (APIENTRY *qglPixelStoref) (GLenum pname, GLfloat param); -extern void (APIENTRY *qglPixelStorei) (GLenum pname, GLint param); extern void (APIENTRY *qglPixelTransferf) (GLenum pname, GLfloat param); extern void (APIENTRY *qglPixelTransferi) (GLenum pname, GLint param); extern void (APIENTRY *qglPixelZoom) (GLfloat xfactor, GLfloat yfactor); extern void (APIENTRY *qglPointSize) (GLfloat size); extern void (APIENTRY *qglPolygonMode) (GLenum face, GLenum mode); -extern void (APIENTRY *qglPolygonOffset) (GLfloat factor, GLfloat units); extern void (APIENTRY *qglPolygonStipple) (const GLubyte *mask); extern void (APIENTRY *qglPopAttrib) (void); extern void (APIENTRY *qglPopClientAttrib) (void); @@ -677,8 +853,6 @@ extern void (APIENTRY *qglRasterPos4i) (GLint x, GLint y, GLint z, GLint w); extern void (APIENTRY *qglRasterPos4iv) (const GLint *v); extern void (APIENTRY *qglRasterPos4s) (GLshort x, GLshort y, GLshort z, GLshort w); extern void (APIENTRY *qglRasterPos4sv) (const GLshort *v); -extern void (APIENTRY *qglReadBuffer) (GLenum mode); -extern void (APIENTRY *qglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); extern void (APIENTRY *qglRectd) (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); extern void (APIENTRY *qglRectdv) (const GLdouble *v1, const GLdouble *v2); extern void (APIENTRY *qglRectf) (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); @@ -692,12 +866,8 @@ extern void (APIENTRY *qglRotated) (GLdouble angle, GLdouble x, GLdouble y, GLdo extern void (APIENTRY *qglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); extern void (APIENTRY *qglScaled) (GLdouble x, GLdouble y, GLdouble z); extern void (APIENTRY *qglScalef) (GLfloat x, GLfloat y, GLfloat z); -extern void (APIENTRY *qglScissor) (GLint x, GLint y, GLsizei width, GLsizei height); extern void (APIENTRY *qglSelectBuffer) (GLsizei size, GLuint *buffer); extern void (APIENTRY *qglShadeModel) (GLenum mode); -extern void (APIENTRY *qglStencilFunc) (GLenum func, GLint ref, GLuint mask); -extern void (APIENTRY *qglStencilMask) (GLuint mask); -extern void (APIENTRY *qglStencilOp) (GLenum fail, GLenum zfail, GLenum zpass); extern void (APIENTRY *qglTexCoord1d) (GLdouble s); extern void (APIENTRY *qglTexCoord1dv) (const GLdouble *v); extern void (APIENTRY *qglTexCoord1f) (GLfloat s); @@ -742,42 +912,10 @@ extern void (APIENTRY *qglTexGenfv) (GLenum coord, GLenum pname, const GLfloat * extern void (APIENTRY *qglTexGeni) (GLenum coord, GLenum pname, GLint param); extern void (APIENTRY *qglTexGeniv) (GLenum coord, GLenum pname, const GLint *params); extern void (APIENTRY *qglTexImage1D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -extern void (APIENTRY *qglTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); extern void (APIENTRY *qglTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -extern void (APIENTRY *qglTexParameterf) (GLenum target, GLenum pname, GLfloat param); -extern void (APIENTRY *qglTexParameterfv) (GLenum target, GLenum pname, const GLfloat *params); -extern void (APIENTRY *qglTexParameteri) (GLenum target, GLenum pname, GLint param); -extern void (APIENTRY *qglTexParameteriv) (GLenum target, GLenum pname, const GLint *params); extern void (APIENTRY *qglTexSubImage1D) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -extern void (APIENTRY *qglTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); extern void (APIENTRY *qglTranslated) (GLdouble x, GLdouble y, GLdouble z); extern void (APIENTRY *qglTranslatef) (GLfloat x, GLfloat y, GLfloat z); -extern void (APIENTRY *qglVertex2d) (GLdouble x, GLdouble y); -extern void (APIENTRY *qglVertex2dv) (const GLdouble *v); -extern void (APIENTRY *qglVertex2f) (GLfloat x, GLfloat y); -extern void (APIENTRY *qglVertex2fv) (const GLfloat *v); -extern void (APIENTRY *qglVertex2i) (GLint x, GLint y); -extern void (APIENTRY *qglVertex2iv) (const GLint *v); -extern void (APIENTRY *qglVertex2s) (GLshort x, GLshort y); -extern void (APIENTRY *qglVertex2sv) (const GLshort *v); -extern void (APIENTRY *qglVertex3d) (GLdouble x, GLdouble y, GLdouble z); -extern void (APIENTRY *qglVertex3dv) (const GLdouble *v); -extern void (APIENTRY *qglVertex3f) (GLfloat x, GLfloat y, GLfloat z); -extern void (APIENTRY *qglVertex3fv) (const GLfloat *v); -extern void (APIENTRY *qglVertex3i) (GLint x, GLint y, GLint z); -extern void (APIENTRY *qglVertex3iv) (const GLint *v); -extern void (APIENTRY *qglVertex3s) (GLshort x, GLshort y, GLshort z); -extern void (APIENTRY *qglVertex3sv) (const GLshort *v); -extern void (APIENTRY *qglVertex4d) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -extern void (APIENTRY *qglVertex4dv) (const GLdouble *v); -extern void (APIENTRY *qglVertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -extern void (APIENTRY *qglVertex4fv) (const GLfloat *v); -extern void (APIENTRY *qglVertex4i) (GLint x, GLint y, GLint z, GLint w); -extern void (APIENTRY *qglVertex4iv) (const GLint *v); -extern void (APIENTRY *qglVertex4s) (GLshort x, GLshort y, GLshort z, GLshort w); -extern void (APIENTRY *qglVertex4sv) (const GLshort *v); -extern void (APIENTRY *qglVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -extern void (APIENTRY *qglViewport) (GLint x, GLint y, GLsizei width, GLsizei height); #ifdef _WIN32 extern BOOL (WINAPI *qwglCopyContext)(HGLRC, HGLRC, UINT); @@ -791,34 +929,8 @@ extern BOOL (WINAPI *qwglMakeCurrent)(HDC, HGLRC); extern BOOL (WINAPI *qSwapBuffers)(HDC); #endif -extern void (APIENTRY *qglDrawRangeElements) (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); - -extern void (APIENTRY *qglGenBuffersARB)(GLsizei n, GLuint* ids); -extern void (APIENTRY *qglDeleteBuffersARB)(GLsizei n, GLuint* ids); -extern void (APIENTRY *qglBindBufferARB)(GLenum target, GLuint id); -extern void (APIENTRY *qglBufferDataARB)(GLenum target, GLsizei size, const void* data, GLenum usage); -extern void (APIENTRY *qglBufferSubDataARB)(GLenum target, GLint offset, GLsizei size, void* data); -extern void *(APIENTRY *qglMapBufferARB)(GLenum target, GLenum access); -extern GLboolean (APIENTRY *qglUnmapBufferARB)(GLenum target); - -extern void (APIENTRY *qglGenVertexArrays)(GLsizei n, GLuint *arrays); -extern void (APIENTRY *qglBindVertexArray)(GLuint vaoarray); - extern const GLubyte * (APIENTRY * qglGetStringi) (GLenum name, GLuint index); -extern void (APIENTRY *qglGenFramebuffersEXT)(GLsizei n, GLuint* ids); -extern void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids); -extern void (APIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint id); -extern void (APIENTRY *qglGenRenderbuffersEXT)(GLsizei n, GLuint* ids); -extern void (APIENTRY *qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint* ids); -extern void (APIENTRY *qglBindRenderbufferEXT)(GLenum target, GLuint id); -extern void (APIENTRY *qglRenderbufferStorageEXT)(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height); -extern void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId, GLint level); -extern void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId); -extern GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target); - -extern void (APIENTRY *qglDepthBoundsEXT) (GLclampd zmin, GLclampd zmax); - /* extern qboolean gl_arb_fragment_program; extern PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB; @@ -843,10 +955,6 @@ extern FTEPFNGLGETINFOLOGARBPROC qglGetShaderInfoLog_; extern FTEPFNGLLINKPROGRAMARBPROC qglLinkProgramARB; extern FTEPFNGLBINDATTRIBLOCATIONARBPROC qglBindAttribLocationARB; extern FTEPFNGLGETATTRIBLOCATIONARBPROC qglGetAttribLocationARB; -extern FTEPFNGLVERTEXATTRIBPOINTER qglVertexAttribPointer; -extern FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv; -extern FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray; -extern FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray; extern FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB; extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB; extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv; @@ -859,6 +967,64 @@ extern FTEPFNGLUNIFORM2FVARBPROC qglUniform2fvARB; extern FTEPFNGLUNIFORM1IARBPROC qglUniform1iARB; extern FTEPFNGLUNIFORM1FARBPROC qglUniform1fARB; +extern FTEPFNGLLOCKARRAYSEXTPROC qglLockArraysEXT; +extern FTEPFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT; + +typedef void (APIENTRY *lpMTexFUNC) (GLenum en, GLfloat f1, GLfloat f2); +typedef void (APIENTRY *lpSelTexFUNC) (GLenum en); +extern lpMTexFUNC qglMTexCoord2fSGIS; +extern lpSelTexFUNC qglSelectTextureSGIS; + +//these functions are not available in gles2, for one reason or another +extern void (APIENTRY *qglBegin) (GLenum mode); +extern void (APIENTRY *qglVertex2d) (GLdouble x, GLdouble y); +extern void (APIENTRY *qglVertex2dv) (const GLdouble *v); +extern void (APIENTRY *qglVertex2f) (GLfloat x, GLfloat y); +extern void (APIENTRY *qglVertex2fv) (const GLfloat *v); +extern void (APIENTRY *qglVertex2i) (GLint x, GLint y); +extern void (APIENTRY *qglVertex2iv) (const GLint *v); +extern void (APIENTRY *qglVertex2s) (GLshort x, GLshort y); +extern void (APIENTRY *qglVertex2sv) (const GLshort *v); +extern void (APIENTRY *qglVertex3d) (GLdouble x, GLdouble y, GLdouble z); +extern void (APIENTRY *qglVertex3dv) (const GLdouble *v); +extern void (APIENTRY *qglVertex3f) (GLfloat x, GLfloat y, GLfloat z); +extern void (APIENTRY *qglVertex3fv) (const GLfloat *v); +extern void (APIENTRY *qglVertex3i) (GLint x, GLint y, GLint z); +extern void (APIENTRY *qglVertex3iv) (const GLint *v); +extern void (APIENTRY *qglVertex3s) (GLshort x, GLshort y, GLshort z); +extern void (APIENTRY *qglVertex3sv) (const GLshort *v); +extern void (APIENTRY *qglVertex4d) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +extern void (APIENTRY *qglVertex4dv) (const GLdouble *v); +extern void (APIENTRY *qglVertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +extern void (APIENTRY *qglVertex4fv) (const GLfloat *v); +extern void (APIENTRY *qglVertex4i) (GLint x, GLint y, GLint z, GLint w); +extern void (APIENTRY *qglVertex4iv) (const GLint *v); +extern void (APIENTRY *qglVertex4s) (GLshort x, GLshort y, GLshort z, GLshort w); +extern void (APIENTRY *qglVertex4sv) (const GLshort *v); +extern void (APIENTRY *qglEnd) (void); +extern void (APIENTRY *qglReadBuffer) (GLenum mode); + +//misc extensions +extern FTEPFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT; +extern void (APIENTRY *qglDepthBoundsEXT) (GLclampd zmin, GLclampd zmax); + +extern void (APIENTRY *qglDrawRangeElements) (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +extern void (APIENTRY *qglEnableClientState) (GLenum array); +extern void (APIENTRY *qglVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + +extern void (APIENTRY *qglGenBuffersARB)(GLsizei n, GLuint* ids); +extern void (APIENTRY *qglDeleteBuffersARB)(GLsizei n, GLuint* ids); +extern void (APIENTRY *qglBindBufferARB)(GLenum target, GLuint id); +extern void (APIENTRY *qglBufferDataARB)(GLenum target, GLsizei size, const void* data, GLenum usage); +extern void (APIENTRY *qglBufferSubDataARB)(GLenum target, GLint offset, GLsizei size, void* data); +extern void *(APIENTRY *qglMapBufferARB)(GLenum target, GLenum access); +extern GLboolean (APIENTRY *qglUnmapBufferARB)(GLenum target); + +extern void (APIENTRY *qglGenVertexArrays)(GLsizei n, GLuint *arrays); +extern void (APIENTRY *qglBindVertexArray)(GLuint vaoarray); + + + //glslang helper api GLhandleARB GLSlang_CreateProgram(char *name, int ver, char **precompilerconstants, char *vert, char *frag, qboolean silent); GLint GLSlang_GetUniformLocation (int prog, char *name); @@ -880,8 +1046,6 @@ void GL_SelectProgram(int program); -extern FTEPFNGLLOCKARRAYSEXTPROC qglLockArraysEXT; -extern FTEPFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT; void GL_Init(void *(*getglfunction) (char *name)); diff --git a/engine/http/ftpserver.c b/engine/http/ftpserver.c index ebc5b7ce..c2f5de66 100644 --- a/engine/http/ftpserver.c +++ b/engine/http/ftpserver.c @@ -57,7 +57,11 @@ int FTP_BeginListening(int aftype, int port) int i; int sock; +#ifdef IPPROTO_IPV6 if ((sock = socket ((aftype!=1)?PF_INET6:PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) +#else + if ((sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) +#endif { IWebPrintf ("FTP_BeginListening: socket: %s\n", strerror(qerrno)); return INVALID_SOCKET; @@ -69,24 +73,8 @@ int FTP_BeginListening(int aftype, int port) return INVALID_SOCKET; } - if (aftype == 1) - { - //1=ipv4 only - ((struct sockaddr_in*)&address)->sin_family = AF_INET; - //ZOID -- check for interface binding option - if ((i = COM_CheckParm("-ip")) != 0 && i < com_argc) { - ((struct sockaddr_in*)&address)->sin_addr.s_addr = inet_addr(com_argv[i+1]); - Con_TPrintf(TL_NETBINDINTERFACE, - inet_ntoa(((struct sockaddr_in*)&address)->sin_addr)); - } else - ((struct sockaddr_in*)&address)->sin_addr.s_addr = INADDR_ANY; - - if (port == PORT_ANY) - ((struct sockaddr_in*)&address)->sin_port = 0; - else - ((struct sockaddr_in*)&address)->sin_port = htons((short)port); - } - else +#ifdef IPPROTO_IPV6 + if (aftype != 1) { //0=ipv4+ipv6 //2=ipv6 only @@ -107,6 +95,24 @@ int FTP_BeginListening(int aftype, int port) else ((struct sockaddr_in6*)&address)->sin6_port = htons((short)port); } + else +#endif + { + //1=ipv4 only + ((struct sockaddr_in*)&address)->sin_family = AF_INET; + //ZOID -- check for interface binding option + if ((i = COM_CheckParm("-ip")) != 0 && i < com_argc) { + ((struct sockaddr_in*)&address)->sin_addr.s_addr = inet_addr(com_argv[i+1]); + Con_TPrintf(TL_NETBINDINTERFACE, + inet_ntoa(((struct sockaddr_in*)&address)->sin_addr)); + } else + ((struct sockaddr_in*)&address)->sin_addr.s_addr = INADDR_ANY; + + if (port == PORT_ANY) + ((struct sockaddr_in*)&address)->sin_port = 0; + else + ((struct sockaddr_in*)&address)->sin_port = htons((short)port); + } if( bind (sock, (void *)&address, sizeof(address)) == -1) { diff --git a/engine/qclib/comprout.c b/engine/qclib/comprout.c index a5efa169..0637e22b 100644 --- a/engine/qclib/comprout.c +++ b/engine/qclib/comprout.c @@ -17,7 +17,7 @@ void QCC_PR_ResetErrorScope(void); -#ifdef MINIMAL +#if defined(MINIMAL) || defined(OMIT_QCC) #else @@ -157,7 +157,7 @@ int PDECL Comp_Continue(pubprogfuncs_t *progfuncs) #endif pbool CompileFile(progfuncs_t *progfuncs, char *filename) { -#ifdef MINIMAL +#if defined(MINIMAL) || defined(OMIT_QCC) return false; #else char srcfile[32]; diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index 062b3e77..5712fdc7 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -1021,7 +1021,7 @@ pubprogfuncs_t deffuncs = { NULL, //progstate PR_FindFunc, -#ifdef MINIMAL +#if defined(MINIMAL) || defined(OMIT_QCC) NULL, NULL, #else @@ -1055,7 +1055,7 @@ pubprogfuncs_t deffuncs = { PR_ToggleBreakpoint, 0, //numprogs NULL, //parms -#ifdef MINIMAL +#if defined(MINIMAL) || defined(OMIT_QCC) NULL, //decompile #else QC_Decompile, diff --git a/engine/qclib/pr_exec.c b/engine/qclib/pr_exec.c index 8c29928e..7d3bfb77 100644 --- a/engine/qclib/pr_exec.c +++ b/engine/qclib/pr_exec.c @@ -54,7 +54,7 @@ static void PR_PrintStatement (progfuncs_t *progfuncs, int statementnum) break; } -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) if ( (unsigned)op < OP_NUMOPS) { int i; @@ -146,7 +146,7 @@ void PDECL PR_GenerateStatementString (pubprogfuncs_t *ppf, int statementnum, ch out += strlen(out); } -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) if ( (unsigned)op < OP_NUMOPS) { int i; diff --git a/engine/qclib/qcc_cmdlib.c b/engine/qclib/qcc_cmdlib.c index ef751cef..afcd9e2b 100644 --- a/engine/qclib/qcc_cmdlib.c +++ b/engine/qclib/qcc_cmdlib.c @@ -134,7 +134,7 @@ void SetEndian(void) -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) /* ================ I_FloatTime @@ -453,7 +453,7 @@ char *VARGS qcva (char *text, ...) } -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) char *QC_strupr (char *start) { diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index e3f5308e..87fe1df9 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -1,4 +1,4 @@ -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) #include "qcc.h" void QCC_PR_ParseAsm(void); diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 61e0e261..4e9094f3 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -1,4 +1,4 @@ -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) #include "qcc.h" #ifdef QCC diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index 69e93c7a..d8373b28 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -1,4 +1,4 @@ -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) #define PROGSUSED #include "qcc.h" diff --git a/engine/qclib/qcd_main.c b/engine/qclib/qcd_main.c index e38588d5..1647b124 100644 --- a/engine/qclib/qcd_main.c +++ b/engine/qclib/qcd_main.c @@ -85,7 +85,7 @@ char *QC_decode(progfuncs_t *progfuncs, int complen, int len, int method, char * return buffer; } -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) void SafeWrite(int hand, void *buf, long count); int SafeSeek(int hand, int ofs, int mode); //we are allowed to trash our input here. diff --git a/engine/qclib/qcdecomp.c b/engine/qclib/qcdecomp.c index b1e80d8b..9a9b3c72 100644 --- a/engine/qclib/qcdecomp.c +++ b/engine/qclib/qcdecomp.c @@ -1,4 +1,4 @@ -#ifndef MINIMAL +#if !defined(MINIMAL) && !defined(OMIT_QCC) #include "progsint.h" #include "setjmp.h"