Package rosequartz.gfx
Class RenderTarget
java.lang.Object
rosequartz.gfx.RenderTarget
Acts as a target for all graphic rendering to a texture.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblit(float srcX1, float srcY1, float srcX2, float srcY2, RenderTarget target, float destX1, float destY1, float destX2, float destY2)Blits this render target onto the given target.Blits this render target onto the given target.clearColor(float red, float green, float blue, float alpha)Clears the render target with a specific color.clearDepth(float depth)Clears this render target's depth information to a specific value.static RenderTargetGets the current render target (or null if none is used).static RenderTargetGets the default render target.intGets the height of the target.Gets the texture that is rendered to.intgetWidth()Gets the width of the target.target()Selects this target as the current render target.toString()
-
Constructor Details
-
RenderTarget
Creates a render target to a texture.- Parameters:
texture- the texture to render to- Throws:
NotOnGraphicsThreadException
-
-
Method Details
-
getCurrent
Gets the current render target (or null if none is used).- Returns:
- the current render target (or null if none used)
-
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
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 NotOnGraphicsThreadExceptionBlits this render target onto the given target.- Parameters:
srcX1- position of the bottom left corner of the area to blit from on the x-axissrcY1- position of the bottom left corner of the area to blit from on the y-axissrcX2- position of the top right corner of the area to blit from on the x-axissrcY2- position of the top right corner of the area to blit from on the y-axistarget- target to render todestX1- position of the bottom left corner of the area to blit to on the x-axisdestY1- position of the bottom left corner of the area to blit to on the y-axisdestX2- position of the top right corner of the area to blit to on the x-axisdestY2- 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 NotOnGraphicsThreadExceptionBlits this render target onto the given target.- Parameters:
src1- position of the bottom left corner of the area to blit fromsrc2- position of the top right corner of the area to blit fromtarget- target to render todest1- position of the bottom left corner of the area to blit todest2- 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 NotOnGraphicsThreadExceptionClears the render target with a specific color.- Parameters:
red- the amount of red in the color to clear with ranging from 0 to 1green- the amount of green in the color to clear with ranging from 0 to 1blue- the amount of blue in the color to clear with ranging from 0 to 1alpha- the amount of alpha in the color to clear with ranging from 0 to 1- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
clearDepth
Clears this render target's depth information to a specific value.- Returns:
- this
- Throws:
NotOnGraphicsThreadException
-
toString
-