glscene

 

TGLLibMaterial

Page history last edited by skinhat 4 yrs ago

The TGLLibMaterial is a texture in the material library (TGLMaterialLibrary). The texture itself is contained in the material property (TGLMaterial). TGLLibMaterial has properties for texture offsetting, scaling, defining a secondary texture and shading.
Texture offsetting is used to move a texture. For example to display moving clouds it is possible to create a plane with a cloud texture then offset the texture in the cadencer to give the appearence of smoothly moving clouds.

TGLMaterialLibrary has a texture2name property and is used to overlay a second texture over the top of another texture. This is useful for providing detail to a texture. For example you may define a plane with a brick texture on it then provide a secondary texture that provides grainy detail so that when a camera comes up close to the wall it grainy detail appears.
A shader is used to shade a texture at run time. A shader can be used for bump mapping.

To assign a material in the TGLMaterialLibrary to a GLScene object set the materialLibrary in the material property to a GLMaterialLibrary. Then in the GLScene objects material property set the LibMaterialName to name of the material in the TGLMaterialLibrary. This to can be done design time.

Rather assign a texture to a GLScene object in the material library it is possible to load a texture into a GLScene Object directly (eg TGLMaterial.texture.image.loadfromfile('texture.jpg')). The disadvantage of loading a texture directly is that the texture cannot be shared with other GLScene objects. Also it is not possible to offset, scale, shade or specify a secondary texture if a texture from a material library isnt used.

Important TGLLibMaterial properties:

material: TGLMaterial Holds the texture

textureoffset TGLCoordinates: Vector to offset the texture in the x or y direction

texturescale TGLCoordinates: Vector scale the texture in the x or y direction

texture2name: Specify the name of the secondary texture

shader: TGLShader Shader used by the texture

Unit: GLTexture

Descends from TCollectionItem.

Comments (0)

You don't have permission to comment on this page.