public interface Renderer
Known subtypesSpriteRenderer
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.Methods
public abstract void onInit(GraphicsDevice device) | Invoked once after the GPU context and its GraphicsDevice have been created and are current. |
public abstract void onResize(GraphicsDevice device, int width, int height) | Invoked when the drawable surface size changes, including once after initialization. |
public abstract void onFrame(GraphicsDevice device) | Invoked once per frame to render the scene. |
public abstract void onDispose(GraphicsDevice device) | Invoked when the GPU context is being torn down (for example when the view is removed from the UI). |
Method details
onInit
public abstract 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
deviceGraphicsDevice- the graphics device bound to this view
onResize
public abstract 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
deviceGraphicsDevice- the graphics device bound to this view
widthint- the new drawable width in pixels
heightint- the new drawable height in pixels
onFrame
public abstract void onFrame(GraphicsDevice device)Invoked once per frame to render the scene. Issue draw calls against the
supplied device.
Parameters
deviceGraphicsDevice- the graphics device bound to this view
onDispose
public abstract 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
deviceGraphicsDevice- the graphics device bound to this view, or null if the context was already lost