Package icyllis.arc3d.opengl

# Class GLRenderTarget

java.lang.Object
icyllis.arc3d.engine.Resource
icyllis.arc3d.engine.GpuSurface
icyllis.arc3d.engine.GpuRenderTarget
icyllis.arc3d.opengl.GLRenderTarget

All Implemented Interfaces:
  `RefCounted`

public final class GLRenderTarget extends GpuRenderTarget
Represents OpenGL framebuffers.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.arc3d.engine.GpuRenderTarget

  `GpuRenderTarget.ResourceKey`

- ## Field Summary

  ### Fields inherited from class icyllis.arc3d.engine.GpuRenderTarget

  `mSurfaceFlags`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `bindStencil()`
  Make sure the stencil attachment is valid.
  `protected boolean`
  `canAttachStencil()`
  `BackendFormat`
  `getBackendFormat()`
  Describes the backend format of color buffers.
  `BackendRenderTarget`
  `getBackendRenderTarget()`
  Describes the backend render target of this render target.
  `@RawPtr GLTexture`
  `getColorAttachment()`
  `@RawPtr GLTexture`
  `getColorAttachment(int index)`
  `@RawPtr GLTexture[]`
  `getColorAttachments()`
  `int`
  `getDepthBits()`
  Get the number of implicit depth bits, or 0 if no depth.
  `@RawPtr GLTexture`
  `getDepthStencilAttachment()`
  Get the dynamic or implicit stencil buffer, or null if no stencil.
  `protected GLDevice`
  `getDevice()`
  `int`
  `getRenderFramebuffer()`
  `@RawPtr GLTexture`
  `getResolveAttachment()`
  `@RawPtr GLTexture`
  `getResolveAttachment(int index)`
  `@RawPtr GLTexture[]`
  `getResolveAttachments()`
  `int`
  `getResolveFramebuffer()`
  `int`
  `getStencilBits()`
  Get the number of implicit stencil bits, or 0 if no stencil.
  `boolean`
  `isProtected()`
  `static @SharedPtr GLRenderTarget`
  `makeWrapped(Context context, int width, int height, BackendFormat format, int sampleCount, int framebuffer, int depthBits, int stencilBits, boolean ownership)`
  Make a `GLRenderTarget` that wraps existing framebuffers without accessing their backing buffers (texture and stencil).
  `protected void`
  `onRelease()`
  Subclass should override this method to free GPU resources in the backend API.
  `String`
  `toString()`

  ### Methods inherited from class icyllis.arc3d.engine.GpuRenderTarget

  `asImage, asRenderTarget, getHeight, getSampleCount, getSurfaceFlags, getWidth, numColorTargets`

  ### Methods inherited from class icyllis.arc3d.engine.Resource

  `getContext, getKey, getLabel, getMemorySize, getUniqueID, hasAnyRefs, hasCacheRef, hasCommandBufferRef, hasUsageRef, isBudgeted, isDestroyed, isPurgeable, isWrapped, onSetLabel, ref, refCommandBuffer, setKey, setLabel, setNonCacheable, unref, unrefCommandBuffer`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### makeWrapped

    @Nonnull @SharedPtr public static @SharedPtr GLRenderTarget makeWrapped(Context context, int width, int height, BackendFormat format, int sampleCount, int framebuffer, int depthBits, int stencilBits, boolean ownership)
    Make a `GLRenderTarget` that wraps existing framebuffers without accessing their backing buffers (texture and stencil).
    Parameters:
      `width` - the effective width of framebuffer
      `height` - the effective height of framebuffer

  - ### getRenderFramebuffer

    public int getRenderFramebuffer()

  - ### getResolveFramebuffer

    public int getResolveFramebuffer()

  - ### bindStencil

    public void bindStencil()
    Make sure the stencil attachment is valid. Even though a color buffer op doesn't use stencil, our FBO still needs to be "framebuffer complete". If this render target is already bound, this method ensures the stencil attachment is valid (attached or detached), if stencil buffers reset right before.

  - ### getBackendFormat

    @Nonnull public BackendFormat getBackendFormat()
    Description copied from class: `GpuRenderTarget`
    Describes the backend format of color buffers.
    Specified by:
      `getBackendFormat` in class `GpuRenderTarget`

  - ### isProtected

    public boolean isProtected()
    Specified by:
      `isProtected` in class `GpuSurface`
    Returns:
      true if we are working with protected content

  - ### getColorAttachment

    @RawPtr @Nullable public @RawPtr GLTexture getColorAttachment()
    Specified by:
      `getColorAttachment` in class `GpuRenderTarget`

  - ### getColorAttachment

    @RawPtr @Nullable public @RawPtr GLTexture getColorAttachment(int index)
    Specified by:
      `getColorAttachment` in class `GpuRenderTarget`

  - ### getColorAttachments

    @RawPtr @Nullable public @RawPtr GLTexture[] getColorAttachments()
    Specified by:
      `getColorAttachments` in class `GpuRenderTarget`

  - ### getResolveAttachment

    @RawPtr @Nullable public @RawPtr GLTexture getResolveAttachment()
    Specified by:
      `getResolveAttachment` in class `GpuRenderTarget`

  - ### getResolveAttachment

    @RawPtr @Nullable public @RawPtr GLTexture getResolveAttachment(int index)
    Specified by:
      `getResolveAttachment` in class `GpuRenderTarget`

  - ### getResolveAttachments

    @RawPtr @Nullable public @RawPtr GLTexture[] getResolveAttachments()
    Specified by:
      `getResolveAttachments` in class `GpuRenderTarget`

  - ### getDepthStencilAttachment

    @RawPtr @Nullable public @RawPtr GLTexture getDepthStencilAttachment()
    Description copied from class: `GpuRenderTarget`
    Get the dynamic or implicit stencil buffer, or null if no stencil.
    Specified by:
      `getDepthStencilAttachment` in class `GpuRenderTarget`

  - ### getDepthBits

    public int getDepthBits()
    Description copied from class: `GpuRenderTarget`
    Get the number of implicit depth bits, or 0 if no depth.
    Specified by:
      `getDepthBits` in class `GpuRenderTarget`

  - ### getStencilBits

    public int getStencilBits()
    Description copied from class: `GpuRenderTarget`
    Get the number of implicit stencil bits, or 0 if no stencil.
    Specified by:
      `getStencilBits` in class `GpuRenderTarget`

  - ### getBackendRenderTarget

    @Nonnull public BackendRenderTarget getBackendRenderTarget()
    Description copied from class: `GpuRenderTarget`
    Describes the backend render target of this render target.
    Specified by:
      `getBackendRenderTarget` in class `GpuRenderTarget`

  - ### canAttachStencil

    protected boolean canAttachStencil()
    Specified by:
      `canAttachStencil` in class `GpuRenderTarget`
    Returns:
      whether a stencil buffer can be attached to this render target.

  - ### onRelease

    protected void onRelease()
    Description copied from class: `Resource`
    Subclass should override this method to free GPU resources in the backend API.
    Specified by:
      `onRelease` in class `Resource`

  - ### getDevice

    protected GLDevice getDevice()
    Overrides:
      `getDevice` in class `Resource`
    Returns:
      the device or null if destroyed

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`