什么obj文件可以添加到nglview?

时间:2013-03-14 04:26:31

标签: iphone xcode 3d

我正在制作一个iphone应用程序根据本教程http://www.icodeblog.com/2012/09/07/3856/但是,当试图用我的一些obj文件替换3d obj(地球)时,它不起作用,是否有任何特定的要求obj文件已添加到nglview? 这是viewdidload部分:

    NGLView *tmpView = [[NGLView alloc] initWithFrame:CGRectMake(110, 110, 140, 140)];
// Set its delegate to self so the drawview method is used.

    tmpView.delegate = self;
// Add the new view on top of our existing view. 

    [self.view addSubview:tmpView];
    tmpView.contentScaleFactor = [[UIScreen mainScreen] scale];
    // Setup some initial environment states to be applied to our mesh.
   NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
              kNGLMeshOriginalYes, kNGLMeshKeyOriginal,
              @"1", kNGLMeshKeyNormalize, nil];

// Initialize the mesh which includes the model file to import (.obj or .dae).

_mesh = [[NGLMesh alloc] initWithFile:@"PAN.obj" settings:settings delegate:nil];

// Initialize the camera used to render the scene.
_camera = [[NGLCamera alloc] initWithMeshes:_mesh, nil];

// If a trasparent background of the NGLView is needed
   tmpView.backgroundColor = [UIColor clearColor];
   nglGlobalColorFormat(NGLColorFormatRGBA);
   nglGlobalFlush();

1 个答案:

答案 0 :(得分:0)

nglview NinevehGL 框架的一部分。

NinevehGL是使用纯Obj-C

锻造的3D引擎

以下是community forum for beginners

您可以找到基本课程here