index e7bcbcf99e89db1f8cd72da1bb77423ea1bde9fd..e53a3ef263fdd9033c454fe49b70b929c0f74685 100644 (file)
+{$MODE DELPHI}
unit e_textures;
{ This unit provides interface to load 24-bit and 32-bit uncompressed images
end;
var
+ e_DummyTextures: Boolean = False;
TEXTUREFILTER: Integer = GL_NEAREST;
function CreateTexture(var tex: GLTexture; Width, Height, aFormat: Word; pData: Pointer ): Boolean;
e_WriteLog(Format('NPOT: orig is %ux%u; gl is %ux%u; u=%f; v=%f', [Width, Height, tex.glwidth, tex.glheight, tex.u, tex.v]), MSG_NOTIFY);
end;
+ if e_DummyTextures then
+ begin
+ tex.id := GLuint(-1);
+ Result := True;
+ Exit;
+ end;
+
glGenTextures(1, @Texture);
tex.id := Texture;
glBindTexture(GL_TEXTURE_2D, Texture);
Exit;
end;
+ if (TGAHeader.ImageInfo and $c0) <> 0 then
+ begin
+ e_WriteLog('Error loading texture: interleaved TGA', MSG_WARNING);
+ Exit;
+ end;
+
Width := TGAHeader.Width[0] + TGAHeader.Width[1] * 256;
Height := TGAHeader.Height[0] + TGAHeader.Height[1] * 256;
BPP := TGAHeader.BPP;
Back^ := Temp;
end;
+ //if (TGAHeader.ImageInfo and $20) <> 0 then UpsideDown(Image, Width, Height);
+
if ( BPP = 24 ) then
TFmt := GL_RGB
else
Exit;
end;
+ if (TGAHeader.ImageInfo and $c0) <> 0 then
+ begin
+ e_WriteLog('Error loading texture: interleaved TGA', MSG_WARNING);
+ Exit;
+ end;
+
Width := TGAHeader.Width[0] + TGAHeader.Width[1] * 256;
Height := TGAHeader.Height[0] + TGAHeader.Height[1] * 256;
BPP := TGAHeader.BPP;
for i := 0 to fHeight-1 do
CopyMemory( PByte(image) + a*i, Base + b*i, a );
+ //if (TGAHeader.ImageInfo and $20) <> 0 then UpsideDown(Image, Width, Height);
+
if ( BPP = 24 ) then
TFmt := GL_RGB
else