src/render/opengles/SDL_render_gles.c
changeset 5484 e20c93bc9122
parent 5402 5d102cd8aef3
child 5503 be88d105e91c
equal deleted inserted replaced
5483:ccec742c9b7d 5484:e20c93bc9122
    21 */
    21 */
    22 #include "SDL_config.h"
    22 #include "SDL_config.h"
    23 
    23 
    24 #if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
    24 #if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
    25 
    25 
       
    26 #include "SDL_hints.h"
    26 #include "SDL_opengles.h"
    27 #include "SDL_opengles.h"
    27 #include "../SDL_sysrender.h"
    28 #include "../SDL_sysrender.h"
    28 
    29 
    29 #if defined(SDL_VIDEO_DRIVER_PANDORA)
    30 #if defined(SDL_VIDEO_DRIVER_PANDORA)
    30 
    31 
   290         value <<= 1;
   291         value <<= 1;
   291     }
   292     }
   292     return value;
   293     return value;
   293 }
   294 }
   294 
   295 
       
   296 static GLenum
       
   297 GetScaleQuality(void)
       
   298 {
       
   299     const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
       
   300 
       
   301     if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
       
   302         return GL_NEAREST;
       
   303     } else {
       
   304         return GL_LINEAR;
       
   305     }
       
   306 }
       
   307 
   295 static int
   308 static int
   296 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   309 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
   297 {
   310 {
   298     GLES_TextureData *data;
   311     GLES_TextureData *data;
   299     GLint internalFormat;
   312     GLint internalFormat;
   343     data->texw = (GLfloat) texture->w / texture_w;
   356     data->texw = (GLfloat) texture->w / texture_w;
   344     data->texh = (GLfloat) texture->h / texture_h;
   357     data->texh = (GLfloat) texture->h / texture_h;
   345 
   358 
   346     data->format = format;
   359     data->format = format;
   347     data->formattype = type;
   360     data->formattype = type;
   348     data->scaleMode = GL_LINEAR;
   361     data->scaleMode = GetScaleQuality();
   349     glBindTexture(data->type, data->texture);
   362     glBindTexture(data->type, data->texture);
   350     glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   363     glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   351     glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
   364     glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
   352 
   365 
   353     glTexImage2D(data->type, 0, internalFormat, texture_w,
   366     glTexImage2D(data->type, 0, internalFormat, texture_w,