From 41f277746e8d3667a70eaab994f8733ccc6bf511 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 18 Apr 2011 15:35:46 +0000 Subject: [PATCH] separate out the GLES2 stuff from the iphone stuff git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11063 d7cf8633-e32d-0410-b094-e92efae38249 --- quakedef.h | 4 ++++ vid_sdl.c | 19 +++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/quakedef.h b/quakedef.h index 2b5af8c0..d5688a77 100644 --- a/quakedef.h +++ b/quakedef.h @@ -435,6 +435,10 @@ extern cvar_t developer_loading; #elif defined(__MORPHOS__) # define DP_OS_NAME "MorphOS" # define DP_OS_STR "morphos" +#elif defined(TARGET_OS_IPHONE) +# define DP_OS_NAME "iPhoneOS" +# define DP_OS_STR "iphoneos" +# define USE_GLES2 1 #else # define DP_OS_NAME "Unknown" #endif diff --git a/vid_sdl.c b/vid_sdl.c index fa35ea55..17fb8ba1 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -90,7 +90,7 @@ cvar_t joy_sensitivityroll = {0, "joy_sensitivityroll", "1", "movement multiplie cvar_t joy_axiskeyevents = {CVAR_SAVE, "joy_axiskeyevents", "0", "generate uparrow/leftarrow etc. keyevents for joystick axes, use if your joystick driver is not generating them"}; cvar_t joy_axiskeyevents_deadzone = {CVAR_SAVE, "joy_axiskeyevents_deadzone", "0.5", "deadzone value for axes"}; -#ifdef __IPHONEOS__ +#ifdef USE_GLES2 # define SETVIDEOMODE 0 #else # if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION == 2 @@ -1022,11 +1022,9 @@ void Sys_SendKeyEvents( void ) break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: -#ifndef __IPHONEOS__ if (!vid_touchscreen.integer) if (event.button.button <= 18) Key_Event( buttonremap[event.button.button - 1], 0, event.button.state == SDL_PRESSED ); -#endif break; case SDL_JOYBUTTONDOWN: if (!joy_enable.integer) @@ -1222,9 +1220,12 @@ void Sys_SendKeyEvents( void ) // Video system //// +#ifdef USE_GLES2 #ifdef __IPHONEOS__ -//#include #include +#else +#include +#endif GLboolean wrapglIsBuffer(GLuint buffer) {return glIsBuffer(buffer);} GLboolean wrapglIsEnabled(GLenum cap) {return glIsEnabled(cap);} @@ -2140,7 +2141,8 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) mode->fullscreen = true; // hide the menu with SDL_WINDOW_BORDERLESS windowflags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS; -#else +#endif +#ifndef USE_GLES2 if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL) { VID_Shutdown(); @@ -2192,13 +2194,10 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) else SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 0); #else -#ifdef __IPHONEOS__ +#ifdef USE_GLES2 SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_GL_SetAttribute (SDL_GL_RETAINED_BACKING, 1); - // FIXME: get proper resolution from OS somehow (iPad for instance...) - mode->width = 320; - mode->height = 480; #endif #endif @@ -2255,7 +2254,7 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) gl_platform = "SDL"; gl_platformextensions = ""; -#ifdef __IPHONEOS__ +#ifdef USE_GLES2 GLES_Init(); #else GL_Init(); -- 2.39.2