GLScene
GLScene copied to clipboard
Assigning a material library to a TGLFreeForm
Hi,
I have loaded a TGLFreeForm component with a 3ds file, used a TGMaterialLibrary to store the 3ds materials. I have also created another Material Library with grey scale versions of the 3ds materials, but I can't assign this material library to the FreeForm.
This works with the Material Library assigned to the FreeForm (GLS_Icon) when the 3ds file is loaded :
procedure TForm1.Button2Click(Sender: TObject);
begin
GLScene1.BeginUpdate();
GLS_Icon.MaterialLibrary := NormalMaterials; //Materials created when loading the 3ds file.
GLCone1.Material.MaterialLibrary := NormalMaterials;
GLScene1.EndUpdate();
end;

This doesn't work with the designtime created material library:
procedure TForm1.Button1Click(Sender: TObject);
begin
GLScene1.BeginUpdate();
GLS_Icon.MaterialLibrary := DisabledMaterials; //The designtime library with grey scale versions of the NormalMaterials
GLCone1.Material.MaterialLibrary := DisabledMaterials;
GLScene1.EndUpdate();
end;

Any hints would be helpful.
Cheers.
I have worked it out! The created Material Library needs the same material names as the 3ds material library.
That's right, there are already names of materials there