0

我正在根据本教程http://www.icodeblog.com/2012/09/07/3856/制作一个 iphone 应用程序,但是,当尝试用我的一些 obj 文件替换 3d obj(earth) 时,它没有工作,对添加的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();
4

1 回答 1

0

nglviewNinevehGL框架的一部分。

NinevehGL是纯Obj-C打造的3D引擎

这是初学者的社区论坛

你可以在这里找到基础课程

于 2013-03-14T05:06:05.417 回答