Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 为什么';我的网格没有出现吗?_Delphi_Firemonkey - Fatal编程技术网

Delphi 为什么';我的网格没有出现吗?

Delphi 为什么';我的网格没有出现吗?,delphi,firemonkey,Delphi,Firemonkey,我正在用Delphi和FMX创建一个应用程序,我正在自己直接创建网格。我不明白的是为什么这个网格没有出现: Mesh.Data.VertexBuffer.Length := 4; Mesh.Data.IndexBuffer.Length := 6; with Mesh.Data.VertexBuffer do begin Vertices[0] := TPoint3D.Create( 1, 1, 0); Vertices[1] := TPoint3D.Create( 1, -

我正在用Delphi和FMX创建一个应用程序,我正在自己直接创建网格。我不明白的是为什么这个网格没有出现:

Mesh.Data.VertexBuffer.Length := 4;
Mesh.Data.IndexBuffer.Length := 6;

with Mesh.Data.VertexBuffer do
begin
    Vertices[0] := TPoint3D.Create( 1,  1, 0);
    Vertices[1] := TPoint3D.Create( 1, -1, 0);
    Vertices[2] := TPoint3D.Create(-1, -1, 0);
    Vertices[3] := TPoint3D.Create(-1,  1, 0);

    TexCoord0[0] := TPointF.Create(0, 1);
    TexCoord0[1] := TPointF.Create(0, 1);
    TexCoord0[2] := TPointF.Create(0, 1);
    TexCoord0[3] := TPointF.Create(0, 1);
end;

with Mesh.Data.IndexBuffer do
begin
    Indices[0] := 0;
    Indices[1] := 1;
    Indices[2] := 2;

    Indices[3] := 2;
    Indices[4] := 3;
    Indices[5] := 0;
end;

网格有一个彩色材质,但是当我运行它时,网格不会出现。其他所有操作(立方体和网格)。

答案是将网格设置为双面真,然后我可以看到它。我确实尝试旋转对象,但仍然看不到任何东西。

答案是将网格设置为TwoSide true,然后我可以看到它。我确实尝试旋转对象,但仍然看不到任何东西。

您编写的代码似乎还可以。摄像机指向正确的方向吗?什么是材质属性,它有发射,如果有光源的话,光源的环境颜色是什么?我通过在网格中添加一个子对象来检查相机,结果显示。我用了淡绿色的材料。你写的代码看起来还可以。摄像机指向正确的方向吗?什么是材质属性,它有发射,如果有光源的话,光源的环境颜色是什么?我通过在网格中添加一个子对象来检查相机,结果显示。我用了淡绿色的材料。