私は 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 ... TGLComposite 画像を TGLPictureImage で変更すると完璧に動作しますが、画像の透明度がありません..
Ps2...さらに掘り下げた後、すべてのエラーが外部LIBPNGから発生しているため、GLPNGFILEとLIBPNGがうまく連携しないことがわかりました