I am usings Lazarus 1.2.4 and GLSCENE svn 6462 (1.2 svn version)
I add material with this function below
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
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 ...
Ps... if i change the TGLComposite image with TGLPictureImage then works perfect but i dont have the Transparency of the images..
Ps2... After more digging i found that all errors comes from the external LIBPNG so not work well together GLPNGFILE and LIBPNG