From 26de26ea9cb80fe303b93fbeb535bae241c2222f Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 28 Sep 2008 17:47:04 +0000 Subject: one more version of fixing the endian problem in SDL git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1424 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UTexture.pas | 18 +++++++++--------- src/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc | 8 ++++---- src/switches.inc | 1 - 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/base/UTexture.pas b/src/base/UTexture.pas index 17d81687..83ff8239 100644 --- a/src/base/UTexture.pas +++ b/src/base/UTexture.pas @@ -319,18 +319,18 @@ 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} + {$IFDEF FPC_BIG_ENDIAN} glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, TexSurface.pixels); + {$ELSE} + glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 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} + {$IFDEF FPC_BIG_ENDIAN} glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_BGR, GL_UNSIGNED_BYTE, TexSurface.pixels); + {$ELSE} + glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); {$ENDIF} end; @@ -441,10 +441,10 @@ 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} + {$IFDEF FPC_BIG_ENDIAN} glTexImage2D(GL_TEXTURE_2D, 0, 3, Width, Height, 0, GL_BGR, GL_UNSIGNED_BYTE, Data); + {$ELSE} + glTexImage2D(GL_TEXTURE_2D, 0, 3, Width, Height, 0, GL_RGB, GL_UNSIGNED_BYTE, Data); {$ENDIF} { diff --git a/src/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc b/src/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc index 450c1731..9cc30e1d 100644 --- a/src/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc +++ b/src/lib/JEDI-SDL/SDL/Pas/jedi-sdl.inc @@ -424,10 +424,8 @@ {$IFDEF Delphi} -{$IFNDEF FPC_BIG_ENDIAN} {$DEFINE IA32} {$ENDIF} -{$ENDIF} {$IFDEF KYLIX} {$DEFINE IA32} @@ -435,6 +433,8 @@ {$IFDEF FPC} {$IFDEF FPC_LITTLE_ENDIAN} -{$DEFINE IA32} -{$ENDIF} + {$DEFINE IA32} +{$ELSE FPC_LITTLE_ENDIAN} + {$UNDEF IA32} +{$ENDIF FPC_LITTLE_ENDIAN} {$ENDIF} diff --git a/src/switches.inc b/src/switches.inc index ac2be7e0..ce41ea3c 100644 --- a/src/switches.inc +++ b/src/switches.inc @@ -14,7 +14,6 @@ {$DEFINE HasInline} {$ELSE} {$DEFINE Delphi} - {$DEFINE FPC_LITTLE_ENDIAN} // Delphi version numbers (ignore versions released before Delphi 6 as they miss the $IF directive): // Delphi 6 (VER140), Delphi 7 (VER150), Delphi 8 (VER160) -- cgit v1.2.3