- Posts: 59
- Thank you received: 0
- Forum
- CodeTyphon Studio
- CodeTyphon Studio Components and Libraries
- Graphics 3D Development
- Project raised exception class 'External:SIGSEGV
Question Project raised exception class 'External:SIGSEGV
- azrael11
-
Topic Author
- Offline
- Junior Member
-
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.
- azrael11
-
Topic Author
- Offline
- Junior Member
-
- Posts: 59
- Thank you received: 0
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.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
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.
- azrael11
-
Topic Author
- Offline
- 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.
- azrael11
-
Topic Author
- Offline
- Junior Member
-
- Posts: 59
- Thank you received: 0
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.
- jfmadre60
- Visitor
-
To solve this kind of problem use the UTF8ToSys function .LoadFromFile(UTF8ToSys(FileName)).
Please Log in or Create an account to join the conversation.
- azrael11
-
Topic Author
- Offline
- 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.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
we will try to solve this problem
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- azrael11
-
Topic Author
- Offline
- Junior Member
-
- Posts: 59
- Thank you received: 0
I will wait about this....
Free minds... with focus in future...
Please Log in or Create an account to join the conversation.