From 73aab13a79ed46766826dfc49fbb48be9ef6fb53 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 6 Apr 2016 13:44:36 +0200 Subject: [PATCH] Try to fix the Portable C UploadTexture_OGL function --- Sources/Engine/Graphics/Gfx_OpenGL_Textures.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Sources/Engine/Graphics/Gfx_OpenGL_Textures.cpp b/Sources/Engine/Graphics/Gfx_OpenGL_Textures.cpp index d5a4196..4b92db6 100644 --- a/Sources/Engine/Graphics/Gfx_OpenGL_Textures.cpp +++ b/Sources/Engine/Graphics/Gfx_OpenGL_Textures.cpp @@ -168,18 +168,29 @@ void UploadTexture_OGL( ULONG *pulTexture, PIX pixSizeU, PIX pixSizeV, #if (defined USE_PORTABLE_C) // Basically average every other pixel... - pixSize *= 4; - UWORD w = 0; UBYTE *dptr = (UBYTE *) pulDst; UBYTE *sptr = (UBYTE *) pulSrc; + #if 0 + pixSize *= 4; for (PIX i = 0; i < pixSize; i++) { *dptr = (UBYTE) ( (((UWORD) sptr[0]) + ((UWORD) sptr[1])) >> 1 ); dptr++; sptr += 2; } - + #else + for (PIX i = 0; i < pixSize; i++) + { + for (PIX j = 0; j < 4; j++) + { + *dptr = (UBYTE) ( (((UWORD) sptr[0]) + ((UWORD) sptr[4])) >> 1 ); + dptr++; + sptr++; + } + sptr += 4; + } + #endif #elif (defined __MSVC_INLINE__) __asm { pxor mm0,mm0