小编Rif*_*tus的帖子

在 OpenGL 中渲染 .ply 文件

因此,我能够从 .ply 文件中读出我需要的顶点、法线和索引,并将它们写入 VBO。但是,我没有得到正确的形状。看来我的指数已关闭。

这是我的结构:

typedef struct vtx {
    float x, y, z;
    float nx, ny, nz;
} vtx;

typedef struct Face {
    unsigned int count;
    unsigned int *vertices;
    float nx, ny, nz;
} Face;

typedef struct PLY_vals {
    Face **f;
    vtx **v;
    unsigned int vcount;
    unsigned int fcount;
    int norms;
    float center[3];
} PLY_vals;
Run Code Online (Sandbox Code Playgroud)

设置顶点和三角形:

nindices = ply.fcount * 3;
nvertices = ply.vcount;
pindices = new GLuint[nindices];
plyverts = new Vertex[nvertices];

for (int i = 0; i < nvertices; …
Run Code Online (Sandbox Code Playgroud)

c++ opengl rendering

3
推荐指数
1
解决办法
3188
查看次数

标签 统计

c++ ×1

opengl ×1

rendering ×1