iPhone开发之全景展示(panoramagl)

1 //相应地方添加成员变量
2 plView = [[PLView alloc] initWithFrame:self.view.frame];
3 plView.delegate=self;
4 [self.view addSubview:plView];
5 [self.view sendSubviewToBack:plView];//送到最里端
 1 -(void)selectPanorama:(NSInteger)index
 2 {
 3     NSObject<PLIPanorama> *panorama = nil;
 4     //Spherical2 panorama example (supports up 2048x1024 texture)
 5     if(index == 0)
 6     {
 7         panorama = [PLSpherical2Panorama panorama];
 8         [(PLSpherical2Panorama *)panorama setImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere2" ofType:@"jpg"]]];
 9     }
10     //Spherical panorama example (supports up 1024x512 texture)
11     else if(index == 1)
12     {
13         panorama = [PLSphericalPanorama panorama];
14         [(PLSphericalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]];
15     }
16     //Cubic panorama example (supports up 1024x1024 texture per face)
17     else if(index == 2)
18     {
19         PLCubicPanorama *cubicPanorama = [PLCubicPanorama panorama];
20         [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_f" ofType:@"jpg"]]] face:PLCubeFaceOrientationFront];
21         [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_b" ofType:@"jpg"]]] face:PLCubeFaceOrientationBack];
22         [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_l" ofType:@"jpg"]]] face:PLCubeFaceOrientationLeft];
23         [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_r" ofType:@"jpg"]]] face:PLCubeFaceOrientationRight];
24         [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_u" ofType:@"jpg"]]] face:PLCubeFaceOrientationUp];
25         [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_d" ofType:@"jpg"]]] face:PLCubeFaceOrientationDown];
26         panorama = cubicPanorama;
27     }
28     //Cylindrical panorama example (supports up 1024x1024 texture)
29     else if(index == 3)
30     {
31         panorama = [PLCylindricalPanorama panorama];
32         //((PLCylindricalPanorama *)panorama).isHeightCalculated = NO;
33         [(PLCylindricalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]];
34     }
35 }

两个下载地址:http://code.google.com/p/panoramagl/

https://github.com/menssen/panoramagl#51-with-interface-builder

另有介绍使用的:http://www.codeproject.com/Articles/60635/Panorama-360-iPod-Touch-iPhone

原文地址:https://www.cnblogs.com/ubersexual/p/3366149.html