Added the SDL_HINT_RENDER_SCALE_QUALITY hint, which defaults to nearest pixel sampling.
This commit is contained in:
parent
fbc49beee3
commit
a19e258730
5 changed files with 79 additions and 9 deletions
|
@ -393,6 +393,18 @@ convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
|
|||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
static GLenum
|
||||
GetScaleQuality(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return GL_NEAREST;
|
||||
} else {
|
||||
return GL_LINEAR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
{
|
||||
|
@ -455,7 +467,7 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
|
||||
data->format = format;
|
||||
data->formattype = type;
|
||||
data->scaleMode = GL_LINEAR;
|
||||
data->scaleMode = GetScaleQuality();
|
||||
renderdata->glEnable(data->type);
|
||||
renderdata->glBindTexture(data->type, data->texture);
|
||||
renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue