Welcome, Guest
Username: Password: Remember me
Components and Libraries for Graphics 3D Development, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5541

  • azrael11
  • azrael11's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 59
  • Thank you received: 0
Hi...

Try to add a material in materiallibrary
with the code below
function AddMaterial(aMatLib: TGlMaterialLibrary; aFileName,
  aMaterialName: string): TGlLibMaterial;
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
            begin
              if ExtractFileExt(aFileName) = '' then
                TGLCompositeImage(Texture.Image).LoadFromFile(aFileName + '.png')
              else
                TGLCompositeImage(Texture.Image).LoadFromFile(aFileName);
            end;
        end;
    end;
    Name := aMaterialName;
  end;
end;

in the line TGLCompositeImage(Texture.Image).LoadFromFile(aFilename);
I get the "Project raised exception class 'External:SIGSEGV"

The material library is set ok
And the aFilename is set ok

Any Help Please...

Thank you...
Free minds... with focus in future...

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5546

  • azrael11
  • azrael11's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 59
  • Thank you received: 0
After some debugging i found in the GLFilePNG the
procedure TGLPNGImage.LoadFromFile(const filename: string);
var
  fs: TStream;
begin
  if FileStreamExists(fileName) then
  begin
    fs := CreateFileStream(fileName, fmOpenRead);
    try
      LoadFromStream(fs); //[color=#bb0044]<--- Here is i get the error when it tries to load from the Stream....[/color]
    finally
      fs.Free;
      ResourceName := filename;
    end;
  end
  else
    raise EInvalidRasterFile.CreateFmt('File %s not found', [filename]);
end;

Please help... i'm stuck...
Thank you ...
Free minds... with focus in future...

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5547

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4538
  • Thank you received: 1116
My suggestion Sir
Create a TImage
Load your photo to this TImage
Assign to GLMaterialLibrary1.Materials[0].Material.Texture.Image
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
 GLMaterialLibrary1.Materials[0].Material.Texture.Image.Assign(Image1.Picture);

You can find a lot of code samples to codetyphon\CodeOcean\GLScene\samples\materials\
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5548

  • azrael11
  • azrael11's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 59
  • Thank you received: 0

sternas wrote: My suggestion Sir
Create a TImage
Load your photo to this TImage
Assign to GLMaterialLibrary1.Materials[0].Material.Texture.Image

Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
 GLMaterialLibrary1.Materials[0].Material.Texture.Image.Assign(Image1.Picture);

You can find a lot of code samples to codetyphon\CodeOcean\GLScene\samples\materials\


Thank you sternas for the suggestion...
But i try to move a large project for delphi 7 to CodeTyphoon....
This function is to imported for me...

So in more debugging i found this...

in procedure
procedure TGLPNGImage.LoadFromStream(stream: TStream);
var
  sig: array[0..7] of Byte;
  png_ptr: png_structp;
  info_ptr: png_infop;
  colorType, bitDepth: Integer;
  rowBytes: Cardinal;
  rowPointers: array of PGLUbyte;
  ii: Integer;
  use16: Boolean;
begin
  stream.Read(sig, 8);

  if _png_sig_cmp(@sig, 0, 8) <> 0 then //<--- here i get from the debugger ",msg="Cannot find bounds of current function""
    raise EInvalidRasterFile.Create('Invalid PNG file');

  png_ptr := _png_create_read_struct(ZLIB_VERSION, nil, pngErrorFn, pngWarnFn);

......

Thank you...
Free minds... with focus in future...

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5549

  • azrael11
  • azrael11's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 59
  • Thank you received: 0
More tests gives me that....

I add a line to load a jpg image
if aFileName<> 'Fast_Blur' then
        begin
          if ExtractFilePath(aFileName) = '.jpg' then
            TGLCompositeImage(Texture.Image).LoadFromFile(aFileName)

Test the same image in .bmp and jpeg format

WORKS GREAT... so
The problem is the GLPNGImage in LoadFromFile procedure...

I hope i send you enough data to correct the problem...
Please solve it soon...

Thank you...
Free minds... with focus in future...

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5550

  • jfmadre60
  • jfmadre60's Avatar
  • Visitor
  • Visitor
See if the problem is not accentuated letter or not basic ASCII letter in the path or the name of the file. Then try with a file and a path with no accentuated letter...
To solve this kind of problem use the UTF8ToSys function .LoadFromFile(UTF8ToSys(FileName)).

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5551

  • azrael11
  • azrael11's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 59
  • Thank you received: 0

jfmadre60 wrote: See if the problem is not accentuated letter or not basic ASCII letter in the path or the name of the file. Then try with a file and a path with no accentuated letter...
To solve this kind of problem use the UTF8ToSys function .LoadFromFile(UTF8ToSys(FileName)).


I check it everything you propose but nothing working with GLPNGImage... :(

Thanks...
Free minds... with focus in future...

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5552

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4538
  • Thank you received: 1116
Thanks Sir
we will try to solve this problem
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Project raised exception class 'External:SIGSEGV 10 years 6 months ago #5558

  • azrael11
  • azrael11's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 59
  • Thank you received: 0
Thank you ....
I will wait about this....
Free minds... with focus in future...

Please Log in or Create an account to join the conversation.

  • Page:
  • 1