You need to build the normals, one normal for each triangle.
var
I : Integer;
IntegerList : TIntegerList;
MeshObject : TMeshObject;
begin
IntegerList := TIntegerList.Create;
for I := 0 to MeshObject.Vertices.Count -1 do begin
IntegerList.Add(I);
end;
MeshObject.BuildNormals(IntegerList, momTriangles);
IntegerList.Free;
end;
\Lars
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I had a problem like you . I did your way. But I came across a new problem. I make normals . When I rotate the scene with the mouse, the newly created mesh objects spin independently or perhaps just show back of mesh instead front. I also made front color adjustments (GLFreeForm1.Material.FrontProperties.Diffuse.SetColor), but there is still problem . What do you think is the solution to my problem?
Thanks.
Last edit: Mostafa 2018-11-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm using a TGLFreeForm to dinamically create a mesh surface using
TMeshObject.Vertices.Add.
Mesh is well formed but the showed result is all in same white color,
without any perspective of Z plane.
If I save result mesh to a file then I reload it the mesh has a good
Z plane perspective.
Why are so different ?
What I've missed in mesh construction to have same result than reload file ?
Thank you very much
and best regards
GLSC
Last edit: shine world 2017-11-16
PS: I'm unsing GLScene glscene_v_1000714 for NON UNICODE Delphi
Last edit: shine world 2017-11-16
Hi,
You need to build the normals, one normal for each triangle.
var
I : Integer;
IntegerList : TIntegerList;
MeshObject : TMeshObject;
begin
IntegerList := TIntegerList.Create;
for I := 0 to MeshObject.Vertices.Count -1 do begin
IntegerList.Add(I);
end;
MeshObject.BuildNormals(IntegerList, momTriangles);
IntegerList.Free;
end;
\Lars
Thank you very much Inebel,
the code worked very fine, now my mesh is like I want.
Have you a nice day.
Hi,
I had a problem like you . I did your way. But I came across a new problem. I make normals . When I rotate the scene with the mouse, the newly created mesh objects spin independently or perhaps just show back of mesh instead front. I also made front color adjustments (GLFreeForm1.Material.FrontProperties.Diffuse.SetColor), but there is still problem . What do you think is the solution to my problem?
Thanks.
Last edit: Mostafa 2018-11-02