don't force textures into power-of-two dimensions

This commit is contained in:
Andrei Alexeyev 2018-01-29 02:08:50 +02:00
parent 46fb0f894a
commit 605fff6e2f
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
2 changed files with 4 additions and 7 deletions

View file

@ -17,8 +17,8 @@ static void init_fbo(FBO *fbo, float scale, int type) {
glBindTexture(GL_TEXTURE_2D, fbo->tex);
fbo->scale = scale = sanitize_scale(scale);
fbo->nw = topow2(scale * VIEWPORT_W);
fbo->nh = topow2(scale * VIEWPORT_H);
fbo->nw = scale * VIEWPORT_W;
fbo->nh = scale * VIEWPORT_H;
log_debug("FBO %p: q=%f, w=%i, h=%i", (void*)fbo, fbo->scale, fbo->nw, fbo->nh);

View file

@ -256,11 +256,8 @@ void load_sdl_surf(SDL_Surface *surface, Texture *texture) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
int nw = 2;
int nh = 2;
while(nw < surface->w) nw *= 2;
while(nh < surface->h) nh *= 2;
int nw = surface->w;
int nh = surface->h;
uint32_t *tex = calloc(sizeof(uint32_t), nw*nh);
uint32_t clr;