public class RenderTexture extends SFMLNativeObject implements RenderTarget
Constructor and Description |
---|
RenderTexture()
Constructs a new render texture.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the target with black.
|
void |
clear(Color color)
Clears the render target and fills it with a constant color.
|
void |
create(int width,
int height)
Sets up the render texture without a depth buffer.
|
void |
create(int width,
int height,
boolean depthBuffer)
Sets up the render texture.
|
void |
display()
Updates the contents of the target texture.
|
void |
draw(Drawable drawable)
Draws a drawable object to the render target using the default render states.
|
void |
draw(Drawable drawable,
RenderStates renderStates)
Draws a drawable object to the render target using the given render states.
|
void |
draw(Vertex[] vertices,
PrimitiveType type)
Draws a primitive of the given type using the given vertices and the default render states.
|
void |
draw(Vertex[] vertices,
PrimitiveType type,
RenderStates states)
Draws a primitive of the given type using the given vertices and the given render states.
|
ConstView |
getDefaultView()
Gets the target's default view.
|
Vector2i |
getSize()
Gets the size of the render region.
|
ConstTexture |
getTexture()
Gets the target texture.
|
ConstView |
getView()
Gets the target's current view.
|
IntRect |
getViewport(ConstView view)
Computes the viewport of the given view applied to this render target.
|
boolean |
isRepeated()
Checks whether texture repeating is enabled for the underlying texture.
|
boolean |
isSmooth()
Checks whether texture smoothing is enabled.
|
Vector2i |
mapCoordsToPixel(Vector2f point)
Converts a point from world coordinates to target coordinates using the target's
current view.
|
Vector2i |
mapCoordsToPixel(Vector2f point,
ConstView view)
Converts a point from world coordinates to target coordinates for a certain view.
|
Vector2f |
mapPixelToCoords(Vector2i point)
Converts a point from target coordinates to world coordinates using the target's
current view.
|
Vector2f |
mapPixelToCoords(Vector2i point,
ConstView view)
Converts a point from target coordinates to world coordinates for a certain view.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
void |
popGLStates()
Pops the last OpenGL states and matrices from the top of the stack.
|
void |
pushGLStates()
Pushes the current OpenGL states and matrices to the stack.
|
void |
resetGLStates()
Resets the internal OpenGL states so that the target is ready for drawing.
|
void |
setActive(boolean active)
Activates or deactivates the render texture for rendering.
|
void |
setRepeated(boolean repeated)
Enables or disables texture repeating for the underlying texture.
|
void |
setSmooth(boolean smooth)
Enables or disables textures smoothing.
|
void |
setView(ConstView view)
Sets the target's view.
|
finalize
@Deprecated protected long nativeCreate()
SFMLNativeObject
nativeCreate
in class SFMLNativeObject
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
nativeSetExPtr
in class SFMLNativeObject
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class SFMLNativeObject
public void create(int width, int height, boolean depthBuffer) throws TextureCreationException
width
- the texture's width.height
- the texture's height.depthBuffer
- true
to generate a depth buffer, false
otherwise.
Use this only in case you wish to do 3D rendering to this texture.TextureCreationException
- if the render texture could not be created.public final void create(int width, int height) throws TextureCreationException
width
- the texture's width.height
- the texture's height.TextureCreationException
- if the render texture could not be created.public void setSmooth(boolean smooth)
smooth
- true
to enable, false
to disable.public boolean isSmooth()
true
if enabled, false
if not.public void setRepeated(boolean repeated)
repeated
- true
to enable, false
to disable.public boolean isRepeated()
true
if enabled, false
if disabled.public void setActive(boolean active)
active
- true
to activate, false
to deactivate.public void display()
public ConstTexture getTexture()
public Vector2i getSize()
RenderTarget
getSize
in interface RenderTarget
public void clear(Color color)
RenderTarget
clear
in interface RenderTarget
color
- the color to fill the target with.public void clear()
public void setView(ConstView view)
RenderTarget
setView
in interface RenderTarget
view
- the target's new view.public ConstView getView()
RenderTarget
getView
in interface RenderTarget
public ConstView getDefaultView()
RenderTarget
getDefaultView
in interface RenderTarget
public IntRect getViewport(ConstView view)
RenderTarget
getViewport
in interface RenderTarget
view
- the view.public final Vector2f mapPixelToCoords(Vector2i point)
RenderTarget
mapPixelToCoords
in interface RenderTarget
point
- the point on the render target.public Vector2f mapPixelToCoords(Vector2i point, ConstView view)
RenderTarget
mapPixelToCoords
in interface RenderTarget
point
- the point on the render target.view
- the view to use for conversion.public final Vector2i mapCoordsToPixel(Vector2f point)
RenderTarget
mapCoordsToPixel
in interface RenderTarget
point
- the point in the world.public Vector2i mapCoordsToPixel(Vector2f point, ConstView view)
RenderTarget
mapCoordsToPixel
in interface RenderTarget
point
- the point in the world.view
- the view to use for conversion.public final void draw(Drawable drawable)
RenderTarget
draw
in interface RenderTarget
drawable
- the object to draw.public void draw(Drawable drawable, RenderStates renderStates)
RenderTarget
draw
in interface RenderTarget
drawable
- the object to draw.renderStates
- the render states to use for drawing.public final void draw(Vertex[] vertices, PrimitiveType type)
RenderTarget
draw
in interface RenderTarget
vertices
- the vertices to draw.type
- the type of OpenGL primitive to draw.public void draw(Vertex[] vertices, PrimitiveType type, RenderStates states)
RenderTarget
draw
in interface RenderTarget
vertices
- the vertices to draw.type
- the type of OpenGL primitive to draw.states
- the render states to use for drawing.public void pushGLStates()
RenderTarget
pushGLStates
in interface RenderTarget
public void popGLStates()
RenderTarget
popGLStates
in interface RenderTarget
public void resetGLStates()
RenderTarget
resetGLStates
in interface RenderTarget