From de10ddc84efb46775f6051f6a527ba7ccdf6560d Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 22 May 2004 22:29:20 +0000 Subject: [PATCH] allow for texture dimensions of 1, and fix ogl replacement texture paletted->rgb conversion alpha problem (d1x r1.43) --- ChangeLog | 4 ++++ arch/ogl/ogl.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2fb1ed0..8cf56608 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-05-22 Matthew Mueller + * arch/ogl/ogl.c: allow for texture dimensions of 1, and fix ogl + replacement texture paletted->rgb conversion alpha problem (d1x + r1.43) + * arch/ogl/ogl.c, include/pngfile.h, main/piggy.c, main/piggy.h, misc/Makefile.am, misc/pngfile.c: add opengl replacement texture support (requires libpng and zlib) (d1x r1.42, r1.1, r1.10, r1.4, diff --git a/arch/ogl/ogl.c b/arch/ogl/ogl.c index e656a0a2..edf774db 100644 --- a/arch/ogl/ogl.c +++ b/arch/ogl/ogl.c @@ -1,4 +1,4 @@ -/* $Id: ogl.c,v 1.30 2004-05-22 22:24:24 btb Exp $ */ +/* $Id: ogl.c,v 1.31 2004-05-22 22:29:20 btb Exp $ */ /* * * Graphics support functions for OpenGL. @@ -1553,7 +1553,8 @@ int tex_format_supported(int iformat,int format){ //little hack to find the largest or equal multiple of 2 for a given number int pow2ize(int x){ int i; - for (i=2;i<=4096;i*=2) + + for (i = 1; i <= 4096; i *= 2) if (x<=i) return i; return i; } @@ -1890,7 +1891,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags) if (pdata.depth == 8 && pdata.color) { if (bm->gltexture == NULL) - ogl_init_texture(bm->gltexture = ogl_get_free_texture(), pdata.width, pdata.height, flags | ((pdata.alpha) ? OGL_FLAG_ALPHA : 0)); + ogl_init_texture(bm->gltexture = ogl_get_free_texture(), pdata.width, pdata.height, flags | ((pdata.alpha || bm->bm_flags & BM_FLAG_TRANSPARENT) ? OGL_FLAG_ALPHA : 0)); ogl_loadtexture(pdata.data, 0, 0, bm->gltexture, bm->bm_flags, pdata.paletted ? 0 : pdata.channels); free(pdata.data); if (pdata.palette) -- 2.39.2