azrael11 - 2014-10-03

I add material with this function above

"

function AddMaterial(aMatLib: TGlMaterialLibrary; aFileName, aMaterialName: string): TGlLibMaterial; overload;
begin
result := aMatLib.Materials.Add;
with result do
begin
with Material do
begin
if aFileName= 'Fast_Blur' then
begin
MaterialOptions:= [moNoLighting];
Texture.Disabled:= true;
Texture.TextureMode:= tmDecal;
BlendingMode:= bmModulate;
end
else
begin
MaterialOptions := [moIgnoreFog, moNoLighting];
Texture.Disabled := false;
Texture.TextureMode:= tmModulate;
BlendingMode := bmTransparency;
end;
with FrontProperties do
begin
Ambient.SetColor(1, 1, 1, 1);
if aFileName= 'Fast_Blur' then
Diffuse.SetColor(204,204,204,1)
else
Diffuse.SetColor(1, 1, 1, 1);
Emission.SetColor(1, 1, 1, 1);
Specular.SetColor(1, 1, 1, 1);
end;
Texture.ImageClassName:= 'TGLCompositeImage';

  if aFileName<> 'Fast_Blur' then
    begin
      if ExtractFileExt(aFileName) = '.bmp' then
        TGLCompositeImage(Texture.Image).LoadFromFile(aFileName)
      else if ExtractFileExt(aFileName) = '.tga' then
        begin
          TGLCompositeImage(Texture.Image).LoadFromFile(aFileName);
        end
      else if ExtractFileExt(aFileName) = '' then
        TGLCompositeImage(Texture.Image).LoadFromFile(aFileName + '.png');
    end;
end;
Name := aMaterialName;

end;
end;

"

When i run it i get the above error

"

"Project One raised exception class "External : SIGSEGV""
"

Try some digging find that when the pngimage try to load from stream in line
"

177

CODE
if _png_sig_cmp(@sig, 0, 8) <> 0 then

"

And before execute the raise EInvalidRasterFile.Create('Invalid PNG file');

get the SIGSEGV..

So anybody can help ...