Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you don't need to run on Android releases before 3.0 (Honeycomb), you can use the SurfaceTexture output option, and OpenGL ES for rendering multiple previews. </p> <p>Setting up a working OpenGL view is a bit involved, so you'll want to find a guide for that. Once you have that working, create a <a href="http://developer.android.com/reference/android/graphics/SurfaceTexture.html" rel="nofollow">SurfaceTexture</a> object with a OpenGL texture ID you want to use for the preview texture, pass that into the camera with <a href="http://developer.android.com/reference/android/hardware/Camera.html#setPreviewTexture%28android.graphics.SurfaceTexture%29" rel="nofollow">setPreviewTexture</a> instead of using setPreviewDisplay, and then in your OpenGL thread, call <a href="http://developer.android.com/reference/android/graphics/SurfaceTexture.html#updateTexImage%28%29" rel="nofollow">updateTexImage</a> to update the texture to show the latest frame from the camera (best to do so in response to a <a href="http://developer.android.com/reference/android/graphics/SurfaceTexture.OnFrameAvailableListener.html#onFrameAvailable%28android.graphics.SurfaceTexture%29" rel="nofollow">onFrameAvailable</a> callback for best performance).</p> <p>Then you need OpenGL code to render two rectangles for your two copies of preview, and a shader to draw the preview texture on both.</p> <p>This is a decent bit of setup, but in the end, you'll have a very flexible system - then you can animate the preview in various fun ways, etc. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload