我正在使用 Lazarus 1.2.4 和 GLSCENE svn 6462(1.2 svn 版本)
我在下面添加具有此功能的材料
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;
当我运行它时,我收到以下错误
Project One raised exception class "External : SIGSEGV"
尝试一些挖掘发现,当 pngimage 尝试从流中加载时
177
CODE
if _png_sig_cmp(@sig, 0, 8) <> 0 then
在执行 raise EInvalidRasterFile.Create('Invalid PNG file'); 之前
获取 SIGSEGV ..
所以任何人都可以帮助...
Ps ...如果我用 TGLPictureImage 更改 TGLComposite 图像,那么效果很好,但我没有图像的透明度..
Ps2 ...经过更多挖掘后,我发现所有错误都来自外部 LIBPNG,因此 GLPNGFILE 和 LIBPNG 不能很好地协同工作