Iphone 在二维图像cocos3d上绘制网格

Iphone 在二维图像cocos3d上绘制网格,iphone,opengl-es,cocos3d,Iphone,Opengl Es,Cocos3d,嗨,朋友们,我想在2d图像上绘制网格,如下图所示,下面我已经给出了代码,但应用程序正在崩溃,并且没有显示错误消息…因此很难识别问题 float arr_location[] = {0.0,0.0,0.0, 0.0,1.0, 0.0, 1.0,1.0,0.0, 1.0,0.0,0.0}; CC3VertexLocations* Vlocation = [[CC3VertexLocations vertexArrayWithName:@"demoLocation"] reta

嗨,朋友们,我想在2d图像上绘制网格,如下图所示,下面我已经给出了代码,但应用程序正在崩溃,并且没有显示错误消息…因此很难识别问题

    float arr_location[] = {0.0,0.0,0.0,  0.0,1.0, 0.0,  1.0,1.0,0.0, 1.0,0.0,0.0};

CC3VertexLocations* Vlocation = 
    [[CC3VertexLocations vertexArrayWithName:@"demoLocation"] retain];
Vlocation.drawingMode = GL_TRIANGLES;//
Vlocation.vertexCount = 3;
Vlocation.vertices = arr_location;

    float arr_normal[] = {0.0,0.0,-1.0};
CC3VertexNormals* normal = [[CC3VertexNormals vertexArrayWithName:@"demoNormal"] retain];
normal.vertexCount = 1;
normal.vertices = arr_normal;

    float arr_indice[] = {0,1,2};
CC3VertexIndices* demoIndices = [CC3VertexIndices vertexArrayWithName: @"demoIndicies"];
demoIndices.drawingMode = GL_TRIANGLES;
demoIndices.vertexCount = 3;
demoIndices.vertices = arr_indice;

CC3VertexArrayMesh* demoMeshModel = 
     [[CC3VertexArrayMesh meshWithName:@"demoMeshModel"] retain];
demoMeshModel.vertexLocations = Vlocation;
demoMeshModel.vertexNormals = normal;
demoMeshModel.vertexIndices = demoIndices;

CC3PlaneNode *meshNode = [[CC3PlaneNode alloc] init];
meshNode.mesh = demoMeshModel;
meshNode.material = [CC3Material shiny];
meshNode.texture = [CC3Texture textureFromFile: @"2.jpg"];

[self addChild: meshNode];


我认为cocos2d不可能做到这一点,它看起来像3D实际上,你可以用OpenGL ES做到这一点,虽然我不确定具体如何,但还没有在如此低的级别上工作,但是如果你可以使用,那么使用
CC3PlaneNode
并将图片设置为纹理就相当容易了。我建议您阅读并再次询问是否还有其他问题