Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though. gsoc2008_iphone
authorHolmes Futrell <hfutrell@umail.ucsb.edu>
Sat, 16 Aug 2008 00:25:03 +0000
branchgsoc2008_iphone
changeset 2456da4fd7cf8745
parent 2455 0416aeddbb86
child 2457 946f43d71626
Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
src/video/glesrenderer/SDL_renderer_gles.c
     1.1 --- a/src/video/glesrenderer/SDL_renderer_gles.c	Sat Aug 16 00:19:52 2008 +0000
     1.2 +++ b/src/video/glesrenderer/SDL_renderer_gles.c	Sat Aug 16 00:25:03 2008 +0000
     1.3 @@ -30,52 +30,52 @@
     1.4  #include "SDL_rect_c.h"
     1.5  #include "SDL_yuv_sw_c.h"
     1.6  
     1.7 -/* OpenGL ES 1.1 renderer implementation */
     1.8 +/* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
     1.9  
    1.10  static const float inv255f = 1.0f / 255.0f;
    1.11  
    1.12 -static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags);
    1.13 -static int GL_ActivateRenderer(SDL_Renderer * renderer);
    1.14 -static int GL_DisplayModeChanged(SDL_Renderer * renderer);
    1.15 -static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
    1.16 -static int GL_QueryTexturePixels(SDL_Renderer * renderer,
    1.17 +static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
    1.18 +static int GLES_ActivateRenderer(SDL_Renderer * renderer);
    1.19 +static int GLES_DisplayModeChanged(SDL_Renderer * renderer);
    1.20 +static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
    1.21 +static int GLES_QueryTexturePixels(SDL_Renderer * renderer,
    1.22                                   SDL_Texture * texture, void **pixels,
    1.23                                   int *pitch);
    1.24 -static int GL_SetTexturePalette(SDL_Renderer * renderer,
    1.25 +static int GLES_SetTexturePalette(SDL_Renderer * renderer,
    1.26                                  SDL_Texture * texture,
    1.27                                  const SDL_Color * colors, int firstcolor,
    1.28                                  int ncolors);
    1.29 -static int GL_GetTexturePalette(SDL_Renderer * renderer,
    1.30 +static int GLES_GetTexturePalette(SDL_Renderer * renderer,
    1.31                                  SDL_Texture * texture, SDL_Color * colors,
    1.32                                  int firstcolor, int ncolors);
    1.33 -static int GL_SetTextureColorMod(SDL_Renderer * renderer,
    1.34 +static int GLES_SetTextureColorMod(SDL_Renderer * renderer,
    1.35                                   SDL_Texture * texture);
    1.36 -static int GL_SetTextureAlphaMod(SDL_Renderer * renderer,
    1.37 +static int GLES_SetTextureAlphaMod(SDL_Renderer * renderer,
    1.38                                   SDL_Texture * texture);
    1.39 -static int GL_SetTextureBlendMode(SDL_Renderer * renderer,
    1.40 +static int GLES_SetTextureBlendMode(SDL_Renderer * renderer,
    1.41                                    SDL_Texture * texture);
    1.42 -static int GL_SetTextureScaleMode(SDL_Renderer * renderer,
    1.43 +static int GLES_SetTextureScaleMode(SDL_Renderer * renderer,
    1.44                                    SDL_Texture * texture);
    1.45 -static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.46 +static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.47                              const SDL_Rect * rect, const void *pixels,
    1.48                              int pitch);
    1.49 -static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.50 +static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.51                            const SDL_Rect * rect, int markDirty, void **pixels,
    1.52                            int *pitch);
    1.53 -static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
    1.54 -static void GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.55 +static void GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
    1.56 +static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.57                              int numrects, const SDL_Rect * rects);
    1.58 -static int GL_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
    1.59 +static int GLES_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
    1.60                           Uint8 a, const SDL_Rect * rect);
    1.61 -static int GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
    1.62 +static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
    1.63                           const SDL_Rect * srcrect, const SDL_Rect * dstrect);
    1.64 -static void GL_RenderPresent(SDL_Renderer * renderer);
    1.65 -static void GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
    1.66 -static void GL_DestroyRenderer(SDL_Renderer * renderer);
    1.67 +static void GLES_RenderPresent(SDL_Renderer * renderer);
    1.68 +static void GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
    1.69 +static void GLES_DestroyRenderer(SDL_Renderer * renderer);
    1.70  
    1.71  
    1.72  SDL_RenderDriver GL_ES_RenderDriver = {
    1.73 -    GL_CreateRenderer,
    1.74 +    GLES_CreateRenderer,
    1.75      {
    1.76       "opengl_es",
    1.77       (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
    1.78 @@ -86,16 +86,8 @@
    1.79        SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD |
    1.80        SDL_TEXTUREBLENDMODE_MOD),
    1.81       (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST |
    1.82 -      SDL_TEXTURESCALEMODE_SLOW),
    1.83 -#ifdef GL_IMG_texture_format_BGRA8888     
    1.84 -		3,
    1.85 -#else
    1.86 -		2,
    1.87 -#endif
    1.88 -     {
    1.89 -#ifdef GL_IMG_texture_format_BGRA8888
    1.90 -		SDL_PIXELFORMAT_ARGB8888,
    1.91 -#endif
    1.92 +      SDL_TEXTURESCALEMODE_SLOW), 2,
    1.93 +		{
    1.94  		SDL_PIXELFORMAT_RGB24,
    1.95  		SDL_PIXELFORMAT_ABGR8888,
    1.96  		},
    1.97 @@ -108,7 +100,6 @@
    1.98      SDL_GLContext context;
    1.99      SDL_bool updateSize;
   1.100      int blendMode;
   1.101 -    int scaleMode;
   1.102  	
   1.103  #ifndef APIENTRY
   1.104  #define APIENTRY
   1.105 @@ -122,7 +113,7 @@
   1.106  	#include "SDL_glesfuncs.h"
   1.107  	#undef SDL_PROC
   1.108  
   1.109 -} GL_RenderData;
   1.110 +} GLES_RenderData;
   1.111  
   1.112  typedef struct
   1.113  {
   1.114 @@ -135,10 +126,10 @@
   1.115      void *pixels;
   1.116      int pitch;
   1.117      SDL_DirtyRectList dirty;
   1.118 -} GL_TextureData;
   1.119 +} GLES_TextureData;
   1.120  
   1.121  static void
   1.122 -GL_SetError(const char *prefix, GLenum result)
   1.123 +GLES_SetError(const char *prefix, GLenum result)
   1.124  {
   1.125      const char *error;
   1.126  
   1.127 @@ -172,7 +163,7 @@
   1.128  }
   1.129  
   1.130  static int
   1.131 -GL_LoadFunctions(GL_RenderData * data)
   1.132 +GLES_LoadFunctions(GLES_RenderData * data)
   1.133  {
   1.134  	
   1.135  	#define SDL_PROC(ret,func,params) \
   1.136 @@ -184,7 +175,7 @@
   1.137  }
   1.138  
   1.139  void
   1.140 -GL_AddRenderDriver(_THIS)
   1.141 +GLES_AddRenderDriver(_THIS)
   1.142  {
   1.143      if (_this->GL_CreateContext) {
   1.144          SDL_AddRenderDriver(0, &GL_ES_RenderDriver);
   1.145 @@ -192,13 +183,11 @@
   1.146  }
   1.147  
   1.148  SDL_Renderer *
   1.149 -GL_CreateRenderer(SDL_Window * window, Uint32 flags)
   1.150 +GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
   1.151  {
   1.152 -	
   1.153 -	printf("gl(es) create renderer ...\n");
   1.154 -	
   1.155 +		
   1.156      SDL_Renderer *renderer;
   1.157 -    GL_RenderData *data;
   1.158 +    GLES_RenderData *data;
   1.159      GLint value;
   1.160      int doublebuffer;
   1.161  
   1.162 @@ -214,32 +203,32 @@
   1.163          return NULL;
   1.164      }
   1.165  
   1.166 -    data = (GL_RenderData *) SDL_calloc(1, sizeof(*data));
   1.167 +    data = (GLES_RenderData *) SDL_calloc(1, sizeof(*data));
   1.168      if (!data) {
   1.169 -        GL_DestroyRenderer(renderer);
   1.170 +        GLES_DestroyRenderer(renderer);
   1.171          SDL_OutOfMemory();
   1.172          return NULL;
   1.173      }
   1.174  
   1.175 -    renderer->ActivateRenderer = GL_ActivateRenderer;
   1.176 -    renderer->DisplayModeChanged = GL_DisplayModeChanged;
   1.177 -    renderer->CreateTexture = GL_CreateTexture;
   1.178 -    renderer->QueryTexturePixels = GL_QueryTexturePixels;
   1.179 -    renderer->SetTexturePalette = GL_SetTexturePalette;
   1.180 -    renderer->GetTexturePalette = GL_GetTexturePalette;
   1.181 -    renderer->SetTextureColorMod = GL_SetTextureColorMod;
   1.182 -    renderer->SetTextureAlphaMod = GL_SetTextureAlphaMod;
   1.183 -    renderer->SetTextureBlendMode = GL_SetTextureBlendMode;
   1.184 -    renderer->SetTextureScaleMode = GL_SetTextureScaleMode;
   1.185 -    renderer->UpdateTexture = GL_UpdateTexture;
   1.186 -    renderer->LockTexture = GL_LockTexture;
   1.187 -    renderer->UnlockTexture = GL_UnlockTexture;
   1.188 -    renderer->DirtyTexture = GL_DirtyTexture;
   1.189 -    renderer->RenderFill = GL_RenderFill;
   1.190 -    renderer->RenderCopy = GL_RenderCopy;
   1.191 -    renderer->RenderPresent = GL_RenderPresent;
   1.192 -    renderer->DestroyTexture = GL_DestroyTexture;
   1.193 -    renderer->DestroyRenderer = GL_DestroyRenderer;
   1.194 +    renderer->ActivateRenderer = GLES_ActivateRenderer;
   1.195 +    renderer->DisplayModeChanged = GLES_DisplayModeChanged;
   1.196 +    renderer->CreateTexture = GLES_CreateTexture;
   1.197 +    renderer->QueryTexturePixels = GLES_QueryTexturePixels;
   1.198 +    renderer->SetTexturePalette = GLES_SetTexturePalette;
   1.199 +    renderer->GetTexturePalette = GLES_GetTexturePalette;
   1.200 +    renderer->SetTextureColorMod = GLES_SetTextureColorMod;
   1.201 +    renderer->SetTextureAlphaMod = GLES_SetTextureAlphaMod;
   1.202 +    renderer->SetTextureBlendMode = GLES_SetTextureBlendMode;
   1.203 +    renderer->SetTextureScaleMode = GLES_SetTextureScaleMode;
   1.204 +    renderer->UpdateTexture = GLES_UpdateTexture;
   1.205 +    renderer->LockTexture = GLES_LockTexture;
   1.206 +    renderer->UnlockTexture = GLES_UnlockTexture;
   1.207 +    renderer->DirtyTexture = GLES_DirtyTexture;
   1.208 +    renderer->RenderFill = GLES_RenderFill;
   1.209 +    renderer->RenderCopy = GLES_RenderCopy;
   1.210 +    renderer->RenderPresent = GLES_RenderPresent;
   1.211 +    renderer->DestroyTexture = GLES_DestroyTexture;
   1.212 +    renderer->DestroyRenderer = GLES_DestroyRenderer;
   1.213      renderer->info = GL_ES_RenderDriver.info;
   1.214      renderer->window = window->id;
   1.215      renderer->driverdata = data;
   1.216 @@ -247,18 +236,18 @@
   1.217  	
   1.218      renderer->info.flags = (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
   1.219  
   1.220 -    if (GL_LoadFunctions(data) < 0) {
   1.221 -        GL_DestroyRenderer(renderer);
   1.222 +    if (GLES_LoadFunctions(data) < 0) {
   1.223 +        GLES_DestroyRenderer(renderer);
   1.224          return NULL;
   1.225      }
   1.226  
   1.227      data->context = SDL_GL_CreateContext(window->id);
   1.228      if (!data->context) {
   1.229 -        GL_DestroyRenderer(renderer);
   1.230 +        GLES_DestroyRenderer(renderer);
   1.231          return NULL;
   1.232      }
   1.233      if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
   1.234 -        GL_DestroyRenderer(renderer);
   1.235 +        GLES_DestroyRenderer(renderer);
   1.236          return NULL;
   1.237      }
   1.238  
   1.239 @@ -293,7 +282,6 @@
   1.240  
   1.241      /* Set up parameters for rendering */
   1.242      data->blendMode = -1;
   1.243 -    data->scaleMode = -1;
   1.244      data->glDisable(GL_DEPTH_TEST);
   1.245      data->glDisable(GL_CULL_FACE);
   1.246  	data->glEnable(GL_TEXTURE_2D);
   1.247 @@ -302,10 +290,10 @@
   1.248      return renderer;
   1.249  }
   1.250  
   1.251 -static int GL_ActivateRenderer(SDL_Renderer * renderer)
   1.252 +static int GLES_ActivateRenderer(SDL_Renderer * renderer)
   1.253  {
   1.254  		
   1.255 -    GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
   1.256 +    GLES_RenderData *data = (GLES_RenderData *)renderer->driverdata;
   1.257      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   1.258  				
   1.259      if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
   1.260 @@ -325,9 +313,9 @@
   1.261  }
   1.262  
   1.263  static int
   1.264 -GL_DisplayModeChanged(SDL_Renderer * renderer)
   1.265 +GLES_DisplayModeChanged(SDL_Renderer * renderer)
   1.266  {
   1.267 -    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   1.268 +    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
   1.269  
   1.270      data->updateSize = SDL_TRUE;
   1.271      return 0;
   1.272 @@ -345,11 +333,11 @@
   1.273  }
   1.274  
   1.275  static int
   1.276 -GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   1.277 +GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   1.278  {
   1.279 -    GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
   1.280 +    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
   1.281      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   1.282 -    GL_TextureData *data;
   1.283 +    GLES_TextureData *data;
   1.284      GLint internalFormat;
   1.285      GLenum format, type;
   1.286      int texture_w, texture_h;
   1.287 @@ -364,22 +352,11 @@
   1.288  		case SDL_PIXELFORMAT_ARGB4444:
   1.289  		case SDL_PIXELFORMAT_ARGB1555:
   1.290  		case SDL_PIXELFORMAT_BGR24:
   1.291 -		case SDL_PIXELFORMAT_BGR888: /* can't convert 32 bit format to 24 */
   1.292 +		case SDL_PIXELFORMAT_BGR888:
   1.293  		case SDL_PIXELFORMAT_RGB888:
   1.294  		case SDL_PIXELFORMAT_RGBA8888:
   1.295  		case SDL_PIXELFORMAT_ARGB2101010:
   1.296 -			SDL_SetError("Unsupported format");
   1.297 -			return -1;
   1.298  		case SDL_PIXELFORMAT_ARGB8888:
   1.299 -		#ifdef GL_IMG_texture_format_BGRA8888
   1.300 -			internalFormat = GL_RGBA;
   1.301 -			format = GL_RGBA;
   1.302 -			type = GL_UNSIGNED_BYTE;
   1.303 -			break;
   1.304 -		#else
   1.305 -			SDL_SetError("Unsupported format");
   1.306 -			return -1;
   1.307 -		#endif
   1.308  		case SDL_PIXELFORMAT_RGB24:
   1.309  			internalFormat = GL_RGB;
   1.310  			format = GL_RGB;
   1.311 @@ -412,7 +389,8 @@
   1.312  			SDL_SetError("Unsupported texture format");
   1.313  			return -1;
   1.314      }
   1.315 -	data = (GL_TextureData *) SDL_calloc(1, sizeof(*data));
   1.316 +	
   1.317 +	data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
   1.318      if (!data) {
   1.319          SDL_OutOfMemory();
   1.320          return -1;
   1.321 @@ -434,6 +412,7 @@
   1.322      renderdata->glGenTextures(1, &data->texture);
   1.323      
   1.324  	data->type = GL_TEXTURE_2D;
   1.325 +	/* no NPOV textures allowed in OpenGL ES (yet) */
   1.326  	texture_w = power_of_2(texture->w);
   1.327  	texture_h = power_of_2(texture->h);
   1.328  	data->texw = (GLfloat) texture->w / texture_w;
   1.329 @@ -456,17 +435,17 @@
   1.330  
   1.331      result = renderdata->glGetError();
   1.332      if (result != GL_NO_ERROR) {
   1.333 -        GL_SetError("glTexImage2D()", result);
   1.334 +        GLES_SetError("glTexImage2D()", result);
   1.335          return -1;
   1.336      }
   1.337      return 0;
   1.338  }
   1.339  
   1.340  static int
   1.341 -GL_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
   1.342 +GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
   1.343                        void **pixels, int *pitch)
   1.344  {
   1.345 -    GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   1.346 +    GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   1.347  
   1.348      *pixels = data->pixels;
   1.349      *pitch = data->pitch;
   1.350 @@ -474,7 +453,7 @@
   1.351  }
   1.352  
   1.353  static int
   1.354 -GL_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
   1.355 +GLES_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
   1.356                       const SDL_Color * colors, int firstcolor, int ncolors)
   1.357  {
   1.358  	SDL_SetError("OpenGL ES does not support paletted textures");
   1.359 @@ -482,7 +461,7 @@
   1.360  }
   1.361  
   1.362  static int
   1.363 -GL_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
   1.364 +GLES_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
   1.365                       SDL_Color * colors, int firstcolor, int ncolors)
   1.366  {
   1.367  	SDL_SetError("OpenGL ES does not support paletted textures");
   1.368 @@ -490,30 +469,30 @@
   1.369  }
   1.370  
   1.371  static void
   1.372 -SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture,
   1.373 +SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
   1.374                     int pitch)
   1.375  {
   1.376  	
   1.377  	
   1.378 -	GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   1.379 +	GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   1.380  	renderdata->glBindTexture(data->type, data->texture);
   1.381      renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   1.382  }
   1.383  
   1.384  static int
   1.385 -GL_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
   1.386 +GLES_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
   1.387  {
   1.388      return 0;
   1.389  }
   1.390  
   1.391  static int
   1.392 -GL_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
   1.393 +GLES_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
   1.394  {
   1.395      return 0;
   1.396  }
   1.397  
   1.398  static int
   1.399 -GL_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
   1.400 +GLES_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
   1.401  {
   1.402      switch (texture->blendMode) {
   1.403      case SDL_TEXTUREBLENDMODE_NONE:
   1.404 @@ -530,7 +509,7 @@
   1.405  }
   1.406  
   1.407  static int
   1.408 -GL_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
   1.409 +GLES_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
   1.410  {
   1.411      switch (texture->scaleMode) {
   1.412      case SDL_TEXTURESCALEMODE_NONE:
   1.413 @@ -549,11 +528,11 @@
   1.414  }
   1.415  
   1.416  static int
   1.417 -GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   1.418 +GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   1.419                   const SDL_Rect * rect, const void *pixels, int pitch)
   1.420  {
   1.421 -    GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
   1.422 -    GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   1.423 +    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
   1.424 +    GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   1.425      GLenum result;
   1.426  
   1.427      SetupTextureUpdate(renderdata, texture, pitch);
   1.428 @@ -563,18 +542,18 @@
   1.429                                  pixels);
   1.430      result = renderdata->glGetError();
   1.431      if (result != GL_NO_ERROR) {
   1.432 -        GL_SetError("glTexSubImage2D()", result);
   1.433 +        GLES_SetError("glTexSubImage2D()", result);
   1.434          return -1;
   1.435      }
   1.436      return 0;
   1.437  }
   1.438  
   1.439  static int
   1.440 -GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   1.441 +GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   1.442                 const SDL_Rect * rect, int markDirty, void **pixels,
   1.443                 int *pitch)
   1.444  {
   1.445 -    GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   1.446 +    GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   1.447  
   1.448      if (markDirty) {
   1.449          SDL_AddDirtyRect(&data->dirty, rect);
   1.450 @@ -588,15 +567,15 @@
   1.451  }
   1.452  
   1.453  static void
   1.454 -GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   1.455 +GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   1.456  {
   1.457  }
   1.458  
   1.459  static void
   1.460 -GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
   1.461 +GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
   1.462                  const SDL_Rect * rects)
   1.463  {
   1.464 -    GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   1.465 +    GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   1.466      int i;
   1.467  
   1.468      for (i = 0; i < numrects; ++i) {
   1.469 @@ -605,11 +584,11 @@
   1.470  }
   1.471  
   1.472  static int
   1.473 -GL_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
   1.474 +GLES_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
   1.475                const SDL_Rect * rect)
   1.476  {
   1.477   	
   1.478 -	GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   1.479 +	GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
   1.480      SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   1.481  	
   1.482  	/* set proper drawing color */
   1.483 @@ -632,12 +611,12 @@
   1.484  }
   1.485  
   1.486  static int
   1.487 -GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
   1.488 +GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
   1.489                const SDL_Rect * srcrect, const SDL_Rect * dstrect)
   1.490  {
   1.491  		
   1.492 -    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   1.493 -    GL_TextureData *texturedata = (GL_TextureData *) texture->driverdata;
   1.494 +    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
   1.495 +    GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
   1.496      int minx, miny, maxx, maxy;
   1.497      GLfloat minu, maxu, minv, maxv;
   1.498  	int i;
   1.499 @@ -692,7 +671,7 @@
   1.500          data->glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
   1.501      }
   1.502  
   1.503 -    //if (texture->blendMode != data->blendMode) {
   1.504 +    if (texture->blendMode != data->blendMode) {
   1.505          switch (texture->blendMode) {
   1.506          case SDL_TEXTUREBLENDMODE_NONE:
   1.507              data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
   1.508 @@ -716,27 +695,24 @@
   1.509              break;
   1.510          }
   1.511          data->blendMode = texture->blendMode;
   1.512 -   // }
   1.513 +    }
   1.514  
   1.515 -   // if (texture->scaleMode != data->scaleMode) {
   1.516 -        switch (texture->scaleMode) {
   1.517 -        case SDL_TEXTURESCALEMODE_NONE:
   1.518 -        case SDL_TEXTURESCALEMODE_FAST:
   1.519 -            data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
   1.520 -                                  GL_NEAREST);
   1.521 -            data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
   1.522 -                                  GL_NEAREST);
   1.523 -            break;
   1.524 -        case SDL_TEXTURESCALEMODE_SLOW:
   1.525 -        case SDL_TEXTURESCALEMODE_BEST:
   1.526 -            data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
   1.527 -                                  GL_LINEAR);
   1.528 -            data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
   1.529 -                                  GL_LINEAR);
   1.530 -            break;
   1.531 -        }
   1.532 -        data->scaleMode = texture->scaleMode;
   1.533 -    //}
   1.534 +	switch (texture->scaleMode) {
   1.535 +		case SDL_TEXTURESCALEMODE_NONE:
   1.536 +		case SDL_TEXTURESCALEMODE_FAST:
   1.537 +			data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
   1.538 +								  GL_NEAREST);
   1.539 +			data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
   1.540 +								  GL_NEAREST);
   1.541 +			break;
   1.542 +		case SDL_TEXTURESCALEMODE_SLOW:
   1.543 +		case SDL_TEXTURESCALEMODE_BEST:
   1.544 +			data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
   1.545 +								  GL_LINEAR);
   1.546 +			data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
   1.547 +								  GL_LINEAR);
   1.548 +			break;
   1.549 +	}
   1.550  
   1.551  	if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
   1.552  		/* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
   1.553 @@ -790,16 +766,16 @@
   1.554  }
   1.555  
   1.556  static void
   1.557 -GL_RenderPresent(SDL_Renderer * renderer)
   1.558 +GLES_RenderPresent(SDL_Renderer * renderer)
   1.559  {
   1.560      SDL_GL_SwapWindow(renderer->window);
   1.561  }
   1.562  
   1.563  static void
   1.564 -GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   1.565 +GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   1.566  {
   1.567 -    GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
   1.568 -    GL_TextureData *data = (GL_TextureData *) texture->driverdata;
   1.569 +    GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
   1.570 +    GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
   1.571  
   1.572      if (!data) {
   1.573          return;
   1.574 @@ -816,9 +792,9 @@
   1.575  }
   1.576  
   1.577  static void
   1.578 -GL_DestroyRenderer(SDL_Renderer * renderer)
   1.579 +GLES_DestroyRenderer(SDL_Renderer * renderer)
   1.580  {
   1.581 -    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
   1.582 +    GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
   1.583  
   1.584      if (data) {
   1.585          if (data->context) {