The background,

Tepid VR seems to have picked up recently, many large factory apps can see some panoramic scenes, such as:

  1. A shell looking for a VR house
  2. A VR car software to see the interior
  3. A letter circle of friends advertising in the broadcast of some panoramic screen
  4. Some panoramic videos from a short video

. But I have to say that these apps are just rubbing off on VR concepts, not real VR technology. Why? The short answer is that VR (virtual reality) emphasizes “allowing people to immerse themselves in the environment created by the computer system”, rather than just using the gyroscope rotation of the mobile phone to see the panoramic content. VR must rely on the head-display device to make the vision completely in the virtual environment.

Ok, the topic is a little bit off, since so many App mobile terminal have panorama control, I also tried a panorama control on the Android platform, I hope you can like it

Ii. About the project

Making the address

Github.com/androidZzT/…

The Demo presentation

Figure 1. Single panorama display

Figure 2. Panorama list display

How to rely on

1. Add jitpack Repositories dependency

allprojects {
  repositories{... maven { url'https://jitpack.io'}}}Copy the code

2. Added VRPanoramaView dependency

dependencies{...// The current version is 1.0.2, keep an eye on the github release
  implementation "Com. Making. AndroidZzT: VRPanoramaView: 1.0.2" 
}
Copy the code

How to use it?

1. Demo is provided in the project, showing the simple usage of single panorama and panorama list

  • A single panoramic image can be used as a normal control
  • You need to display a maximum of several controls on a page based on requirements, and manually reuse the controls. Otherwise, too many controls will cause OOM

2. Interface provided by ZPanoramaTextureView

ZPanoramaTextureView is a core control in the project that renders a panorama and rotates according to the phone’s gyroscope. The core Api has:

  1. #setBitmapUrl(String url) provides the image URL to load the rendered panorama
  2. #reCenter() restores the initial Angle
  3. #setGyroTrackingEnabled(Boolean enable) Switch the gyroscope

What will be supported later?

  1. Gesture control panorama rotation
  2. Asteroid animation (first view of the fall from space to Earth)

Three, about the implementation principle

1. The technology stack

  • Computational Graphics -3D rendering concepts
  • OpenGLES 2.0 Api
  • Android TextureView with OpenGL

2. Principle series articles

Length reasons, 1. Each point in the content can be introduced separately or several articles, the follow-up will continue to update. Very interested students can first look at the source code. Github.com/androidZzT/… , if the chance to click a star, even more grateful!

ZhuanWen statement

If there is a need to reprint the article, please indicate the author and link, thank you for your understanding and support