Android 360度全景图片 源码
2014-10-23 17:28
204 查看
先上张效果图
![](http://img.blog.csdn.net/20141023172916553?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3VmMTAyMw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
Google官方写了一个包,专门用来作全景图片的:PanoramaGL.jar。 可自己下载 http://download.csdn.net/detail/wuf1023/8073707
设置显示图片有两种试,第一种是一整张鱼眼式的全景图片;第二种是6张图片合成
不多说,直接上代码
Google官方写了一个包,专门用来作全景图片的:PanoramaGL.jar。 可自己下载 http://download.csdn.net/detail/wuf1023/8073707
设置显示图片有两种试,第一种是一整张鱼眼式的全景图片;第二种是6张图片合成
不多说,直接上代码
public class HelloPanorama extends PLView { @Override protected void onGLContextCreated(GL10 gl) { super.onGLContextCreated(gl); //If you want to use setDeviceOrientationEnabled(true), activity orientation only must be portrait. Eg. android:screenOrientation="portrait" this.setDeviceOrientationEnabled(false); //You can use accelerometer你可以用加速计 //this.setAccelerometerEnabled(true); //this.setAccelerometerUpDownEnabled(true); //this.setAccelerometerSensitivity(0.5f); //this.setAccelerometerLeftRightEnabled(true); //充许滚动 this.setScrollingEnabled(true); //充许惯性 this.setInertiaEnabled(true); //惯性灵敏度 this.setInertiaInterval(0.2f); //旋转灵敏度 this.getCamera().setRotateSensitivity(100f); //缩放灵敏度 this.getCamera().setFovSensitivity(2000); //缩放范围 this.getCamera().setFovRange(PLRange.PLRangeMake(-5.0f, 5.0f)); //初始缩放 this.getCamera().setFov(-5f); try { /* * Important Note: You must edit AndroidManifest.xml and put android:configChanges="keyboardHidden|orientation" attribute in activity else you have memory problems */ //Example with Sphere type (you need one image) this.setType(PLViewType.PLViewTypeSpherical); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.p01))); /* //Example with Cube Faces type (you need an image for each cube face) this.setType(PLViewType.PLViewTypeCubeFaces); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.front))); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.back))); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.left))); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.right))); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.top))); this.addTextureAndRelease(PLTexture.textureWithImage(this.getImageWithResouce(R.drawable.bottom))); */ } catch(Throwable ex) { Log.e("HelloPanorama::onGLContextCreated", "Error:" + ex.getMessage()); } } }
相关文章推荐
- android项目源码异步加载远程图片的小例子
- Android gallery实现图片的左右循环旋转源码分享
- 使用Javascript来创建一个响应式的超酷360度全景图片查看幻灯效果
- android 关于3D 360度全景图demo错误的解决办法
- Android 关于图片文件夹后缀错误,使应用在源码下编译通过却无法运行的错误
- Android 小項目之---Iphone拖动图片特效 (附源码)
- Android下图片或按钮等可拖动到任意位置的效果实现源码
- 使用Javascript来创建一个响应式的超酷360度全景图片查看幻灯效
- Android的ListView异步下载图片官方提供的源码
- Android的图片压缩类ThumbnailUtils,供源码研究 .
- android 加载大图片时报OOM的解决方案(源码)
- Android Jamendo开源在线音乐播放器源码分析七 数据缓存和图片缓存的分析
- android学习笔记16--------------Android实现网络图片与html源码获取
- 使用Javascript来创建一个响应式的超酷360度全景图片查看幻灯效果
- Android的图片压缩类ThumbnailUtils,供源码研究
- android项目源码异步加载远程图片的小例子
- Android的图片浏览源码解读
- android 加载大图片时报OOM的解决方案(源码)
- 如何编译android源码包res的图片资源
- Android图片浏览源码解读