Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Hi friends I want to draw mesh on 2d image as shown in this image, below I have given code, but application is crashing and no error message is displaying...so facing difficulty to identify the problem.

   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];

Please refert this link for refrence image and crash snapshot as i dont have privilage yet to upload the images.

share|improve this question

closed as too localized by bummzack, Byte56, Sean Middleditch, Josh Petrie, Anko Apr 10 at 11:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.