Lucas
09-11-2014, 06:13 PM
Hello everyone,
is there some native function in GLScene to detect an image's bit depth? In particular, I'm interested in checking if the alpha channel is present or not as I noticed that once loaded into memory they are treated as RGBA regardless of their "real" pixel format. To save memory and processing power I would like to do something like this
MaterialName := 'Texture.tga';
MaterialPath := 'Textures\';
LibMaterial := MaterialLibrary.Materials.GetLibMaterialByName(Mat erialName);
MaterialLibrary.AddTextureMaterial(MaterialName, MaterialPath + MaterialName);
LibMaterial.Material.Texture.Image.LoadFromFile(Ma terialPath + MaterialName);
If ImageOnDiskHasAlpha(MaterialPath + MaterialName) Then
Begin
LibMaterial.Material.Texture.TextureFormat := tfRGBA; //Probably superfluous
LibMaterial.Material.BlendingMode := bmAlphaTest50;
End
Else
Begin
LibMaterial.Material.Texture.TextureFormat := tfRGB;
End;
It was probably asked countless times in the past, but for the life of me I could not find anything. Maybe I was using the wrong search words...
Thanks in advance! ;)
is there some native function in GLScene to detect an image's bit depth? In particular, I'm interested in checking if the alpha channel is present or not as I noticed that once loaded into memory they are treated as RGBA regardless of their "real" pixel format. To save memory and processing power I would like to do something like this
MaterialName := 'Texture.tga';
MaterialPath := 'Textures\';
LibMaterial := MaterialLibrary.Materials.GetLibMaterialByName(Mat erialName);
MaterialLibrary.AddTextureMaterial(MaterialName, MaterialPath + MaterialName);
LibMaterial.Material.Texture.Image.LoadFromFile(Ma terialPath + MaterialName);
If ImageOnDiskHasAlpha(MaterialPath + MaterialName) Then
Begin
LibMaterial.Material.Texture.TextureFormat := tfRGBA; //Probably superfluous
LibMaterial.Material.BlendingMode := bmAlphaTest50;
End
Else
Begin
LibMaterial.Material.Texture.TextureFormat := tfRGB;
End;
It was probably asked countless times in the past, but for the life of me I could not find anything. Maybe I was using the wrong search words...
Thanks in advance! ;)