【发布时间】:2015-05-20 04:18:32
【问题描述】:
我正在使用 Cocos3D 加载3D Skeleton model (exported from Blender),但得到以下断言:
*** Assertion failure in -[CC3OpenGLES2IOS drawIndicies:ofLength:andType:as:], /Users/phamdacloc/Downloads/xxx/cocos3d201/Projects/CC3HelloWorld/cocos3d/cocos3d/OpenGL/CC3OpenGL.m:282
这是断言的来源:
-(void) drawIndicies: (GLvoid*) indicies ofLength: (GLuint) len andType: (GLenum) type as: (GLenum) drawMode {
#if CC3_OGLES
CC3Assert((type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_BYTE),
@"OpenGL ES permits drawing a maximum of 65536 indexed vertices, and supports only"
@" GL_UNSIGNED_SHORT or GL_UNSIGNED_BYTE types for vertex indices");
#endif
glDrawElements(drawMode, len, type, indicies);
LogGLErrorTrace(@"glDrawElements(%@, %u, %@, %p)", NSStringFromGLEnum(drawMode), len, NSStringFromGLEnum(type), indicies);
CC_INCREMENT_GL_DRAWS(1);
}
根据上面的信息,我的理解是模型过于详细,包含的顶点数量超过了允许的数量(65536)。然后我移除了所有的脊髓、头部、腿部,这一次 Cocos3D 加载成功。有没有办法保留所有这些顶点,或者我应该将模型分成几个 .pod 文件?
附带说明,当我在“对象模式”中打开 skeleton.blend 文件时,我在 Blender 的右上角看到 205,407 个顶点。但是,当我从“对象模式”更改为“编辑模式”并选择所有顶点时,只存在 33,574 + 4,773 = 38,347 个顶点。为什么“对象模式”显示的顶点比“编辑模式”多?
【问题讨论】:
标签: opengl-es-2.0 blender cocos3d