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
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...Code:MaterialName := 'Texture.tga'; MaterialPath := 'Textures\'; LibMaterial := MaterialLibrary.Materials.GetLibMaterialByName(MaterialName); MaterialLibrary.AddTextureMaterial(MaterialName, MaterialPath + MaterialName); LibMaterial.Material.Texture.Image.LoadFromFile(MaterialPath + 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;
Thanks in advance!
Bookmarks