2

i want to write a ModelViewer to load many models in my Scene. so how can i create GLMaterialLibrary in run time and assign it to FreeForms Objects in RunTime? and i want to know how can i find the name of submodel's texture. TanX for Help.

Hamid
  • 71
  • 5

1 Answers1

0

First of all, you do not need to create GlMaterialLibrary at run time as you can use single instance of GLMaterialLibriary for all scene GLFreeForms and dynamicaly link it to a new freeform. A TFreeForm or TActor can automatically setup the materials and load the textures from a 3DS files. You must first add a material library component to a form (which will store the materials, once the 3DS is loaded), then link the FreeForm to this material library and set

UseMeshMaterials := true;

After doing this, when loading the 3DS mesh, the importer will add new materials to the material library (using the names defined in the 3DS file), which you can later alter if you so wish. Be aware that the image formats must be supported, for instance if your textures are JPeg files, you must add "JPeg" to your uses. And least but not last: GLScene comes with a very good pack of demos that you can check for refference. ..\Demos\materials\ folder contains everything what you need.

Kainax
  • 1,306
  • 14
  • 24