2013-10-11 2 views
2

http://heikobehrens.net/2009/08/27/obj2opengl/에서 banana.h 파일을 다운로드했습니다. EAGLView.mm에 .h 파일을 포함 시켰습니다. 나는 EAGLView.mm 파일을 대체했다. 나는 주전자를 다른 3D 모달로 대체하기위한 지시를 따랐다. 그러나 나는 교체를위한 출력을 얻지 못했습니다.은 주전자를 바나나로 바꿀 수 없습니다

glVertexPointer(3, GL_FLOAT, 0, bananaVerts);  
glNormalPointer(GL_FLOAT, 0, bananaNormals); 
glTexCoordPointer(2, GL_FLOAT, 0, bananaTexCoords); 
glDrawArrays(GL_TRIANGLES, 0, bananaNumVerts); 

가 어디에서 실수를 않았다 내가 renderFrame에서 실수

namespace {  
    // Teapot texture filenames  
    const char* textureFilenames[] = {  
    "banana.jpg",  
    /* 

    "TextureTeapotBrass.png", 
    "TextureTeapotBlue.png", 
    "TextureTeapotRed.png" 
    */ 
    } 

    // Model scale factor 
    const float kObjectScale = 3.0f; 
} 

- (void) setup3dObjects  
{  
    // build the array of objects we want drawn and their texture  
    // in this example we have 3 targets and require 3 models 
    // but using the same underlying 3D model of a teapot, differentiated 
    // by using a different texture for each 

    for (int i=0; i < [textures count]; i++) 
    { 
     Object3D *obj3D = [[Object3D alloc] init]; 
    // obj3D.numVertices = NUM_TEAPOT_OBJECT_VERTEX; 

     obj3D.numVertices =bananaNumVerts; 
     obj3D.vertices = bananaVerts; 
     obj3D.normals = bananaNormals; 
     obj3D.texCoords = bananaTexCoords; 
     obj3D.numIndices = 0; 
     obj3D.indices = nil; 
     obj3D.texture = [textures objectAtIndex:i]; 

     [objects3D addObject:obj3D]; 
     [obj3D release]; 
    } 
} 

했다 대체 어디 있는지 몰라?

+0

여기에 대한 토론이 있습니다. https://developer.vuforia.com/forum/ios/different-3d-model-not-shown (아래에서 위로 읽음) – ashatte

답변

1

코드가 맞습니다. 모델이 매우 작을 수 있으므로 크기를 늘려보십시오. 변경

const float kObjectScale = 50.0f; // Scale up 

또한 질감에는 .png 형식을 사용하십시오.