Class GpuImplementation

java.lang.Object
com.codename1.impl.gpu.GpuImplementation

public abstract class GpuImplementation extends Object

Per-platform backend for the portable 3D GPU API. A platform that supports com.codename1.gpu.RenderView returns a single GpuImplementation from CodenameOneImplementation.getGpuImplementation(); platforms without a 3D backend return null. Grouping the peer factory and its lifecycle hooks into one class lets each port segregate all of its GPU wiring in one place instead of scattering individual overrides across the platform implementation.

This type is internal: applications interact with the GPU API through RenderView and com.codename1.gpu.GraphicsDevice, never with this class.

  • Constructor Details

    • GpuImplementation

      public GpuImplementation()
  • Method Details

    • createPeer

      public abstract PeerComponent createPeer(RenderView view)

      Creates the native GPU peer that backs a RenderView. The peer owns the platform GPU context and drives the view's Renderer.

      Parameters
      • view: the render view requesting a peer
      Returns

      the native GPU peer, or null if a peer could not be created

    • setContinuous

      public abstract void setContinuous(PeerComponent peer, boolean continuous)

      Sets whether a GPU peer renders continuously or only on demand.

      Parameters
      • peer: a peer previously returned from createPeer

      • continuous: true to render every frame

    • requestRender

      public abstract void requestRender(PeerComponent peer)

      Requests that a GPU peer render a single frame. No effect in continuous mode.

      Parameters
      • peer: a peer previously returned from createPeer