ARGear SDK Documentations
  • Introduction
  • Android
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Overview
    • 4. ARGSession
    • 5. Camera
    • 6. Rendering
    • 7. CMS Service
    • 8. Download Contents
    • 9. Set Contents
    • 10. Media
    • 11. Switch Camera Face
    • 12. Enable Debugging Mode
    • 13. ARCore Connect API
    • 14. API Reference
  • iOS
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Overview
    • 4. ARGSession
    • 5. Camera
    • 6. Rendering
    • 7. CMS Service
    • 8. Download Contents
    • 9. Set Contents
    • 10. Media
    • 11. Switch Camera Face
    • 12. Enable Debugging Mode
    • 13. ARKit Connect API
    • 14. API Reference
  • Unity
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Plugin Overview
    • 4. ARGearManager
    • 5. ARGearCamera
    • 6. CMS Service
    • 7. Download Contents
    • 8. Set Contents
    • 9. Switch Camera Face
    • 10. Enable Debugging Mode
    • 11. API Reference
Powered by GitBook
On this page

Was this helpful?

  1. Android

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);
    }
};
var screenRenderer = ScreenRenderer()

private var glViewListener: GLView.GLViewListener = object : GLView.GLViewListener {
    override fun onSurfaceCreated(
        gl: GL10?,
        config: EGLConfig?
    ) {
        screenRenderer.create(gl, config)
    }

    override fun onDrawFrame(gl: GL10?, width: Int?, height: Int?) {

        val localWidth = width ?: 0
        val localHeight = height ?: 0
         val frame = argSession.drawFrame(gl, ARGFrame.Ratio.RATIO_4_3, localWidth, localHeight)
        frame?.let {
            screenRenderer.draw(it, localWidth, localHeight)
        }
    }
}

Previous5. CameraNext7. CMS Service

Last updated 5 years ago

Was this helpful?