Changing scaling quality on the fly

I want to change the scaling quality of an SDL2 (OpenGL) texture on the fly. I can’t use SDL_SetHint(), because that takes effect only when the texture is created, so I’m doing this:

SDL_GL_BindTexture(texture, NULL, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

This appears to have exactly the effect I want, but I don’t know how legitimate it is. Are there any pitfalls that I need to be aware of?

1 Like

I’ve now incorporated the code with no apparent issues, except that I did need to add an SDL_GL_UnbindTexture(texture) afterwards to completely eliminate side effects. This was a little unexpected (there is no equivalent OpenGL function, you simply bind NULL).