Brainer
02-07-2008, 04:36 AM
:arrow:System: Windows Vista, Pentium D 805 2,66 GHz, GeForce 7600 GS
:arrow:Compiler/IDE: Delphi 2007 for Win32
:arrow:API: OpenGL, Vampyre Imaging Library
Hello men. :)
I have a little problem with my texturing unit. I've noticed that the textures are mirrored. Is it a problem with the graphics library I use or maybe OpenGL can be at fault?
Here (http://i31.tinypic.com/pnix0.jpg) is a screenshot (and for those who don't know, how it should look like, here (http://upload.wikimedia.org/wikipedia/commons/6/6d/Africa_satellite_plane.jpg) is the correct version :wink:) and below is the code I use for loading a texture. Please not that the texture file itself IS NOT mirrored.
procedure TTexture.LoadTexture(TheFile: TFileEntry);
var
ImagesArray: TDynImageDataArray;
MainLevelIndex: Integer;
ImgFormat: TImageFormat;
begin
if LoadMultiImageFromStream(TheFile.TheData, ImagesArray) and
(Length(ImagesArray) > 0) then
begin
case FTexDetail of
tdLow: MainLevelIndex := 2;
tdMedium: MainLevelIndex := 1;
tdHigh: MainLevelIndex := 0;
end;
case FTexComp of
tcNone: ImgFormat := ifUnknown;
tcDXT1: ImgFormat := ifDXT1;
tcDXT3: ImgFormat := ifDXT3;
tcDXT5: ImgFormat := ifDXT5;
end;
FTexHandle := CreateGLTextureFromMultiImage(ImagesArray, 0, 0, True,
MainLevelIndex, ImgFormat);
if (FTexHandle > 0) then
begin
Log.Log('Texture created successfully.', 'UBETexturing');
FTexFile := TheFile.FileName;
end else
Log.Log('Unable to create the texture.', 'UBETexturing');
end else
Log.Log('Unable to load texture.', 'UBETexturing');
TheFile.TheData.Seek(0, soFromBeginning);
FreeImagesInArray(ImagesArray);
end;
Thank you in advance! :)
:arrow:Compiler/IDE: Delphi 2007 for Win32
:arrow:API: OpenGL, Vampyre Imaging Library
Hello men. :)
I have a little problem with my texturing unit. I've noticed that the textures are mirrored. Is it a problem with the graphics library I use or maybe OpenGL can be at fault?
Here (http://i31.tinypic.com/pnix0.jpg) is a screenshot (and for those who don't know, how it should look like, here (http://upload.wikimedia.org/wikipedia/commons/6/6d/Africa_satellite_plane.jpg) is the correct version :wink:) and below is the code I use for loading a texture. Please not that the texture file itself IS NOT mirrored.
procedure TTexture.LoadTexture(TheFile: TFileEntry);
var
ImagesArray: TDynImageDataArray;
MainLevelIndex: Integer;
ImgFormat: TImageFormat;
begin
if LoadMultiImageFromStream(TheFile.TheData, ImagesArray) and
(Length(ImagesArray) > 0) then
begin
case FTexDetail of
tdLow: MainLevelIndex := 2;
tdMedium: MainLevelIndex := 1;
tdHigh: MainLevelIndex := 0;
end;
case FTexComp of
tcNone: ImgFormat := ifUnknown;
tcDXT1: ImgFormat := ifDXT1;
tcDXT3: ImgFormat := ifDXT3;
tcDXT5: ImgFormat := ifDXT5;
end;
FTexHandle := CreateGLTextureFromMultiImage(ImagesArray, 0, 0, True,
MainLevelIndex, ImgFormat);
if (FTexHandle > 0) then
begin
Log.Log('Texture created successfully.', 'UBETexturing');
FTexFile := TheFile.FileName;
end else
Log.Log('Unable to create the texture.', 'UBETexturing');
end else
Log.Log('Unable to load texture.', 'UBETexturing');
TheFile.TheData.Seek(0, soFromBeginning);
FreeImagesInArray(ImagesArray);
end;
Thank you in advance! :)