public abstract class ARActivity extends Activity implements CameraEventListener
supplyFrameLayout
.
To create a custom AR experience, the subclass should also provide a custom renderer using
supplyRenderer
. This allows the subclass to handle OpenGL drawing calls on its own.Modifier and Type | Field and Description |
---|---|
protected FrameLayout |
mainLayout
Layout that will be filled with the camera preview and GL views.
|
protected ARRenderer |
renderer
Renderer to use.
|
protected static java.lang.String |
TAG
Android logging tag for this class.
|
Constructor and Description |
---|
ARActivity() |
Modifier and Type | Method and Description |
---|---|
void |
cameraPreviewFrame(byte[] frame)
Called when the camera preview has a new frame ready.
|
void |
cameraPreviewStarted(int width,
int height,
int rate,
int cameraIndex,
boolean cameraIsFrontFacing)
Called when the camera preview is started.
|
void |
cameraPreviewStopped()
Called when the capture preview is stopped.
|
CaptureCameraPreview |
getCameraPreview()
Returns the camera preview that is providing the video frames.
|
GLSurfaceView |
getGLView()
Returns the GL surface view.
|
void |
onCreate(Bundle savedInstanceState) |
boolean |
onCreateOptionsMenu(Menu menu) |
void |
onFrameProcessed() |
boolean |
onOptionsItemSelected(MenuItem item) |
protected void |
onPause() |
void |
onResume() |
protected void |
onStart() |
void |
onStop() |
protected void |
showInfo() |
protected abstract FrameLayout |
supplyFrameLayout()
Allows subclasses to supply a
FrameLayout which will be populated
with a camera preview and GL surface view. |
protected abstract ARRenderer |
supplyRenderer()
Allows subclasses to supply a custom
Renderer . |
protected static final java.lang.String TAG
protected ARRenderer renderer
supplyRenderer()
.protected FrameLayout mainLayout
supplyFrameLayout()
.public void onCreate(Bundle savedInstanceState)
protected abstract ARRenderer supplyRenderer()
Renderer
.Renderer
to use.protected abstract FrameLayout supplyFrameLayout()
FrameLayout
which will be populated
with a camera preview and GL surface view.FrameLayout
to use.protected void onStart()
public void onResume()
protected void onPause()
public void onStop()
public boolean onCreateOptionsMenu(Menu menu)
public boolean onOptionsItemSelected(MenuItem item)
public CaptureCameraPreview getCameraPreview()
public GLSurfaceView getGLView()
public void cameraPreviewStarted(int width, int height, int rate, int cameraIndex, boolean cameraIsFrontFacing)
CameraEventListener
cameraPreviewStarted
in interface CameraEventListener
width
- The width of the video image in pixels.height
- The height of the video image in pixels.rate
- The capture rate in frames per second.cameraIndex
- Zero-based index of the camera in use. If only one camera is present, will be 0.cameraIsFrontFacing
- false if camera is rear-facing (the default) or true if camera is facing toward the user.public void cameraPreviewFrame(byte[] frame)
CameraEventListener
cameraPreviewFrame
in interface CameraEventListener
frame
- A byte array from the camera, in the camera's capture format.public void onFrameProcessed()
public void cameraPreviewStopped()
CameraEventListener
cameraPreviewStopped
in interface CameraEventListener
protected void showInfo()