Class RenderTarget

java.lang.Object
rosequartz.gfx.RenderTarget

public class RenderTarget extends Object
Acts as a target for all graphic rendering to a texture.
  • Constructor Details

  • Method Details

    • getCurrent

      public static RenderTarget getCurrent()
      Gets the current render target (or null if none is used).
      Returns:
      the current render target (or null if none used)
    • getDefault

      public static RenderTarget getDefault()
      Gets the default render target. Render to this RenderTarget to display it on the game window.
      Returns:
      RenderTarget-object visible to user
      See Also:
      RenderTarget
    • getWidth

      public int getWidth()
      Gets the width of the target.
      Returns:
      target width
    • getHeight

      public int getHeight()
      Gets the height of the target.
      Returns:
      target height
    • getTexture

      public Texture getTexture()
      Gets the texture that is rendered to.
      Returns:
      texture that is rendered to
    • target

      Selects this target as the current render target.
      Returns:
      this
      Throws:
      NotOnGraphicsThreadException
    • blit

      public RenderTarget blit​(float srcX1, float srcY1, float srcX2, float srcY2, RenderTarget target, float destX1, float destY1, float destX2, float destY2) throws NotOnGraphicsThreadException
      Blits this render target onto the given target.
      Parameters:
      srcX1 - position of the bottom left corner of the area to blit from on the x-axis
      srcY1 - position of the bottom left corner of the area to blit from on the y-axis
      srcX2 - position of the top right corner of the area to blit from on the x-axis
      srcY2 - position of the top right corner of the area to blit from on the y-axis
      target - target to render to
      destX1 - position of the bottom left corner of the area to blit to on the x-axis
      destY1 - position of the bottom left corner of the area to blit to on the y-axis
      destX2 - position of the top right corner of the area to blit to on the x-axis
      destY2 - position of the top right corner of the area to blit to on the y-axis
      Returns:
      this
      Throws:
      NotOnGraphicsThreadException
    • blit

      public RenderTarget blit​(Vec2 src1, Vec2 src2, RenderTarget target, Vec2 dest1, Vec2 dest2) throws NotOnGraphicsThreadException
      Blits this render target onto the given target.
      Parameters:
      src1 - position of the bottom left corner of the area to blit from
      src2 - position of the top right corner of the area to blit from
      target - target to render to
      dest1 - position of the bottom left corner of the area to blit to
      dest2 - position of the top right corner of the area to blit to
      Returns:
      this
      Throws:
      NotOnGraphicsThreadException
    • clearColor

      public RenderTarget clearColor​(float red, float green, float blue, float alpha) throws NotOnGraphicsThreadException
      Clears the render target with a specific color.
      Parameters:
      red - the amount of red in the color to clear with ranging from 0 to 1
      green - the amount of green in the color to clear with ranging from 0 to 1
      blue - the amount of blue in the color to clear with ranging from 0 to 1
      alpha - the amount of alpha in the color to clear with ranging from 0 to 1
      Returns:
      this
      Throws:
      NotOnGraphicsThreadException
    • clearDepth

      public RenderTarget clearDepth​(float depth) throws NotOnGraphicsThreadException
      Clears this render target's depth information to a specific value.
      Returns:
      this
      Throws:
      NotOnGraphicsThreadException
    • toString

      public String toString()
      Overrides:
      toString in class Object