【发布时间】:2016-12-26 05:19:31
【问题描述】:
我在带有 OpenGL 的 Windows 上使用 assimp3.0。我尝试通过以下几行加载和显示层模型:
Assimp::Importer importer;
const aiScene* scene = NULL;
scene = importer.ReadFile('filename', 0);
我用scene->mMeshes[0]->mVertices 建立了顶点缓冲区,用scene->mMeshes[0]->mColors 建立了颜色缓冲区
但是,当我调试代码时,只有scene->mMeshes[0]->mColors[0] 得到了颜色,scene->mMeshes[0]->mColors[1] 并且以下元素仍然为 NULL
以下是我写的一个简短的例子:
ply
format ascii 1.0
comment VCGLIB generated
element vertex 3
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property uchar alpha
element face 1
property list uchar int vertex_indices
end_header
0.0 0.0 0.0 219 227 248 255
1.0 0.0 0.0 220 230 212 255
2.0 0.0 2.0 160 122 221 255
3 0 1 2
我现在想知道是不是importer.ReadFile(pFile,pFlags)的pFlags参数错误造成的。
谁能帮我找出哪一部分出了问题。
【问题讨论】:
-
在 ReadFile 方法中尝试将 pFlags 作为 aiProcessPreset_TargetRealtime_Quality 发送。但是,在这种情况下应该没关系。
-
我试过了,但是除了第一个之外,它仍然不会加载顶点的颜色信息。
标签: c++ opengl glsl assimp ply-file-format