Added x11 unicode input support. Added wayland support (FTE_TARGET=linux-wayland). Added properly support for rpi+egl (FTE_TARGET=linux-rpi, warning: expects to cross-compile).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4622 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-03-30 00:39:37 +00:00
parent 4499164f27
commit 7e80062ab9
37 changed files with 1882 additions and 1163 deletions

View file

@ -685,7 +685,7 @@ GLCL_DIR=glcl_$(FTE_FULLTARGET)
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(SERVERONLY_OBJS)
SV_EXE_NAME=../fteqw_sv$(FTE_FULLTARGET)
SV_CFLAGS=$(SERVER_ONLY_CFLAGS)
SV_LDFLAGS=-lz
SV_LDFLAGS=
MINGL_DIR=mingl_$(FTE_FULLTARGET)
MINGL_EXE_NAME=../fteqw_mingl$(FTE_FULLTARGET)
@ -693,7 +693,7 @@ MINGL_EXE_NAME=../fteqw_mingl$(FTE_FULLTARGET)
MB_DIR=m_$(FTE_FULLTARGET)
M_EXE_NAME=../fteqw_$(FTE_FULLTARGET)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o
M_CFLAGS=$(GLCFLAGS) `$(SDLCONFIG) --cflags` -D_MERGED_SDL
M_CFLAGS=$(GLCFLAGS) `$(SDLCONFIG) --cflags`
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS)
ifdef windir
@ -703,6 +703,13 @@ else
M_LDFLAGS=$(MLDFLAGS) `$(SDLCONFIG) --libs` $(IMAGELDFLAGS) $(OGGVORBISLDFLAGS)
endif
ifeq (,$(findstring NO_ZLIB,$(CFLAGS)))
SV_LDFLAGS+=-lz
GL_LDFLAGS+=-lz
M_LDFLAGS+=-lz
endif
#specific targets override those defaults as needed.
#google native client
@ -1007,11 +1014,10 @@ ifeq ($(FTE_TARGET),bsd)
MINGL_EXE_NAME=../fteqw.mingl
MINGL_DIR=mingl_bsd
endif
ifneq ($(shell echo $(FTE_TARGET)|grep linux),)
ifneq (,$(findstring linux,$(FTE_TARGET)))
SV_DIR=sv_linux$(BITS)
SV_LDFLAGS=-lz
SV_EXE_NAME=../fteqw.sv$(BITS)
SV_LDFLAGS=
NPFTE_OBJS=httpclient.o image.o sys_linux_threads.o sys_npfte.o sys_axfte.o sys_plugfte.o
NPFTE_DLL_NAME=../npfte$(BITS).so
@ -1022,25 +1028,49 @@ ifneq ($(shell echo $(FTE_TARGET)|grep linux),)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o gl_videgl.o snd_alsa.o snd_linux.o cd_linux.o sys_linux.o sys_linux_threads.o
GL_EXE_NAME=../fteqw.gl$(BITS)
GLCL_EXE_NAME=../fteqwcl.gl$(BITS)
GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(OGGVORBISLDFLAGS) -lz
GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(OGGVORBISLDFLAGS)
GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(SPEEXCFLAGS) -DMULTITHREAD -DLIBVORBISFILE_STATIC -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG
GLB_DIR=gl_linux$(BITS)
GLCL_DIR=glcl_linux$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o snd_linux.o snd_alsa.o cd_linux.o sys_linux.o sys_linux_threads.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o gl_videgl.o snd_linux.o snd_alsa.o cd_linux.o sys_linux.o sys_linux_threads.o
M_EXE_NAME=../fteqw$(BITS)
MCL_EXE_NAME=../fteqwcl$(BITS)
M_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(OGGVORBISLDFLAGS) -lz
M_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(SPEEXCFLAGS) -DLIBVORBISFILE_STATIC -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG
M_LDFLAGS=$(GL_LDFLAGS)
M_CFLAGS=$(GL_CFLAGS)
MB_DIR=m_linux$(BITS)
MCL_DIR=mcl_linux$(BITS)
IMAGELDFLAGS=
ifeq (,$(findstring NO_ZLIB,$(CFLAGS)))
SV_LDFLAGS+= -lz
GL_LDFLAGS+= -lz
M_LDFLAGS+= -lz
endif
MINGL_EXE_NAME=../fteqw.mingl$(BITS)
MINGL_DIR=mingl_linux$(BITS)
endif
ifneq (,$(findstring rpi,$(FTE_TARGET)))
#These next two lines enable cross compiling. If you're compiling natively you can just kill the two.
RPI_SYSROOT:=$(realpath $(shell echo ~)/rpi/rpi-sysroot/)
CC=~/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$(RPI_SYSROOT)
SDLCONFIG=$(RPI_SYSROOT)/usr/bin/sdl-config --prefix=$(RPI_SYSROOT)/usr
GL_CFLAGS+= -I$(RPI_SYSROOT)/opt/vc/include -I$(RPI_SYSROOT)/opt/vc/include/interface/vmcs_host/linux -I$(RPI_SYSROOT)/opt/vc/include/interface/vcos/pthreads -DFTE_RPI -DUSE_EGL
GL_LDFLAGS+= -L$(RPI_SYSROOT)/opt/vc/lib -Wl,--sysroot=$(RPI_SYSROOT),-rpath=/opt/vc/lib,-rpath-link=$(RPI_SYSROOT)/opt/vc/lib -lbcm_host
GLCL_OBJS+=gl_vidrpi.o
endif
ifneq (,$(findstring wayland,$(FTE_TARGET)))
GL_CFLAGS+=-DUSE_EGL
GLCL_OBJS+=gl_vidwayland.o
GL_LDFLAGS+=-lwayland-client -lwayland-egl
endif
ifneq (,$(findstring fbdev,$(FTE_TARGET)))
GL_CFLAGS+=-DUSE_EGL
GLCL_OBJS+=gl_vidfbdev.o
endif
ifneq ($(shell echo $(FTE_TARGET)|grep macosx),)
SV_DIR=sv_macosx$(EXTENSION)$(BITS)
@ -1162,8 +1192,8 @@ ifeq ($(FTE_TARGET),web)
JSLIBS=--js-library web/ftejslib.js -s DISABLE_GL_EMULATION=1
EMCC_ARGS=$(JSLIBS) $(WEB_PREJS) --shell-file web/fteshell.html -s ERROR_ON_UNDEFINED_SYMBOLS=1
RELEASE_CFLAGS=-DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB
DEBUG_CFLAGS=-g --jcache -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB
RELEASE_LDFLAGS=-s ASM_JS=1 -O1 -s TOTAL_MEMORY=$(ASMJS_MEMORY) $(EMCC_ARGS)
DEBUG_CFLAGS=-g -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB
RELEASE_LDFLAGS=-s ASM_JS=1 -O2 -s TOTAL_MEMORY=$(ASMJS_MEMORY) $(EMCC_ARGS)
# RELEASE_LDFLAGS=-s ASM_JS=0 -O1 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_ARGS)
DEBUG_LDLAGS=-O0 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_ARGS)
CC=emcc
@ -1311,7 +1341,7 @@ PRECOMPHEADERS ?= $(OUT_DIR)/quakedef.h.gch
#god knows how gcc loads the list properly.
#or at least I hope he does. It makes no sence to mortals.
DO_LD ?= $(CC) -o $@ $(LTO_LD) $(WCFLAGS) $(CFLAGS)
DO_LD ?= $(DO_ECHO) $(CC) -o $@ $(LTO_LD) $(WCFLAGS) $(CFLAGS)
$(OUT_DIR)/$(EXE_NAME): $(PRECOMPHEADERS) $(foreach fn, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol))),$(if $(findstring ltox,$(fn)),,$(OUT_DIR)/$(fn)))
$(DO_LD) $(foreach fn, $(CUSTOMOBJS) $(foreach ol, $(OBJS) $(LTO_END), $($(ol))),$(if $(findstring ltox,$(fn)),$(subst ltox,-x ,$(fn)),$(NATIVE_OUT_DIR)/$(fn)) ) $(LDFLAGS)

View file

@ -1383,7 +1383,7 @@ void SCR_SetLoadingFile(char *str)
}
}
void SCR_DrawLoading (void)
void SCR_DrawLoading (qboolean opaque)
{
int sizex, x, y;
mpic_t *pic;
@ -1399,6 +1399,8 @@ void SCR_DrawLoading (void)
R2D_ImageColours(1, 1, 1, 1);
R2D_ScalePic (0, 0, vid.width, vid.height, pic);
}
else if (opaque)
R2D_ConsoleBackground (0, vid.height, true);
qdepth = COM_FDepthFile("gfx/loading.lmp", true);
h2depth = COM_FDepthFile("gfx/menu/loading.lmp", true);
@ -1606,7 +1608,7 @@ void SCR_ImageName (char *mapname)
scr_disabled_for_loading = false;
scr_drawloading = true;
GL_BeginRendering ();
SCR_DrawLoading();
SCR_DrawLoading(false);
SCR_SetUpToDrawConsole();
if (Key_Dest_Has(kdm_console) || !*levelshotname)
SCR_DrawConsole(!!*levelshotname);
@ -2163,7 +2165,7 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
if (scr_drawloading || loading_stage)
{
SCR_DrawLoading();
SCR_DrawLoading(false);
SCR_ShowPics_Draw();
}

View file

@ -910,7 +910,6 @@ void VARGS Con_DPrintf (const char *fmt, ...)
{
va_list argptr;
char msg[MAXPRINTMSG];
extern cvar_t log_developer;
#ifdef CRAZYDEBUGGING
va_start (argptr,fmt);
@ -919,6 +918,7 @@ void VARGS Con_DPrintf (const char *fmt, ...)
Sys_Printf("%s", msg);
return;
#else
extern cvar_t log_developer;
if (!developer.value && !log_developer.value)
return; // early exit
#endif

View file

@ -309,9 +309,10 @@ typedef struct rendererinfo_s {
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
void (*VID_DeInit) (void);
void (*VID_SwapBuffers) (void); //force a buffer swap, regardless of what's displayed.
qboolean (*VID_ApplyGammaRamps) (unsigned short *ramps);
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
void (*VID_SetWindowCaption) (char *msg);
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
void (*SCR_UpdateScreen) (void);
@ -349,6 +350,8 @@ typedef struct rendererinfo_s {
#define rf currentrendererstate.renderer
#define VID_SwapBuffers rf->VID_SwapBuffers
#define R_LoadTexture rf->IMG_LoadTexture
#define R_LoadTexture8Pal24 rf->IMG_LoadTexture8Pal24
#define R_LoadTexture8Pal32 rf->IMG_LoadTexture8Pal32

View file

@ -229,7 +229,7 @@ void R2D_Init(void)
"blendfunc blend\n"
"}\n"
"}\n");
shader_contrastup = R_RegisterShader("constrastupshader", SUF_NONE,
shader_contrastup = R_RegisterShader("contrastupshader", SUF_NONE,
"{\n"
"program defaultfill\n"
"{\n"
@ -241,7 +241,7 @@ void R2D_Init(void)
"}\n"
"}\n"
);
shader_contrastdown = R_RegisterShader("constrastdownshader", SUF_NONE,
shader_contrastdown = R_RegisterShader("contrastdownshader", SUF_NONE,
"{\n"
"program defaultfill\n"
"{\n"
@ -938,6 +938,7 @@ void R2D_BrightenScreen (void)
if (r2d_canhwgamma)
return;
TRACE(("R2D_BrightenScreen: brightening\n"));
if (v_gamma.value != 1 && shader_gammacb->prog)
{
//this should really be done properly, with render-to-texture

View file

@ -795,11 +795,10 @@ rendererinfo_t dedicatedrendererinfo = {
NULL, //VID_Init,
NULL, //VID_DeInit,
NULL, //VID_SwapBuffers
NULL, //VID_ApplyGammaRamps,
NULL, //VID_GetRGBInfo,
NULL, //set caption
NULL, //VID_GetRGBInfo,
NULL, //SCR_UpdateScreen;
@ -832,6 +831,9 @@ rendererinfo_t *pdedicatedrendererinfo = &dedicatedrendererinfo;
#ifdef GLQUAKE
extern rendererinfo_t openglrendererinfo;
rendererinfo_t eglrendererinfo;
extern rendererinfo_t rpirendererinfo;
rendererinfo_t waylandrendererinfo;
rendererinfo_t fbdevrendererinfo;
#endif
#ifdef D3DQUAKE
rendererinfo_t d3d9rendererinfo;
@ -847,8 +849,13 @@ rendererinfo_t *rendererinfo[] =
&dedicatedrendererinfo,
#endif
#ifdef GLQUAKE
#ifdef FTE_RPI
&rpirendererinfo,
#endif
&openglrendererinfo,
&eglrendererinfo,
&waylandrendererinfo,
&fbdevrendererinfo,
#endif
#ifdef D3DQUAKE
&d3d9rendererinfo,

View file

@ -55,7 +55,7 @@ void SCR_ImageName (char *mapname);
void RSpeedShow(void);
void SCR_CrosshairPosition(playerview_t *pview, float *x, float *y);
void SCR_DrawLoading (void);
void SCR_DrawLoading (qboolean opaque);
void SCR_TileClear (void);
void SCR_DrawNotifyString (void);
void SCR_CheckDrawCenterString (void);

View file

@ -201,6 +201,8 @@ void Sys_Printf (char *fmt, ...)
putc(tab[w&31], stdout);
}
}
else if (w < ' ' && w != '\t' && w != '\r' && w != '\n')
putc('?', stdout); //don't let anyone print escape codes or other things that could crash an xterm.
else
{
/*putwc doesn't like me. force it in utf8*/
@ -731,7 +733,6 @@ int main (int c, const char **v)
{
double time, oldtime, newtime;
quakeparms_t parms;
int j;
// char cwd[1024];
char bindir[1024];

View file

@ -547,7 +547,7 @@ void Validation_Apply_Ruleset(void)
}
if (!rs->rulesetname)
{
Con_Printf("Cannot apply ruleset %s - not recognised\n", rs->rulesetname);
Con_Printf("Cannot apply ruleset %s - not recognised\n", ruleset.string);
return;
}

View file

@ -102,8 +102,9 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette);
// sets the mode; only used by the Quake engine for resetting to mode 0 (the
// base mode) on memory allocation failures
qboolean GLVID_Is8bit();
qboolean GLVID_Is8bit(void);
void GLVID_SwapBuffers(void);
char *GLVID_GetRGBInfo(int prepadbytes, int *truewidth, int *trueheight);
void GLVID_SetCaption(char *caption);
#endif

View file

@ -590,11 +590,11 @@ void COM_Locate_f (void)
{
if (!*loc.rawname)
{
Con_Printf("File is %i bytes compressed inside %s\n", loc.len, loc.search->logicalpath);
Con_Printf("File is %u bytes compressed inside %s\n", (unsigned)loc.len, loc.search->logicalpath);
}
else
{
Con_Printf("Inside %s (%i bytes)\n %s\n", loc.rawname, loc.len, loc.search->logicalpath);
Con_Printf("Inside %s (%u bytes)\n %s\n", loc.rawname, (unsigned)loc.len, loc.search->logicalpath);
}
}
else

View file

@ -300,7 +300,7 @@ static void QDECL FSSTDIO_ReadFile(searchpathfuncs_t *handle, flocation_t *loc,
result = fread(buffer, 1, loc->len, f); // do soemthing with result
if (result != loc->len)
Con_Printf("FSSTDIO_ReadFile() fread: Filename: %s, expected %i, result was %u (%s)\n",loc->rawname,loc->len,(unsigned int)result,strerror(errno));
Con_Printf("FSSTDIO_ReadFile() fread: Filename: %s, expected %u, result was %u (%s)\n",loc->rawname,(unsigned int)loc->len,(unsigned int)result,strerror(errno));
fclose(f);
}

View file

@ -358,15 +358,15 @@ static int QDECL SSL_Write(struct vfsfile_s *f, const void *buffer, int bytestow
return -1; //closed by remote connection.
return written;
}
static qboolean QDECL SSL_Seek (struct vfsfile_s *file, unsigned long pos)
static qboolean QDECL SSL_Seek (struct vfsfile_s *file, qofs_t pos)
{
return false;
}
static unsigned long QDECL SSL_Tell (struct vfsfile_s *file)
static qofs_t QDECL SSL_Tell (struct vfsfile_s *file)
{
return 0;
}
static unsigned long QDECL SSL_GetLen (struct vfsfile_s *file)
static qofs_t QDECL SSL_GetLen (struct vfsfile_s *file)
{
return 0;
}

View file

@ -2657,7 +2657,6 @@ static void BE_SubmitMeshChain(void)
break;
}
}
qglDrawRangeElements(batchtype, startv, endv, endi-starti, GL_INDEX_TYPE, (index_t*)shaderstate.sourcevbo->indicies.gl.addr + starti);
RQuantAdd(RQUANT_DRAWS, 1);
}
@ -4864,7 +4863,6 @@ void GLBE_DrawWorld (qboolean drawworld, qbyte *vis)
if (!r_refdef.recurse)
{
GL_DoSwap();
if (shaderstate.wbatch + 50 > shaderstate.maxwbatches)
{
int newm = shaderstate.wbatch + 100;

View file

@ -513,7 +513,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
TRACE(("dbg: GLDraw_ReInit: GL_EndRendering\n"));
GL_EndRendering ();
GL_DoSwap();
VID_SwapBuffers();
GL_SetupSceneProcessingTextures();

View file

@ -997,7 +997,6 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist[2],
//transform the old surface plane into the new view matrix
if (Matrix4_Invert(r_refdef.m_view, ivmat))
{
extern cvar_t temp1;
Matrix4_Multiply(ivmat, vmat, trmat);
plane.normal[0] = -(oplane.normal[0] * trmat[0] + oplane.normal[1] * trmat[1] + oplane.normal[2] * trmat[2]);
plane.normal[1] = -(oplane.normal[0] * trmat[4] + oplane.normal[1] * trmat[5] + oplane.normal[2] * trmat[6]);
@ -1465,8 +1464,6 @@ void GLR_RenderView (void)
checkglerror();
GL_DoSwap();
if (r_norefresh.value || !vid.pixelwidth || !vid.pixelheight)
return;

View file

@ -584,21 +584,18 @@ void GLR_TimeRefresh_f (void)
if (frames < 1)
frames = 128;
#if defined(_WIN32) && !defined(FTE_SDL)
if (finish == 2)
{
extern HDC maindc;
qglFinish ();
start = Sys_DoubleTime ();
for (i=0 ; i<frames ; i++)
{
r_refdef.viewangles[1] = i/(float)frames*360.0;
R_RenderView ();
qSwapBuffers(maindc);
VID_SwapBuffers();
}
}
else
#endif
{
if (qglDrawBuffer)
qglDrawBuffer (GL_FRONT);
@ -621,7 +618,7 @@ void GLR_TimeRefresh_f (void)
if (qglDrawBuffer)
qglDrawBuffer (GL_BACK);
GL_EndRendering ();
GL_DoSwap();
VID_SwapBuffers();
}
#endif

View file

@ -85,10 +85,10 @@ void GLSCR_UpdateScreen (void)
{
GL_BeginRendering ();
scr_drawloading = true;
SCR_DrawLoading ();
SCR_DrawLoading (true);
scr_drawloading = false;
GL_EndRendering ();
GL_DoSwap();
VID_SwapBuffers();
RSpeedEnd(RSPEED_TOTALREFRESH);
return;
}
@ -123,7 +123,7 @@ void GLSCR_UpdateScreen (void)
if (key_dest_mask & kdm_console)
Con_DrawConsole(vid.height/2, false);
GL_EndRendering ();
GL_DoSwap();
VID_SwapBuffers();
RSpeedEnd(RSPEED_TOTALREFRESH);
return;
}
@ -137,8 +137,8 @@ void GLSCR_UpdateScreen (void)
#endif
R2D_BrightenScreen();
GL_EndRendering ();
GL_DoSwap();
GL_Set2D (false);
VID_SwapBuffers();
RSpeedEnd(RSPEED_TOTALREFRESH);
return;
}
@ -161,18 +161,17 @@ void GLSCR_UpdateScreen (void)
nohud = true;
else
#endif
{
if (uimenu != 1)
{
if (r_worldentity.model && cls.state == ca_active)
V_RenderView ();
else
{
GL_DoSwap();
noworld = true;
}
}
else
GL_DoSwap();
}
GL_Set2D (false);
@ -206,6 +205,7 @@ void GLSCR_UpdateScreen (void)
RSpeedRemark();
GL_EndRendering ();
VID_SwapBuffers();
RSpeedEnd(RSPEED_FINISH);
}

View file

@ -222,15 +222,14 @@ FTEPFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
#define DEBUG
#endif
#if defined(DEBUG)
#ifndef GL_ARB_debug_output
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,
//always defining this, my system headers use void instead of GLvoid which results in gcc warnings.
typedef void (APIENTRY *qGLDEBUGPROCARB)(GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
GLvoid* userParam);
#endif
void (APIENTRY *qglDebugMessageControlARB)(GLenum source,
GLenum type,
GLenum severity,
@ -243,7 +242,7 @@ void (APIENTRY *qglDebugMessageInsertARB)(GLenum source,
GLenum severity,
GLsizei length,
const char* buf);
void (APIENTRY *qglDebugMessageCallbackARB)(GLDEBUGPROCARB callback,
void (APIENTRY *qglDebugMessageCallbackARB)(qGLDEBUGPROCARB callback,
void* userParam);
GLuint (APIENTRY *qglGetDebugMessageLogARB)(GLuint count,
GLsizei bufsize,
@ -254,6 +253,7 @@ GLuint (APIENTRY *qglGetDebugMessageLogARB)(GLuint count,
GLsizei* lengths,
char* messageLog);
#ifndef GL_ARB_debug_output
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
@ -276,6 +276,7 @@ GLuint (APIENTRY *qglGetDebugMessageLogARB)(GLuint count,
#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
#endif
void (APIENTRY myGLDEBUGPROCAMD)(GLenum source,
@ -480,7 +481,9 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
#define GL_CONTEXT_FLAGS 0x821E
#ifndef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
#endif
qglGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
if (!profile)
@ -627,6 +630,13 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
#ifndef qglActiveTextureARB
if (!qglActiveTextureARB || !qglClientActiveTextureARB || !qglMultiTexCoord2fARB)
gl_mtexable = false;
else if (gl_mtexarbable == 1)
{
Con_Printf("OpenGL Driver Bug detected: 1 texture is NOT multitexture\n");
gl_mtexable = false;
}
if (!gl_mtexable)
{
qglActiveTextureARB = NULL;
qglClientActiveTextureARB = NULL;
@ -663,7 +673,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
#ifndef GL_STATIC
qglStencilOpSeparateATI = NULL;
if ((gl_config.gles && gl_config.glversion >= 2) || gl_config.glversion >= 3) //theoretically that should be a 2 not 3.
if ((gl_config.gles && gl_config.glversion >= 2) || (!gl_config.gles && 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");
@ -890,14 +900,16 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
qglGenVertexArrays = NULL;
qglBindVertexArray = NULL;
}
else if (gl_config.glversion >= 3)
else if (gl_config.glversion >= 3 && !gl_config.gles)
{
/*yay core!*/
Con_Printf("Using vao (core)\n");
qglGenVertexArrays = (void *)getglext("glGenVertexArrays");
qglBindVertexArray = (void *)getglext("glBindVertexArray");
}
else if (GL_CheckExtension("GL_ARB_vertex_array_object"))
{
Con_Printf("Using vao (extension)\n");
qglGenVertexArrays = (void *)getglext("glGenVertexArraysARB");
qglBindVertexArray = (void *)getglext("glBindVertexArrayARB");
}
@ -1868,7 +1880,7 @@ void DumpGLState(void)
GLint glint;
GLint glint4[4];
if (qglGetVertexAttribiv)
// if (qglGetVertexAttribiv)
{
qglGetIntegerv(GL_VERTEX_ARRAY_BINDING, &rval);
Sys_Printf("VERTEX_ARRAY_BINDING: %i\n", rval);
@ -1920,6 +1932,7 @@ void DumpGLState(void)
Sys_Printf("GL_VERTEX_ARRAY: %s %i:%p\n", qglIsEnabled(GL_VERTEX_ARRAY)?"en":"dis", rval, ptr);
}
if (qglGetVertexAttribiv)
for (i = 0; i < 16; i++)
{
int en, bo, as, st, ty, no;
@ -2019,10 +2032,10 @@ rendererinfo_t openglrendererinfo = {
GLVID_Init,
GLVID_DeInit,
GLVID_SwapBuffers,
GLVID_ApplyGammaRamps,
GLVID_GetRGBInfo,
GLVID_SetCaption, //setcaption
GLVID_GetRGBInfo,
GLSCR_UpdateScreen,

View file

@ -36,10 +36,7 @@ void *GLES_GetSymbol(char *symname)
}
#if 1
void GL_BeginRendering(void)
{
}
void GL_EndRendering (void)
void GLVID_SwapBuffers(void)
{
}
void GLVID_DeInit(void)
@ -174,20 +171,12 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
return true;
}
void GL_BeginRendering(void)
{
}
void GL_EndRendering (void)
void GLVID_SwapBuffers(void)
{
eglSwapBuffers(sys_display, sys_surface);
}
#endif
void GL_DoSwap(void)
{
}
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps)
{
return false;

View file

@ -150,15 +150,13 @@ void EGL_Shutdown(void)
eglsurf = EGL_NO_SURFACE;
}
void EGL_BeginRendering (void)
{
}
void EGL_EndRendering (void)
void EGL_SwapBuffers (void)
{
TRACE(("EGL_SwapBuffers\n"));
TRACE(("swapping buffers\n"));
qeglSwapBuffers(egldpy, eglsurf);
/* TODO: check result? */
TRACE(("EGL_SwapBuffers done\n"));
}
qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindowType window, EGLNativeDisplayType dpy)
@ -168,11 +166,15 @@ qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindo
EGLint major, minor;
EGLint attrib[] =
{
EGL_BUFFER_SIZE, info->bpp,
EGL_SAMPLES, info->multisample,
EGL_STENCIL_SIZE, 8,
EGL_ALPHA_MASK_SIZE, 8,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
// EGL_BUFFER_SIZE, info->bpp,
// EGL_SAMPLES, info->multisample,
// EGL_STENCIL_SIZE, 8,
EGL_ALPHA_MASK_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
@ -218,10 +220,16 @@ qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindo
return false;
}
if (!numconfig)
{
Con_Printf(CON_ERROR "EGL: no configs!\n");
return false;
}
eglsurf = qeglCreateWindowSurface(egldpy, cfg, window, NULL);
if (eglsurf == EGL_NO_SURFACE)
{
Con_Printf(CON_ERROR "EGL: no surface!\n");
Con_Printf(CON_ERROR "EGL: eglCreateWindowSurface failed: %x\n", qeglGetError());
return false;
}

View file

@ -10,8 +10,7 @@ void *EGL_Proc(char *f);
void EGL_UnloadLibrary(void);
qboolean EGL_LoadLibrary(char *driver);
void EGL_Shutdown(void);
void EGL_BeginRendering (void);
void EGL_EndRendering (void);
void EGL_SwapBuffers (void);
qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindowType window, EGLNativeDisplayType dpy);
#endif

View file

@ -18,6 +18,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
Small note: anything concerning EGL in here is specific to egl-with-x11.
if you want egl-with-framebuffer, look elsewhere.
*/
/*
X11 is a huge pile of shit. I don't mean just the old x11 protocol, but all the _current_ standards that don't even try to fix the issues too.
@ -52,12 +57,12 @@ none of these issues will be fixed by a compositing window manager, because ther
#include "quakedef.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include "glquake.h"
#include <GL/glx.h>
#ifdef USE_EGL
#include "gl_videgl.h"
#endif
#include "glquake.h"
#include <X11/keysym.h>
#include <X11/cursorfont.h>
@ -69,6 +74,7 @@ static Window vid_decoywindow; //for legacy mode, this is a boring window that w
static Window vid_root;
static GLXContext ctx = NULL;
static int scrnum;
static long vid_x_eventmask;
static enum
{
PSL_NONE,
@ -92,6 +98,8 @@ extern long sys_parentwindow;
#define X_MASK (KEY_MASK | MOUSE_MASK | ResizeRequest | StructureNotifyMask | FocusChangeMask | VisibilityChangeMask)
struct _XrmHashBucketRec;
static struct
{
void *lib;
@ -145,6 +153,22 @@ static struct
int (*pXUngrabKeyboard)(Display *display, Time time);
int (*pXUngrabPointer)(Display *display, Time time);
int (*pXWarpPointer)(Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y);
Status (*pXMatchVisualInfo)(Display *display, int screen, int depth, int class, XVisualInfo *vinfo_return);
char *(*pXSetLocaleModifiers)(char *modifier_list);
Bool (*pXSupportsLocale)(void);
XIM (*pXOpenIM)(Display *display, struct _XrmHashBucketRec *db, char *res_name, char *res_class);
XIC (*pXCreateIC)(XIM im, ...);
void (*pXSetICFocus)(XIC ic);
char * (*pXGetICValues)(XIC ic, ...);
Bool (*pXFilterEvent)(XEvent *event, Window w);
int (*pXutf8LookupString)(XIC ic, XKeyPressedEvent *event, char *buffer_return, int bytes_buffer, KeySym *keysym_return, Status *status_return);
int (*pXwcLookupString)(XIC ic, XKeyPressedEvent *event, wchar_t *buffer_return, int bytes_buffer, KeySym *keysym_return, Status *status_return);
void (*pXDestroyIC)(XIC ic);
Status (*pXCloseIM)(XIM im);
qboolean dounicode;
XIC unicodecontext;
XIM inputmethod;
} x11;
static qboolean x11_initlib(void)
{
@ -198,6 +222,7 @@ static qboolean x11_initlib(void)
{(void**)&x11.pXUngrabKeyboard, "XUngrabKeyboard"},
{(void**)&x11.pXUngrabPointer, "XUngrabPointer"},
{(void**)&x11.pXWarpPointer, "XWarpPointer"},
{(void**)&x11.pXMatchVisualInfo, "XMatchVisualInfo"},
{NULL, NULL}
};
@ -214,8 +239,22 @@ static qboolean x11_initlib(void)
//these ones are extensions, and the reason we're doing this.
if (x11.lib)
{
//raw input (yay mouse deltas)
x11.pXGetEventData = Sys_GetAddressForName(x11.lib, "XGetEventData");
x11.pXFreeEventData = Sys_GetAddressForName(x11.lib, "XFreeEventData");
//internationalisation
x11.pXSetLocaleModifiers = Sys_GetAddressForName(x11.lib, "XSetLocaleModifiers");
x11.pXSupportsLocale = Sys_GetAddressForName(x11.lib, "XSupportsLocale");
x11.pXOpenIM = Sys_GetAddressForName(x11.lib, "XOpenIM");
x11.pXCreateIC = Sys_GetAddressForName(x11.lib, "XCreateIC");
x11.pXSetICFocus = Sys_GetAddressForName(x11.lib, "XSetICFocus");
x11.pXGetICValues = Sys_GetAddressForName(x11.lib, "XGetICValues");
x11.pXFilterEvent = Sys_GetAddressForName(x11.lib, "XFilterEvent");
x11.pXutf8LookupString = Sys_GetAddressForName(x11.lib, "Xutf8LookupString");
x11.pXwcLookupString = Sys_GetAddressForName(x11.lib, "XwcLookupString");
x11.pXDestroyIC = Sys_GetAddressForName(x11.lib, "XDestroyIC");
x11.pXCloseIM = Sys_GetAddressForName(x11.lib, "XCloseIM");
}
else
{
@ -299,7 +338,7 @@ static qboolean VMODE_Init(void)
if (!x11.pXQueryExtension(vid_dpy, "XFree86-VidModeExtension", &vm.opcode, &vm.event, &vm.error))
{
Con_Printf("DGA extension not available.\n");
Con_Printf("VidModeExtension extension not available.\n");
return false;
}
@ -429,6 +468,11 @@ static qboolean XI2_Init(void)
if (!xi2.libxi)
{
#ifdef __CYGWIN__
if (!xi2.libxi)
xi2.libxi = Sys_LoadLibrary("cygXi-6.dll", xi2_functable);
#endif
if (!xi2.libxi)
xi2.libxi = Sys_LoadLibrary("libXi.so.6", xi2_functable);
if (!xi2.libxi)
xi2.libxi = Sys_LoadLibrary("libXi", xi2_functable);
@ -507,6 +551,10 @@ qboolean GLX_InitLibrary(char *driver)
gllibrary = Sys_LoadLibrary(driver, funcs);
else
gllibrary = NULL;
#ifdef __CYGWIN__
if (!gllibrary)
gllibrary = Sys_LoadLibrary("cygGL-1.dll", funcs);
#endif
if (!gllibrary) //I hate this.
gllibrary = Sys_LoadLibrary("libGL.so.1", funcs);
if (!gllibrary)
@ -535,24 +583,116 @@ void *GLX_GetSymbol(char *name)
return symb;
}
static int XLateKey(XKeyEvent *ev, unsigned int *unicode)
static void X_ShutdownUnicode(void)
{
if (x11.unicodecontext)
x11.pXDestroyIC(x11.unicodecontext);
if (x11.inputmethod)
x11.pXCloseIM(x11.inputmethod);
x11.dounicode = false;
}
#include <locale.h>
static long X_InitUnicode(void)
{
long requiredevents = 0;
//return 0;
X_ShutdownUnicode();
if (x11.pXSetLocaleModifiers && x11.pXSupportsLocale && x11.pXOpenIM && x11.pXCreateIC && x11.pXSetICFocus && x11.pXGetICValues && x11.pXFilterEvent && (x11.pXutf8LookupString || x11.pXwcLookupString) && x11.pXDestroyIC && x11.pXCloseIM)
{
setlocale(LC_CTYPE, "");
x11.pXSetLocaleModifiers("");
if (x11.pXSupportsLocale())
{
x11.inputmethod = x11.pXOpenIM(vid_dpy, NULL, NULL, NULL);
if (x11.inputmethod)
{
x11.unicodecontext = x11.pXCreateIC(x11.inputmethod,
XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, vid_window,
XNFocusWindow, vid_window,
NULL);
if (x11.unicodecontext)
{
x11.pXSetICFocus(x11.unicodecontext);
x11.dounicode = true;
x11.pXGetICValues(x11.unicodecontext, XNFilterEvents, &requiredevents, NULL);
}
}
}
// setlocale(LC_ALL, "C");
}
Con_Printf("Unicode support: %s\n", x11.dounicode?"available":"unavailable");
return requiredevents;
}
static void X_KeyEvent(XKeyEvent *ev, qboolean pressed)
{
int i;
int key;
char buf[64];
KeySym keysym, shifted;
unsigned int unichar[64];
int unichars = 0;
key = 0;
keysym = x11.pXLookupKeysym(ev, 0);
if (unicode)
if (pressed)
{
if ((keysym & 0xff000000) == 0x01000000)
*unicode = keysym & 0x00ffffff;
if (x11.dounicode)
{
Status status = XLookupNone;
if (x11.pXutf8LookupString)
{
char buf1[1] = {0};
char *buf = buf1, *c;
int count = x11.pXutf8LookupString(x11.unicodecontext, (XKeyPressedEvent*)ev, buf1, sizeof(buf1), NULL, &status);
if (status == XBufferOverflow)
{
buf = alloca(count+1);
count = x11.pXutf8LookupString(x11.unicodecontext, (XKeyPressedEvent*)ev, buf, count, NULL, &status);
}
for (c = buf; c < &buf[count]; )
{
int error;
unsigned int uc = utf8_decode(&error, c, &c);
if (uc)
unichar[unichars++] = uc;
}
}
else
{
x11.pXLookupString(ev, buf, sizeof buf, &shifted, 0);
*unicode = (unsigned char)buf[0];
//is allowed some weird encodings...
wchar_t buf1[4] = {0};
wchar_t *buf = buf1;
int count = x11.pXwcLookupString(x11.unicodecontext, (XKeyPressedEvent*)ev, buf, sizeof(buf1), &shifted, &status);
if (status == XBufferOverflow)
{
buf = alloca(sizeof(wchar_t)*(count+1));
printf("XBufferOverflow\n");
count = x11.pXwcLookupString(x11.unicodecontext, (XKeyPressedEvent*)ev, buf, count, NULL, &status);
}
printf("Translated to \"%ls\" (%i %i)\n", buf, count, status);
//if wchar_t is 16bit, then expect problems when we completely ignore surrogates. this is why we favour the utf8 route as it doesn't care whether wchar_t is defined as 16bit or 32bit.
for (i = 0; i < count; i++)
if (buf[i])
unichar[unichars++] = buf[i];
}
}
else
{
char buf[64];
if ((keysym & 0xff000000) == 0x01000000)
unichar[unichars++] = keysym & 0x00ffffff;
else
{
int count = x11.pXLookupString(ev, buf, sizeof(buf), &shifted, 0);
for (i = 0; i < count; i++)
if (buf[i])
unichar[unichars++] = (unsigned char)buf[i];
}
}
}
@ -676,7 +816,21 @@ static int XLateKey(XKeyEvent *ev, unsigned int *unicode)
break;
}
return key;
if (unichars)
{
//we got some text, this is fun isn't it?
//the key value itself is sent with the last text char. this avoids multiple presses, and dead keys were already sent.
for (i = 0; i < unichars-1; i++)
{
IN_KeyEvent(0, pressed, 0, unichar[i]);
}
IN_KeyEvent(0, pressed, key, unichar[i]);
}
else
{
//no text available, just do the keypress
IN_KeyEvent(0, pressed, key, 0);
}
}
static void install_grabs(void)
@ -737,12 +891,18 @@ static void GetEvent(void)
{
XEvent event, rep;
int b;
unsigned int uc;
qboolean x11violations = true;
Window mw;
x11.pXNextEvent(vid_dpy, &event);
if (x11.dounicode)
if (x11.pXFilterEvent(&event, vid_window))
{
Con_Printf("Event filtered\n");
return;
}
switch (event.type)
{
case GenericEvent:
@ -833,12 +993,10 @@ static void GetEvent(void)
// x11.pXMoveWindow(vid_dpy, vid_window, 0, 0);
break;
case KeyPress:
b = XLateKey(&event.xkey, &uc);
Key_Event(0, b, uc, true);
X_KeyEvent(&event.xkey, true);
break;
case KeyRelease:
b = XLateKey(&event.xkey, NULL);
Key_Event(0, b, 0, false);
X_KeyEvent(&event.xkey, false);
break;
case MotionNotify:
@ -857,10 +1015,10 @@ static void GetEvent(void)
IN_MouseMove(0, false, event.xmotion.x - cx, event.xmotion.y - cy, 0, 0);
/* move the mouse to the window center again (disabling warp first so we don't see it*/
x11.pXSelectInput(vid_dpy, vid_window, X_MASK & ~PointerMotionMask);
x11.pXSelectInput(vid_dpy, vid_window, vid_x_eventmask & ~PointerMotionMask);
x11.pXWarpPointer(vid_dpy, None, vid_window, 0, 0, 0, 0,
cx, cy);
x11.pXSelectInput(vid_dpy, vid_window, X_MASK);
x11.pXSelectInput(vid_dpy, vid_window, vid_x_eventmask);
}
}
else
@ -1066,6 +1224,8 @@ void GLVID_Shutdown(void)
if (vm.originalapplied)
vm.pXF86VidModeSetGammaRamp(vid_dpy, scrnum, 256, vm.originalramps[0], vm.originalramps[1], vm.originalramps[2]);
X_ShutdownUnicode();
switch(currentpsl)
{
#ifdef USE_EGL
@ -1178,35 +1338,14 @@ qboolean GLVID_ApplyGammaRamps(unsigned short *ramps)
}
}
/*
=================
GL_BeginRendering
=================
*/
void GL_BeginRendering (void)
void GLVID_SwapBuffers (void)
{
switch(currentpsl)
{
#ifdef USE_EGL
default:
case PSL_EGL:
EGL_BeginRendering();
break;
#endif
case PSL_GLX:
case PSL_NONE:
break;
}
}
void GL_EndRendering (void)
{
switch(currentpsl)
{
#ifdef USE_EGL
case PSL_EGL:
EGL_EndRendering();
EGL_SwapBuffers();
break;
#endif
case PSL_GLX:
@ -1214,8 +1353,6 @@ void GL_EndRendering (void)
//chances are, it's version is more suitable anyway. At least there's the chance that it might be.
qglXSwapBuffers(vid_dpy, vid_window);
break;
case PSL_NONE:
break;
}
}
@ -1225,11 +1362,16 @@ void X_StoreIcon(Window wnd)
int i;
unsigned long data[64*64+2];
unsigned int *indata = (unsigned int*)icon.pixel_data;
unsigned int inwidth = icon.width;
unsigned int inheight = icon.height;
//FIXME: support loading an icon from the filesystem.
Atom propname = x11.pXInternAtom(vid_dpy, "_NET_WM_ICON", false);
Atom proptype = x11.pXInternAtom(vid_dpy, "CARDINAL", false);
data[0] = icon.width;
data[1] = icon.height;
data[0] = inwidth;
data[1] = inheight;
for (i = 0; i < data[0]*data[1]; i++)
data[i+2] = indata[i];
@ -1352,7 +1494,7 @@ Window X_CreateWindow(qboolean override, XVisualInfo *visinfo, unsigned int widt
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = x11.pXCreateColormap(vid_dpy, vid_root, visinfo->visual, AllocNone);
attr.event_mask = X_MASK;
attr.event_mask = vid_x_eventmask = X_MASK;
attr.backing_store = NotUseful;
attr.save_under = False;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWBackingStore |CWSaveUnder;
@ -1576,6 +1718,9 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
else
vid_window = X_CreateWindow(false, visinfo, width, height, fullscreen);
vid_x_eventmask |= X_InitUnicode();
x11.pXSelectInput(vid_dpy, vid_window, vid_x_eventmask);
CL_UpdateWindowTitle();
/*make it visible*/
@ -1629,7 +1774,7 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
break;
#ifdef USE_EGL
case PSL_EGL:
if (!EGL_Init(info, palette, vid_window, vid_dpy))
if (!EGL_Init(info, palette, (EGLNativeWindowType)vid_window, (EGLNativeDisplayType)vid_dpy))
{
Con_Printf("Failed to create EGL context.\n");
GLVID_Shutdown();
@ -1662,17 +1807,17 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
if (!COM_CheckParm("-noxi2") && XI2_Init())
{
x11_input_method = XIM_XI2;
Con_Printf("Using XInput2\n");
Con_DPrintf("Using XInput2\n");
}
else if (!COM_CheckParm("-nodga") && !COM_CheckParm("-nomdga") && DGAM_Init())
{
x11_input_method = XIM_DGA;
Con_Printf("Using DGA mouse\n");
Con_DPrintf("Using DGA mouse\n");
}
else
{
x11_input_method = XIM_ORIG;
Con_Printf("Using X11 mouse\n");
Con_DPrintf("Using X11 mouse\n");
}
if (Cvar_Get("vidx_grabkeyboard", "0", 0, "Additional video options")->value)
@ -1843,8 +1988,6 @@ void INS_Shutdown(void)
{
}
void GL_DoSwap(void) {}
void GLVID_SetCaption(char *text)
{
x11.pXStoreName(vid_dpy, vid_window, text);
@ -1855,7 +1998,7 @@ void GLVID_SetCaption(char *text)
#include "gl_draw.h"
rendererinfo_t eglrendererinfo =
{
"EGL",
"EGL(X11)",
{
"egl"
},
@ -1880,16 +2023,13 @@ rendererinfo_t eglrendererinfo =
GLR_NewMap,
GLR_PreNewMap,
Surf_AddStain,
Surf_LessenStains,
EGLVID_Init,
GLVID_DeInit,
GLVID_SetPalette,
GLVID_ShiftPalette,
GLVID_GetRGBInfo,
GLVID_SwapBuffers,
GLVID_ApplyGammaRamps,
GLVID_SetCaption, //setcaption
GLVID_GetRGBInfo,
GLSCR_UpdateScreen,
@ -1906,8 +2046,16 @@ rendererinfo_t eglrendererinfo =
GLBE_UploadAllLightmaps,
GLBE_SelectEntity,
GLBE_SelectDLight,
GLBE_Scissor,
GLBE_LightCullModel,
GLBE_VBO_Begin,
GLBE_VBO_Data,
GLBE_VBO_Finish,
GLBE_VBO_Destroy,
GLBE_RenderToTextureUpdate2d,
""
};
#endif

View file

@ -113,10 +113,6 @@ void GLVID_DeInit(void)
killCocoa();
}
void GL_DoSwap(void)
{
}
void GLVID_SetPalette (unsigned char *palette)
{
qbyte *pal;
@ -179,11 +175,7 @@ void GLVID_SetCaption(char *text)
{
}
void GL_BeginRendering (void)
{
}
void GL_EndRendering(void)
void GLVID_SwapBuffers(void)
{
flushCocoa();
}

View file

@ -581,19 +581,11 @@ void GLVID_DeInit(void)
}
}
void GL_BeginRendering(void)
{
}
void GL_EndRendering (void)
void GLVID_SwapBuffers (void)
{
glASwapBuffers();
}
void GL_DoSwap(void)
{
}
void GLVID_SetPalette (unsigned char *palette)
{
qbyte *pal;

View file

@ -1274,25 +1274,6 @@ qboolean VID_AttachGL (rendererstate_t *info)
return true;
}
/*
=================
GL_BeginRendering
=================
*/
void GL_BeginRendering (void)
{
vid.pixelwidth = WindowRect.right - WindowRect.left;
vid.pixelheight = WindowRect.bottom - WindowRect.top;
qglDisable(GL_SCISSOR_TEST);
// if (!wglMakeCurrent( maindc, baseRC ))
// Sys_Error ("wglMakeCurrent failed");
// glViewport (*x, *y, *width, *height);
}
void VID_Wait_Override_Callback(struct cvar_s *var, char *oldvalue)
{
if (qwglSwapIntervalEXT && *vid_vsync.string)
@ -1371,13 +1352,8 @@ void VID_WndAlpha_Override_Callback(struct cvar_s *var, char *oldvalue)
#endif
}
qboolean screenflush;
void GL_DoSwap (void)
void GLVID_SwapBuffers (void)
{
if (!screenflush)
return;
screenflush = 0;
qSwapBuffers(maindc);
// handle the mouse state when windowed if that's changed
@ -1385,13 +1361,6 @@ void GL_DoSwap (void)
INS_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
}
void GL_EndRendering (void)
{
screenflush = true;
if (!gl_lateswap.value)
GL_DoSwap();
}
void OblitterateOldGamma(void)
{
int i;

View file

@ -29,15 +29,7 @@ void GLD_EndDirectRect(int x, int y, int width, int height)
{
}
void GL_BeginRendering (void)
{
}
void GL_EndRendering (void)
{
}
void GL_DoSwap(void)
void GLVID_SwapBuffers(void)
{
}

146
engine/gl/gl_vidrpi.c Normal file
View file

@ -0,0 +1,146 @@
#include "bothdefs.h"
#if defined(GLQUAKE) && defined(USE_EGL)
#include "gl_videgl.h"
#include <bcm_host.h>
#include "glquake.h"
#include "shader.h"
qboolean RPI_Init (rendererstate_t *info, unsigned char *palette)
{
static EGL_DISPMANX_WINDOW_T nativewindow;
DISPMANX_ELEMENT_HANDLE_T dispman_element;
DISPMANX_DISPLAY_HANDLE_T dispman_display;
DISPMANX_UPDATE_HANDLE_T dispman_update;
VC_RECT_T dst_rect;
VC_RECT_T src_rect;
int rw, rh;
if (!EGL_LoadLibrary(info->subrenderer))
{
Con_Printf("couldn't load EGL library\n");
return false;
}
bcm_host_init();
graphics_get_display_size(0 /* LCD */, &rw, &rh);
Con_Printf("Screen size is actually %i*%i\n", rw, rh);
if (info->width < 64 || info->height < 64)
{
info->width = rw;
info->height = rh;
}
dispman_display = vc_dispmanx_display_open(0 /* LCD */);
dispman_update = vc_dispmanx_update_start(0);
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = info->width;
dst_rect.height = info->height;
src_rect.x = 0;
src_rect.y = 0;
src_rect.width = info->width << 16;
src_rect.height = info->height << 16;
vid.pixelwidth = info->width;
vid.pixelheight = info->height;
dispman_element = vc_dispmanx_element_add(dispman_update, dispman_display, 0/*layer*/, &dst_rect, 0/*src*/, &src_rect, DISPMANX_PROTECTION_NONE, 0 /*alpha*/, 0/*clamp*/, 0/*transform*/);
nativewindow.element = dispman_element;
nativewindow.width = info->width;
nativewindow.height = info->height;
vc_dispmanx_update_submit_sync(dispman_update);
if (!EGL_Init(info, palette, &nativewindow, EGL_DEFAULT_DISPLAY))
{
Con_Printf("couldn't initialise EGL context\n");
return false;
}
GL_Init(&EGL_Proc);
return true;
}
void RPI_DeInit(void)
{
EGL_Shutdown();
}
qboolean RPI_ApplyGammaRamps(unsigned short *ramps)
{
//not supported
return false;
}
void RPI_SetCaption(char *text)
{
}
#include "gl_draw.h"
rendererinfo_t rpirendererinfo =
{
"EGL(VideoCore)",
{
"rpi",
"videocore",
"rpiegl"
},
QR_OPENGL,
GLDraw_Init,
GLDraw_DeInit,
GL_LoadTextureFmt,
GL_LoadTexture8Pal24,
GL_LoadTexture8Pal32,
GL_LoadCompressed,
GL_FindTexture,
GL_AllocNewTexture,
GL_UploadFmt,
GL_DestroyTexture,
GLR_Init,
GLR_DeInit,
GLR_RenderView,
GLR_NewMap,
GLR_PreNewMap,
RPI_Init,
RPI_DeInit,
RPI_ApplyGammaRamps,
GLVID_GetRGBInfo,
RPI_SetCaption, //setcaption
GLSCR_UpdateScreen,
GLBE_SelectMode,
GLBE_DrawMesh_List,
GLBE_DrawMesh_Single,
GLBE_SubmitBatch,
GLBE_GetTempBatch,
GLBE_DrawWorld,
GLBE_Init,
GLBE_GenBrushModelVBO,
GLBE_ClearVBO,
GLBE_UploadAllLightmaps,
GLBE_SelectEntity,
GLBE_SelectDLight,
GLBE_Scissor,
GLBE_LightCullModel,
GLBE_VBO_Begin,
GLBE_VBO_Data,
GLBE_VBO_Finish,
GLBE_VBO_Destroy,
GLBE_RenderToTextureUpdate2d,
""
};
#endif

View file

@ -230,21 +230,8 @@ void GLVID_DeInit (void)
}
void GL_BeginRendering (void)
void GLVID_SwapBuffers (void)
{
// if (!wglMakeCurrent( maindc, baseRC ))
// Sys_Error ("wglMakeCurrent failed");
// qglViewport (*x, *y, *width, *height);
}
qboolean screenflush;
void GL_DoSwap (void)
{
if (!screenflush)
return;
screenflush = 0;
#if SDL_MAJOR_VERSION >= 2
if (vid_vsync.modified)
{
@ -279,13 +266,6 @@ void GL_DoSwap (void)
}
}
void GL_EndRendering (void)
{
screenflush = true;
if (!gl_lateswap.value)
GL_DoSwap();
}
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps)
{
#if SDL_MAJOR_VERSION >= 2

473
engine/gl/gl_vidwayland.c Normal file
View file

@ -0,0 +1,473 @@
#include "bothdefs.h"
#if defined(GLQUAKE) && defined(USE_EGL)
#include <wayland-client.h>
#include <wayland-egl.h>
#include <linux/input.h> //this is shite.
#include "gl_videgl.h"
#if WAYLAND_VERSION_MAJOR < 1
#error "wayland headers are too old"
#endif
#include "glquake.h"
#include "shader.h"
static struct wdisplay_s
{
//display stuff
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
//seat stuff
void *pointer;
void *keyboard;
void *seat;
//window stuff
struct wl_egl_window *enwindow;
struct wl_surface *surface;
struct wl_shell_surface *ssurface;
} w;
static void WL_shell_handle_ping(void *data, struct wl_shell_surface *shell_surface, uint32_t serial)
{
wl_shell_surface_pong(shell_surface, serial);
}
static void WL_shell_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t edges, int32_t width, int32_t height)
{
if (w.enwindow)
wl_egl_window_resize(w.enwindow, width, height, 0, 0);
vid.pixelwidth = width;
vid.pixelheight = height;
}
static void WL_shell_handle_popup_done(void *data, struct wl_shell_surface *shell_surface)
{
}
static const struct wl_shell_surface_listener shell_surface_listener =
{
WL_shell_handle_ping,
WL_shell_handle_configure,
WL_shell_handle_popup_done
};
//qkeys are ascii-compatible for the most part.
qbyte waylandinputsucksbighairydonkeyballs[] =
{
0, K_ESCAPE,'1','2','3','4','5','6', //0x
'7','8','9','0','-','=',K_BACKSPACE,K_TAB,
'q','w','e','r','t','y','u','i', //1x
'o','p','[',']',K_ENTER,K_LCTRL,'a', 's',
'd','f','g','h','j','k','l',';', //2x
'\'','`',K_LSHIFT,'#','z','x','c','v',
'b','n','m',',','.','/',K_RSHIFT,K_KP_STAR, //3x
K_LALT,' ',K_CAPSLOCK,K_F1,K_F2,K_F3,K_F4,K_F5,
K_F6,K_F7,K_F8,K_F9,K_F10,K_KP_NUMLOCK,K_SCRLCK,K_KP_HOME,//4x
K_KP_UPARROW,K_KP_PGUP,K_KP_MINUS,K_KP_LEFTARROW,K_KP_5,K_KP_RIGHTARROW,K_KP_PLUS,K_KP_END,
K_KP_DOWNARROW,K_KP_PGDN,K_KP_INS,K_KP_DEL,0,0,'\\',K_F11, //5x
K_F12,0,0,0,0,0,0,0,
K_KP_ENTER,0,K_KP_SLASH,0,K_RALT,0,K_HOME,K_UPARROW, //6x
K_PGUP,K_LEFTARROW,K_RIGHTARROW,K_END,K_DOWNARROW,K_PGDN,K_INS,K_DEL,
0,0,0,0,0,0,0,K_PAUSE, //7x
0,0,0,0,0,K_LWIN,K_RWIN,K_APP
};
qbyte waylandinputsucksbighairydonkeyballsshift[] =
{
0, K_ESCAPE,'!','\"','3','$','%','^', //0x
'&','*','(',')','_','+',K_BACKSPACE,K_TAB,
'Q','W','E','R','T','Y','U','I', //1x
'O','P','{','}',K_ENTER,K_LCTRL,'A', 'S',
'D','F','G','H','J','K','L',':', //2x
'@','`',K_LSHIFT,'~','Z','X','C','V',
'B','N','M','<','>','?',K_RSHIFT,K_KP_STAR, //3x
K_LALT,' ',K_CAPSLOCK,K_F1,K_F2,K_F3,K_F4,K_F5,
K_F6,K_F7,K_F8,K_F9,K_F10,K_KP_NUMLOCK,K_SCRLCK,K_KP_HOME,//4x
K_KP_UPARROW,K_KP_PGUP,K_KP_MINUS,K_KP_LEFTARROW,K_KP_5,K_KP_RIGHTARROW,K_KP_PLUS,K_KP_END,
K_KP_DOWNARROW,K_KP_PGDN,K_KP_INS,K_KP_DEL,0,0,'|',K_F11, //5x
K_F12,0,0,0,0,0,0,0,
K_KP_ENTER,0,K_KP_SLASH,0,K_RALT,0,K_HOME,K_UPARROW, //6x
K_PGUP,K_LEFTARROW,K_RIGHTARROW,K_END,K_DOWNARROW,K_PGDN,K_INS,K_DEL,
0,0,0,0,0,0,0,K_PAUSE, //7x
0,0,0,0,0,K_LWIN,K_RWIN,K_APP
};
static void WL_pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy)
{
/*
struct display *display = data;
struct wl_buffer *buffer;
struct wl_cursor *cursor = display->default_cursor;
struct wl_cursor_image *image;
if (display->window->fullscreen)
wl_pointer_set_cursor(pointer, serial, NULL, 0, 0);
else if (cursor) {
image = display->default_cursor->images[0];
buffer = wl_cursor_image_get_buffer(image);
wl_pointer_set_cursor(pointer, serial,
display->cursor_surface,
image->hotspot_x,
image->hotspot_y);
wl_surface_attach(display->cursor_surface, buffer, 0, 0);
wl_surface_damage(display->cursor_surface, 0, 0,
image->width, image->height);
wl_surface_commit(display->cursor_surface);
}
*/
}
static void WL_pointer_handle_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface)
{
}
static void WL_pointer_handle_motion(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
{
//wayland is shite shite shite.
//1.4 still has no relative mouse motion.
IN_MouseMove(0, true, wl_fixed_to_double(sx), wl_fixed_to_double(sy), 0, 0);
}
static void WL_pointer_handle_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
{
struct wdisplay *display = data;
int qkey;
switch(button)
{
default:
return; //blurgh.
case BTN_LEFT:
qkey = K_MOUSE1;
break;
case BTN_RIGHT:
qkey = K_MOUSE2;
break;
case BTN_MIDDLE:
qkey = K_MOUSE3;
break;
case BTN_SIDE:
qkey = K_MOUSE4;
break;
case BTN_EXTRA:
qkey = K_MOUSE5;
break;
case BTN_FORWARD:
qkey = K_MOUSE6;
break;
case BTN_BACK:
qkey = K_MOUSE7;
break;
case BTN_TASK:
qkey = K_MOUSE8;
break;
}
IN_KeyEvent(0, !!state, qkey, 0);
// wl_shell_surface_move(display->window->shell_surface, display->seat, serial);
}
static void WL_pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
{
if (value < 0)
{
IN_KeyEvent(0, 1, K_MWHEELUP, 0);
IN_KeyEvent(0, 0, K_MWHEELUP, 0);
}
else
{
IN_KeyEvent(0, 1, K_MWHEELDOWN, 0);
IN_KeyEvent(0, 0, K_MWHEELDOWN, 0);
}
}
static const struct wl_pointer_listener pointer_listener =
{
WL_pointer_handle_enter,
WL_pointer_handle_leave,
WL_pointer_handle_motion,
WL_pointer_handle_button,
WL_pointer_handle_axis,
};
static void WL_keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size)
{
}
static void WL_keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
{
}
static void WL_keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
{
}
static void WL_keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{
extern int shift_down;
struct display *d = data;
uint32_t qkey;
uint32_t ukey;
if (key < sizeof(waylandinputsucksbighairydonkeyballs)/sizeof(waylandinputsucksbighairydonkeyballs[0]))
{
qkey = waylandinputsucksbighairydonkeyballs[key];
if (shift_down)
ukey = waylandinputsucksbighairydonkeyballsshift[key];
else
ukey = waylandinputsucksbighairydonkeyballs[key];
}
else
ukey = qkey = 0;
if (ukey < ' ' || ukey > 127)
ukey = 0;
if (state)
IN_KeyEvent(0, 1, qkey, ukey);
else
IN_KeyEvent(0, 0, qkey, 0);
}
static void WL_keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
{
}
static const struct wl_keyboard_listener keyboard_listener =
{
WL_keyboard_handle_keymap,
WL_keyboard_handle_enter,
WL_keyboard_handle_leave,
WL_keyboard_handle_key,
WL_keyboard_handle_modifiers
};
static void WL_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps)
{
struct wdisplay_s *s = data;
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !s->pointer)
{
s->pointer = wl_seat_get_pointer(seat);
wl_pointer_add_listener(s->pointer, &pointer_listener, s);
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && s->pointer)
{
wl_pointer_destroy(s->pointer);
s->pointer = NULL;
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !s->keyboard)
{
s->keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_add_listener(s->keyboard, &keyboard_listener, s);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && s->keyboard)
{
wl_keyboard_destroy(s->keyboard);
s->keyboard = NULL;
}
}
static const struct wl_seat_listener seat_listener =
{
WL_seat_handle_capabilities
};
static void WL_handle_global(void *data, struct wl_registry *registry,
uint32_t id, const char *interface, uint32_t version)
{
struct wdisplay_s *d = data;
//Sys_Printf("Interface %s id %u\n", interface, id);
if (strcmp(interface, "wl_compositor") == 0)
d->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
else if (strcmp(interface, "wl_shell") == 0)
d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
else if (strcmp(interface, "wl_seat") == 0 && !d->seat)
{
d->seat = wl_registry_bind(registry, id, &wl_seat_interface, 1);
wl_seat_add_listener(d->seat, &seat_listener, d);
}
/* else if (!strcmp(interface, "input_device"))
display_add_input(id);
*/
}
static const struct wl_registry_listener WL_registry_listener = {
WL_handle_global
};
static void WL_waitabit(void)
{
wl_display_roundtrip(w.display);
}
static void WL_SwapBuffers(void)
{
float r;
TRACE(("WL_SwapBuffers\n"));
wl_surface_set_opaque_region(w.surface, NULL);
EGL_SwapBuffers();
//wl_surface_damage(w.surface, 0, 0, vid.pixelwidth, vid.pixelheight);
wl_display_dispatch_pending(w.display);
}
static qboolean WL_Init (rendererstate_t *info, unsigned char *palette)
{
cvar_t *v;
w.display = wl_display_connect(NULL);
if (!w.display)
{
Con_Printf("couldn't connect to wayland server\n");
return false;
}
w.registry = wl_display_get_registry(w.display);
wl_registry_add_listener(w.registry, &WL_registry_listener, &w); //w.compositor =
v = Cvar_FindVar("gl_menutint_shader");
if (v && v->ival)
{
Con_Printf("Disabling gl_menutint_shader to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 0);
}
v = Cvar_FindVar("r_waterstyle");
if (v && v->ival>1)
{
Con_Printf("Disabling r_waterstyle to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 1);
}
v = Cvar_FindVar("r_slimestyle");
if (v && v->ival>1)
{
Con_Printf("Disabling r_slimestyle to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 1);
}
v = Cvar_FindVar("r_lavastyle");
if (v && v->ival>1)
{
Con_Printf("Disabling r_lavastyle to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 1);
}
WL_waitabit();
if (!w.compositor)
{
Con_Printf("no compositor running, apparently\n");
return false;
}
w.surface = wl_compositor_create_surface(w.compositor);
w.ssurface = wl_shell_get_shell_surface(w.shell, w.surface);
wl_shell_surface_add_listener(w.ssurface, &shell_surface_listener, &w);
w.enwindow = wl_egl_window_create(w.surface, info->width, info->height);
vid.pixelwidth = info->width;
vid.pixelheight = info->height;
setenv("EGL_PLATFORM", "wayland", 1);
if (!EGL_LoadLibrary(info->subrenderer))
{
Con_Printf("couldn't load EGL library\n");
return false;
}
if (!EGL_Init(info, palette, (EGLNativeWindowType)w.enwindow, (EGLNativeDisplayType) w.display))
{
Con_Printf("couldn't initialise EGL context\n");
return false;
}
if (info->fullscreen)
wl_shell_surface_set_fullscreen(w.ssurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 60, NULL);
else
wl_shell_surface_set_toplevel(w.ssurface);
//window_set_keyboard_focus_handler(window, WL_handler_keyfocus);
//window_set_resize_handler(w.surface, WL_handler_resize);
wl_display_dispatch_pending(w.display);
GL_Init(&EGL_Proc);
// while(1)
// WL_SwapBuffers();
return true;
}
static void WL_DeInit(void)
{
EGL_Shutdown();
wl_egl_window_destroy(w.enwindow);
}
static qboolean WL_ApplyGammaRamps(unsigned short *ramps)
{
//not supported
return false;
}
static void WL_SetCaption(char *text)
{
wl_shell_surface_set_title(w.ssurface, text);
}
#include "gl_draw.h"
rendererinfo_t waylandrendererinfo =
{
"Wayland",
{
"wayland"
},
QR_OPENGL,
GLDraw_Init,
GLDraw_DeInit,
GL_LoadTextureFmt,
GL_LoadTexture8Pal24,
GL_LoadTexture8Pal32,
GL_LoadCompressed,
GL_FindTexture,
GL_AllocNewTexture,
GL_UploadFmt,
GL_DestroyTexture,
GLR_Init,
GLR_DeInit,
GLR_RenderView,
GLR_NewMap,
GLR_PreNewMap,
WL_Init,
WL_DeInit,
WL_SwapBuffers,
WL_ApplyGammaRamps,
WL_SetCaption, //setcaption
GLVID_GetRGBInfo,
GLSCR_UpdateScreen,
GLBE_SelectMode,
GLBE_DrawMesh_List,
GLBE_DrawMesh_Single,
GLBE_SubmitBatch,
GLBE_GetTempBatch,
GLBE_DrawWorld,
GLBE_Init,
GLBE_GenBrushModelVBO,
GLBE_ClearVBO,
GLBE_UploadAllLightmaps,
GLBE_SelectEntity,
GLBE_SelectDLight,
GLBE_Scissor,
GLBE_LightCullModel,
GLBE_VBO_Begin,
GLBE_VBO_Data,
GLBE_VBO_Finish,
GLBE_VBO_Destroy,
GLBE_RenderToTextureUpdate2d,
""
};
#endif

View file

@ -59,29 +59,13 @@ extern r_config_t r_config;
#endif
#else
#include <GLES2/gl2.h>
/*gles has no fixed function*/
#define GL_PROJECTION 0
#define GL_MODELVIEW 0
#define GL_CLIP_PLANE0 0
#define GL_ALPHA_TEST 0
#define GL_MODULATE 0
#define GL_FLAT 0
#define GL_SMOOTH 0
#define GL_DECAL 0
#define GL_ADD 0
#define GL_TEXTURE_ENV 0
#define GL_TEXTURE_ENV_MODE 0
#define GL_COLOR_ARRAY 0
#define GL_VERTEX_ARRAY 0
#define GL_TEXTURE_COORD_ARRAY 0
#endif
/*gles has no doubles*/
#define GLclampd GLclampf
#define GLdouble GLfloat
#define GL_CLAMP GL_CLAMP_TO_EDGE
#define GL_NONE 0
#define GL_FILL (Sys_Error("GL_FILL was used"),0)
#define GL_QUADS (Sys_Error("GL_QUADS was used"),0)
#elif defined(__MACOSX__)
//apple, you suck.
@ -90,28 +74,6 @@ extern r_config_t r_config;
#include <GLES2/gl2.h>
#define GLclampd GLclampf
#define GLdouble GLfloat
#define GL_CLAMP GL_CLAMP_TO_EDGE
#define GL_POLYGON (Con_Printf("GL_POLYGON was used"),0)
#define GL_QUAD_STRIP (Con_Printf("GL_QUAD_STRIP was used"),0)
#define GL_QUADS (Con_Printf("GL_QUADS was used"),0)
#define GL_PROJECTION (Con_Printf("GL_PROJECTION was used"),0)
#define GL_MODELVIEW (Con_Printf("GL_MODELVIEW was used"),0)
#define GL_CLIP_PLANE0 (Con_Printf("GL_CLIP_PLANE0 was used"),0)
#define GL_MODULATE (Con_Printf("GL_MODULATE was used"),0)
#define GL_FLAT (Con_Printf("GL_FLAT was used"),0)
#define GL_SMOOTH (Con_Printf("GL_SMOOTH was used"),0)
#define GL_DECAL (Con_Printf("GL_DECAL was used"),0)
#define GL_ADD (Con_Printf("GL_ADD was used"),0)
#define GL_FILL (Con_Printf("GL_FILL was used"),0)
#define GL_TEXTURE_ENV (Con_Printf("GL_TEXTURE_ENV was used"),0)
#define GL_TEXTURE_ENV_MODE (Con_Printf("GL_TEXTURE_ENV_MODE was used"),0)
#define GL_COLOR_ARRAY (Con_Printf("GL_COLOR_ARRAY was used"),0)
#define GL_VERTEX_ARRAY (Con_Printf("GL_VERTEX_ARRAY was used"),0)
#define GL_TEXTURE_COORD_ARRAY (Con_Printf("GL_TEXTURE_COORD_ARRAY was used"),0)
#else
#include <GL/gl.h>
#ifdef GL_STATIC
@ -122,10 +84,52 @@ extern r_config_t r_config;
//#include <GL/glu.h>
#include "glsupp.h"
/*gles2 has no fixed function*/
#ifndef GL_ALPHA_TEST
#define GL_ALPHA_TEST 0
#endif
#ifndef GL_FILL
#define GL_FILL (Sys_Error("GL_FILL was used"),0)
#endif
#ifndef GL_CLAMP
#define GL_CLAMP GL_CLAMP_TO_EDGE
#endif
#ifndef GL_TEXTURE_ENV
#define GL_TEXTURE_ENV (Con_Printf("GL_TEXTURE_ENV was used"),0)
#define GL_TEXTURE_ENV_MODE (Con_Printf("GL_TEXTURE_ENV_MODE was used"),0)
#define GL_VERTEX_ARRAY (Con_Printf("GL_VERTEX_ARRAY was used"),0)
#define GL_COLOR_ARRAY (Con_Printf("GL_COLOR_ARRAY was used"),0)
#define GL_TEXTURE_COORD_ARRAY (Con_Printf("GL_TEXTURE_COORD_ARRAY was used"),0)
#define GL_DECAL (Con_Printf("GL_DECAL was used"),0)
#define GL_ADD (Con_Printf("GL_ADD was used"),0)
#define GL_FLAT (Con_Printf("GL_FLAT was used"),0)
#define GL_SMOOTH (Con_Printf("GL_SMOOTH was used"),0)
#define GL_MODULATE 0x2100
#define GL_PROJECTION (Con_Printf("GL_PROJECTION was used"),0)
#define GL_MODELVIEW (Con_Printf("GL_MODELVIEW was used"),0)
#define GL_CLIP_PLANE0 (Con_Printf("GL_CLIP_PLANE0 was used"),0)
#endif
#ifndef GL_COLOR_ARRAY_POINTER
#define GL_COLOR_ARRAY_POINTER 0
#define GL_NORMAL_ARRAY 0
#define GL_NORMAL_ARRAY_POINTER 0
#define GL_TEXTURE_COORD_ARRAY_POINTER 0
#define GL_VERTEX_ARRAY_POINTER 0
#define GL_BLEND_SRC 0
#define GL_BLEND_DST 0
#endif
#ifndef GL_POLYGON
#define GL_POLYGON (Con_Printf("GL_POLYGON was used"),0)
#define GL_QUAD_STRIP (Con_Printf("GL_QUAD_STRIP was used"),0)
#define GL_QUADS (Con_Printf("GL_QUADS was used"),0)
#endif
void GL_InitFogTexture(void);
void GL_BeginRendering (void);
void GL_EndRendering (void);
#define GL_BeginRendering()
#define GL_EndRendering()
void GL_FlushSkinCache(void);
void GL_GAliasFlushSkinCache(void);
@ -342,13 +346,6 @@ void GL_ForceDepthWritable(void);
#endif
//
// vid_gl*.c
//
#ifdef GLQUAKE
void GL_DoSwap (void);
#endif
//
// gl_backend.c
//

View file

@ -159,9 +159,9 @@ static int QDECL SendFileNameTo(const char *rawname, qofs_t size, void *param, s
fname = slash+1;
if (isdir)
sprintf(buffer, "drw-r--r--\t1\troot\troot\t%8u Jan 1 12:00 %s\r\n", size, fname);
sprintf(buffer, "drw-r--r--\t1\troot\troot\t%8u Jan 1 12:00 %s\r\n", (unsigned int)size, fname);
else
sprintf(buffer, "-rw-r--r--\t1\troot\troot\t%8u Jan 1 12:00 %s\r\n", size, fname);
sprintf(buffer, "-rw-r--r--\t1\troot\troot\t%8u Jan 1 12:00 %s\r\n", (unsigned int)size, fname);
// strcpy(buffer, fname);
// for (i = strlen(buffer); i < 40; i+=8)

View file

@ -730,14 +730,14 @@ void HTTPDL_Establish(struct dl_download *dl)
Q_snprintfz(con->buffer, con->bufferlen,
"POST %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Content-Length: %i\r\n"
"Content-Length: %u\r\n"
"Content-Type: %s\r\n"
"Connection: close\r\n"
#if !defined(NPFTE) && defined(AVAIL_ZLIB)
"Accept-Encoding: gzip\r\n"
#endif
"User-Agent: "FULLENGINENAME"\r\n"
"\r\n", uri, server, dl->postlen, dl->postmimetype);
"\r\n", uri, server, (unsigned int)dl->postlen, dl->postmimetype);
con->bufferused = strlen(con->buffer);
memcpy(con->buffer + con->bufferused, dl->postdata, dl->postlen);
con->bufferused += dl->postlen;

View file

@ -2949,7 +2949,7 @@ char *QCC_PR_CheckCompConstTooltip(char *word, char *outstart, char *outend)
QC_snprintfz(out, outend-out, "%s", c->params[i]);
out += strlen(out);
}
QC_snprintfz(out, outend-out, ")", c->name);
QC_snprintfz(out, outend-out, ")");
}
else
QC_snprintfz(out, outend-out, "#define %s", c->name);

View file

@ -2784,7 +2784,7 @@ void SV_DownloadSize_f(void)
break;
case -5: /*package*/
case 0: /*exists*/
name = va("dlsize \"%s\" %u\n", name, loc.len);
name = va("dlsize \"%s\" %u\n", name, (unsigned int)loc.len);
ClientReliableWrite_Begin (host_client, svc_stufftext, 2+strlen(name));
ClientReliableWrite_String (host_client, name);
break;

View file

@ -142,17 +142,8 @@ void GLVID_DeInit (void)
}
void GL_BeginRendering (void)
void VIDGL_SwapBuffers (void)
{
}
qboolean screenflush;
void GL_DoSwap (void)
{
if (!screenflush)
return;
screenflush = 0;
//webgl doesn't support swapbuffers.
//you can't use it for loading screens.
//such things must result in waiting until the following frame.
@ -179,13 +170,6 @@ void GL_DoSwap (void)
*/
}
void GL_EndRendering (void)
{
screenflush = true;
if (!gl_lateswap.value)
GL_DoSwap();
}
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps)
{
gammaworks = false;