# Interface Renderer

public interface Renderer
Application supplied callback that drives the contents of a `RenderView`. The methods are always invoked on the platform render thread that owns the GPU context; never touch Codename One UI components directly from these callbacks. Use `RenderView.requestRender()` or `RenderView.setContinuous(boolean)` to schedule frames.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onDispose(GraphicsDevice device)`
  Invoked when the GPU context is being torn down (for example when the view is removed from the UI).
  `void`
  `onFrame(GraphicsDevice device)`
  Invoked once per frame to render the scene.
  `void`
  `onInit(GraphicsDevice device)`
  Invoked once after the GPU context and its `GraphicsDevice` have been created and are current.
  `void`
  `onResize(GraphicsDevice device, int width, int height)`
  Invoked when the drawable surface size changes, including once after initialization.

- ## Method Details

  - ### onInit

    void onInit(GraphicsDevice device)

    Invoked once after the GPU context and its `GraphicsDevice` have been created and are current. Allocate buffers, textures and materials here.

    ###### Parameters

    - `device`: the graphics device bound to this view

  - ### onResize

    void onResize(GraphicsDevice device, int width, int height)

    Invoked when the drawable surface size changes, including once after initialization. Reconfigure projection matrices and viewports here.

    ###### Parameters

    - `device`: the graphics device bound to this view

    - `width`: the new drawable width in pixels

    - `height`: the new drawable height in pixels

  - ### onFrame

    void onFrame(GraphicsDevice device)

    Invoked once per frame to render the scene. Issue draw calls against the supplied device.

    ###### Parameters

    - `device`: the graphics device bound to this view

  - ### onDispose

    void onDispose(GraphicsDevice device)

    Invoked when the GPU context is being torn down (for example when the view is removed from the UI). Release any resources that are not owned by the device. May be invoked with a null device when the context was lost.

    ###### Parameters

    - `device`: the graphics device bound to this view, or null if the context was already lost