aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-09-28 13:55:05 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-09-28 13:55:05 +0000
commitf4e974f904307d6120c243c6c180e4429fe12708 (patch)
treecf9f4af503071539888ee9212d960dcec7cab00b /src
parente6a20c6bc6683150277ad2670a455bfac4a70cd9 (diff)
downloadusdx-f4e974f904307d6120c243c6c180e4429fe12708.tar.gz
usdx-f4e974f904307d6120c243c6c180e4429fe12708.tar.xz
usdx-f4e974f904307d6120c243c6c180e4429fe12708.zip
correction of byte order (correct colors) in texture output on powerpc.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1419 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/base/UTexture.pas13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/base/UTexture.pas b/src/base/UTexture.pas
index cbaf6e70..17d81687 100644
--- a/src/base/UTexture.pas
+++ b/src/base/UTexture.pas
@@ -319,11 +319,19 @@ begin
if (Typ = TEXTURE_TYPE_TRANSPARENT) or
(Typ = TEXTURE_TYPE_COLORIZED) then
begin
+ {$IFDEF FPC_LITTLE_ENDIAN}
glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels);
+ {$ELSE}
+ glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, TexSurface.pixels);
+ {$ENDIF}
end
else //if Typ = TEXTURE_TYPE_PLAIN then
begin
+ {$IFDEF FPC_LITTLE_ENDIAN}
glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels);
+ {$ELSE}
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_BGR, GL_UNSIGNED_BYTE, TexSurface.pixels);
+ {$ENDIF}
end;
// setup texture struct
@@ -433,12 +441,17 @@ begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ {$IFDEF FPC_LITTLE_ENDIAN}
glTexImage2D(GL_TEXTURE_2D, 0, 3, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Data);
+ {$ELSE}
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, Width, Height, 0, GL_BGR, GL_UNSIGNED_BYTE, Data);
+ {$ENDIF}
{
if Mipmapping then
begin
Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_RGB, GL_UNSIGNED_BYTE, @Data[0]);
+// FPC_BIG_ENDIAN Error := gluBuild2DMipmaps(GL_TEXTURE_2D, 3, W, H, GL_BGR, GL_UNSIGNED_BYTE, @Data[0]);
if Error > 0 then
Log.LogError('gluBuild2DMipmaps() failed', 'TTextureUnit.CreateTexture');
end;