0

I am trying to import POD file 3d object(export from Blender using) into my ipad using ISGL3D frameworks. I did not get any error but my ipad only show black screen. I try to debug line by line and it seems like is the camera problem.

Here are my code in HelloWorldView:

- (id) init {

if ((self = [super init])) {

    container = [[self.scene createNode] retain];

    // Import pod data
    _podImporter = [Isgl3dPODImporter podImporterWithFile:@"ee.pod"];
    Isgl3dLight * light  = [Isgl3dLight lightWithHexColor:@"000000" diffuseColor:@"FFFFFF" specularColor:@"FFFFFF" attenuation:0.001];
    light.position = iv3(0, 0, 2);
    light.renderLight = YES;
    [container addChild:light];
///Problem seems to start from below
    [self.camera removeFromParent];
    self.camera = [_podImporter cameraAtIndex:0];
    [self.scene addChild:self.camera];


    role01 = [_podImporter meshNodeWithName:@"Sphere"];
    [vound addChild:role01];

    [self schedule:@selector(tick:)];
}
return self;}

I tried to add just the 3d object with out the _podImporter camera and I get exception that it cannot locate my 3d object. Please help and thanks!

sooon
  • 4,718
  • 8
  • 63
  • 116

1 Answers1

0

Took me a while to find out the problem:

I missed out this code:

[_podImporter buildSceneObjects];

So the proper code to get podImporter to work is

- (id) init {

if ((self = [super init])) {

container = [[self.scene createNode] retain];

// Import pod data
_podImporter = [Isgl3dPODImporter podImporterWithFile:@"ee.pod"];

[_podImporter buildSceneObjects];///<--- Put it here or anywhere before the camera code

Isgl3dLight * light  = [Isgl3dLight lightWithHexColor:@"000000" diffuseColor:@"FFFFFF" specularColor:@"FFFFFF" attenuation:0.001];
light.position = iv3(0, 0, 2);
light.renderLight = YES;
[container addChild:light];
[self.camera removeFromParent];
self.camera = [_podImporter cameraAtIndex:0];
[self.scene addChild:self.camera];


role01 = [_podImporter meshNodeWithName:@"Sphere"];
[vound addChild:role01];

[self schedule:@selector(tick:)];

} return self;}

sooon
  • 4,718
  • 8
  • 63
  • 116