public class

BackgroundRenderer

extends Object
java.lang.Object
   ↳ com.vidinoti.android.vdarsdk.arcore.rendering.BackgroundRenderer

Class Overview

This class renders the AR background from camera feed. It creates and hosts the texture given to ARCore to be filled with the camera image. See https://github.com/google-ar/arcore-android-sdk/blob/master/samples/hello_ar_java/app/src/main/java/com/google/ar/core/examples/java/common/rendering/BackgroundRenderer.java

Summary

Public Constructors
BackgroundRenderer()
Public Methods
void createOnGlThread(Context context)
Allocates and initializes OpenGL resources needed by the background renderer.
void draw(int imageWidth, int imageHeight, float screenAspectRatio, int cameraToDisplayRotation)
Draws the camera image using the currently configured BackgroundRenderer#quadTexCoords image texture coordinates.
void draw(Frame frame)
Draws the AR background image.
int getTextureId()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public BackgroundRenderer ()

Public Methods

public void createOnGlThread (Context context)

Allocates and initializes OpenGL resources needed by the background renderer. Must be called on the OpenGL thread, typically in onSurfaceCreated(GL10, EGLConfig).

Parameters
context Needed to access shader source.
Throws
IOException

public void draw (int imageWidth, int imageHeight, float screenAspectRatio, int cameraToDisplayRotation)

Draws the camera image using the currently configured BackgroundRenderer#quadTexCoords image texture coordinates.

The image will be center cropped if the camera sensor aspect ratio does not match the screen aspect ratio, which matches the cropping behavior of Frame#transformCoordinates2d(Coordinates2d, float[], Coordinates2d, float[]).

public void draw (Frame frame)

Draws the AR background image. The image will be drawn such that virtual content rendered with the matrices provided by com.google.ar.core.Camera#getViewMatrix(float[], int) and com.google.ar.core.Camera#getProjectionMatrix(float[], int, float, float) will accurately follow static physical objects. This must be called before drawing virtual content.

Parameters
frame The current Frame as returned by Session#update().

public int getTextureId ()