glscene

 

TGLMesh

Page history last edited by skinhat 4 yrs ago

Creates a mesh. The mesh can be made out triangles, quads (squares), polygons or strips.

A mesh is created by adding vertices. If triangles are used to make the mesh then adding 3 vertices will create one triangle. If quads are used then adding 4 vertices will create a quad. For example the following code will create a red 1x1 square if quads are used.

   glmesh1.Vertices.clear;

   glmesh1.vertices.AddVertex(affinevectormake(0,0,0),nullvector,clrRed);

   glmesh1.vertices.AddVertex(affinevectormake(1,0,0),nullvector,clrRed);

   glmesh1.vertices.AddVertex(affinevectormake(1,1,0),nullvector,clrRed);

   glmesh1.vertices.AddVertex(affinevectormake(0,1,0),nullvector,clrRed);

Another quad can be added by adding another 4 vertices.

The mesh vertices should be cleared on start up because there are default vertices that are added automatically to the mesh.

Important TGLMesh properties includes:

mode:TMeshMode

The shape types that are used to make up the mesh. For example triangles, quads or polygons

vertices: TVertexList

The list of vertices that make up the mesh. If the mesh is made of quads then it will be the vertices of each of the 4 points of the quad.

vertexmode: TVertexMode

The information that is defined when adding a vertex. For example whether or not the color of the vertex is included.

Demo: CVS/Demos/meshes/formula

Unit: GLMesh

Descends from TGLSceneObject.

Comments (0)

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