こんにちは、私はこの画像に示すように 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];