DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Expand DG Kernel ControlsDG Kernel Controls
Expand API ReferenceAPI Reference
Expand ViewsViews
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation LinksHome Page > Models > Entities > Attributes > Appearance > Texture Go to DGKC docs Search Documentation


Textures

Textures are used when the modeled object has a specific pattern on its surface like wood or brick. Textures are bitmaps mapped to the surface of the object.

A texture or a per-face set of them is an atribute of material.

Texture of a specific material can be created by taking a picture with digital camera or using a scanner and saving as a bitmap file.

Textures can be applied only to two-dimensional entities in this version. This means that the entity must have material as its apperance attribute.

Programmatically textures can be manipulated at run time using ITexture_DG interface. See Texture Programming sample for an example. 

Textures are closely related to geometry of the entity. Mapping texture's image to the surface depends on the geometyr type.

BRep geometry

Image of the texture is mapped to the relevant face using the surface's u,v parameters. If the texture was applied for the whole entity using IMaterial_DG.AttachTexture() it will be applied to all faces. 

Use IMaterial_DG.AttachSurfaceTexture() to apply the texture to a specific face. The first parameter in the AttachTexture() method is expected to be an IObject_DG queried from IBRepFace_DG. See Texture sample for an example. Faces, which do not have a texture attached will be rendered using properties of the material.

Mesh Geometry

Texture for a Mesh Entity can be defined at runtime, loaded with an existent .mdg model or imported via VRML, Wavefront .obj and possible via other formats. Please check the full list of supported formats for this version.

To apply a texture to a mesh at runtime, obtain IMeshTexture_DG from IMesh_DG using IMesh_DG.GetTexture(). Call IMeshTexture_DG.LoadTexture() to load the image. Call IMeshTexture_DG.LoadTexelArray() providing an array of floats two per mesh vertex. These are the coordinates (ur,vr) in range [0,1]. k-th (ur,vr) pair maps location of the image to k-th vertex of the mesh. See the Texture sample for an example.

To create a texture manually via VRML, use texCoord and texCoordIndex elements of IndexedFaceSet node. See VRML 2.0 specifications at https://tecfa.unige.ch/guides/vrml/vrml97/spec/ for details. Save the model in .wrl format. Add the above texture elements. After loading the file it can be saved as .mdg model with texture embedded for faster load. Contact us if you need more options.

Textures are saved with the model. Note that textures can increase size of the model dramatically, which can be an issue when models are exchanged via the Internet or e-mail. Also note that textures are using significant amount of operating memory and processing power. Material Editor is a preferred method of Assignment of textures because it reuses the texture for all surfaces in the object.