6. Rendering

When ARGSession.drawFrame is called, it starts to render video frames with various effects such as item, filter, and beauty. Which effects should be applied is determined by how the ARGear configuration is set.

ARGSession.drawFrame returns ARGFrame as a result, which contains texture id and configured information in ARGInferenceConfig.Feature.

From the application layer, you can draw the effects applied frames easily as the following sample code.

// Sample Renderer Code in Application Layer 
ScreenRenderer mScreenRenderer = new ScreenRenderer();

GLView.GLViewListener glViewListener = new GLView.GLViewListener() {
    @Override
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        mScreenRenderer.create(gl, config);
    }

    @Override
    public void onDrawFrame(GL10 gl, int width, int height) {
        ARGFrame frame = argsession.drawFrame(gl, width, height);
        mScreenRenderer.draw(frame, ARGFrame.Ratio.RATIO_4_3, width, height);
    }
};

Last updated