Recent

Author Topic: Get an SIGSEGV error when add a PNGImage in TGLCompositeImage  (Read 1741 times)

azrael11

  • New Member
  • *
  • Posts: 18
Get an SIGSEGV error when add a PNGImage in TGLCompositeImage
« on: October 08, 2014, 04:05:34 pm »
I am usings Lazarus 1.2.4 and GLSCENE svn 6462 (1.2 svn version)

I add material with this function below

Code: [Select]
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 below error

Code: [Select]
Project One raised exception class "External : SIGSEGV"
Try some digging find that when the pngimage try to load from stream in line

Code: [Select]
177    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 ...

Ps... if i change the TGLComposite image with TGLPictureImage then works perfect but i dont have the Transparency of the images..

Thanks...

azrael11

  • New Member
  • *
  • Posts: 18
Re: Get an SIGSEGV error when add a PNGImage in TGLCompositeImage
« Reply #1 on: October 12, 2014, 07:49:25 am »
After some digging i found that something goes wrong when the GLPNGImage runs functions from LibPng ...

Some help please...
Thank you...

 

TinyPortal © 2005-2018