我正在使用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
在执行加注EInvalidRasterFile.Create之前(&#39;无效的PNG文件&#39;);
获得SIGSEGV ..
所以任何人都可以提供帮助......
Ps ...如果我用TGLPictureImage更改TGLComposite图像然后工作完美但我没有图像的透明度..
Ps2 ......经过多次挖掘后,我发现所有错误都来自外部LIBPNG 所以GLPNGFILE和LIBPNG不能很好地协同工作
答案 0 :(得分:1)
我的* .png纹理设置:
类名称:TGLCompositeImage
alpha:tiaDefault
纹理模式:tmAdd