Video camera 3D is displayed simultaneously in an activity.

Source: Internet
Author: User

Video must be displayed in the adroid. The requirements for camera and 3D are as follows:

1) video is displayed at the end and full screen

2) if 3D is displayed in the middle and no image is required to be transparent, you can see the following video in a place without 3D images.

3) camera is displayed at the top layer.

 

The implementation scheme is as follows:

1) create a surfaceview for video

2) create a glsurfaceview for 3D

3) create a surfaceview for camera

The reference code is as follows:

Mediaview = (surfaceview) findviewbyid (R. Id. media_surfaceview );
Cameraview = (surfaceview) findviewbyid (R. Id. camera_surfaceview );

Glview = new gl2jniview (getapplication (), true, 16, 0 );

// Place glview in the middle
Glview. setzordermediaoverlay (true );

// Put cameraview at the top
Cameraview. setzorderontop (true );

Linearlayout. layoutparams para = new linearlayout. layoutparams (linearlayout. layoutparams. fill_parent,
Linearlayout. layoutparams. fill_parent );

This. addcontentview (mglview, para );

For details about glsurface transparency, see ndk samples gl2jniview.

Of course, before reneder a frame, you shocould call: glclearcolor)

 

3D transparency has two key points:

1. glsurfaceview must be transparent.

2. the OpenGL render must be transparent.

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.