Struct sfml::graphics::RenderTexture
source · pub struct RenderTexture { /* private fields */ }
Expand description
Target for off-screen 2D rendering into a texture
Implementations§
source§impl RenderTexture
impl RenderTexture
sourcepub fn new(width: u32, height: u32) -> Option<RenderTexture>
pub fn new(width: u32, height: u32) -> Option<RenderTexture>
Construct a new render texture
Arguments
- width - Width of the render texture
- height - Height of the render texture
Returns None
if creation fails.
sourcepub fn with_settings(
width: u32,
height: u32,
settings: &ContextSettings
) -> Option<Self>
pub fn with_settings(
width: u32,
height: u32,
settings: &ContextSettings
) -> Option<Self>
Create a RenderTexture
with the given ContextSettings
.
Useful if you want to enable multi-sampling or use the render-texture for
OpenGL rendering that requires a depth or stencil buffer.
Otherwise it is unnecessary, and you should call RenderTexture::new
.
Parameters
- width - Width of the render-texture
- height - Height of the render-texture
- settings - Additional settings for the underlying OpenGL texture and context
Returns None
if creation fails.
sourcepub fn set_active(&mut self, active: bool) -> bool
pub fn set_active(&mut self, active: bool) -> bool
Activate or deactivate a render texture as the current target for rendering
Arguments
- active - true to activate, false to deactivate
sourcepub fn texture(&self) -> &Texture
pub fn texture(&self) -> &Texture
Get the target texture of a render texture
Return the target texture
sourcepub fn set_smooth(&mut self, smooth: bool)
pub fn set_smooth(&mut self, smooth: bool)
Enable or disable the smooth filter on a render texture
Arguments
- smooth - true to enable smoothing, false to disable it
sourcepub fn is_smooth(&self) -> bool
pub fn is_smooth(&self) -> bool
Tell whether the smooth filter is enabled or not for a render texture
Return true if smoothing is enabled, false if it is disabled
sourcepub fn set_repeated(&mut self, repeated: bool)
pub fn set_repeated(&mut self, repeated: bool)
Enable or disable texture repeating.
This function is similar to Texture::setRepeated
. This parameter is disabled by default.
sourcepub fn is_repeated(&self) -> bool
pub fn is_repeated(&self) -> bool
Tell whether the texture is repeated or not.
sourcepub unsafe fn generate_mipmap(&mut self) -> bool
pub unsafe fn generate_mipmap(&mut self) -> bool
Generate a mipmap using the current texture data.
This function is similar to Texture::generate_mipmap
and
operates on the texture used as the target for drawing.
Safety
Be aware that any draw operation may modify the base level image data. For this reason, calling this function only makes sense after all drawing is completed and display has been called. Not calling display after subsequent drawing will lead to undefined behavior if a mipmap had been previously generated.
sourcepub fn maximum_antialiasing_level() -> u32
pub fn maximum_antialiasing_level() -> u32
Get the maximum anti-aliasing level supported by the system.
Trait Implementations§
source§impl Debug for RenderTexture
impl Debug for RenderTexture
source§impl Drop for RenderTexture
impl Drop for RenderTexture
source§impl RenderTarget for RenderTexture
impl RenderTarget for RenderTexture
source§fn default_view(&self) -> &View
fn default_view(&self) -> &View
source§fn map_pixel_to_coords(&self, point: Vector2i, view: &View) -> Vector2f
fn map_pixel_to_coords(&self, point: Vector2i, view: &View) -> Vector2f
source§fn map_pixel_to_coords_current_view(&self, point: Vector2i) -> Vector2f
fn map_pixel_to_coords_current_view(&self, point: Vector2i) -> Vector2f
source§fn map_coords_to_pixel(&self, point: Vector2f, view: &View) -> Vector2i
fn map_coords_to_pixel(&self, point: Vector2f, view: &View) -> Vector2i
source§fn map_coords_to_pixel_current_view(&self, point: Vector2f) -> Vector2i
fn map_coords_to_pixel_current_view(&self, point: Vector2f) -> Vector2i
source§fn draw(&mut self, object: &dyn Drawable)
fn draw(&mut self, object: &dyn Drawable)
source§fn draw_with_renderstates(
&mut self,
object: &dyn Drawable,
render_states: &RenderStates<'_, '_, '_>
)
fn draw_with_renderstates(
&mut self,
object: &dyn Drawable,
render_states: &RenderStates<'_, '_, '_>
)
RenderStates
Read moresource§fn draw_text(&self, text: &Text<'_>, rs: &RenderStates<'_, '_, '_>)
fn draw_text(&self, text: &Text<'_>, rs: &RenderStates<'_, '_, '_>)
source§fn draw_shape(&self, shape: &CustomShape<'_>, rs: &RenderStates<'_, '_, '_>)
fn draw_shape(&self, shape: &CustomShape<'_>, rs: &RenderStates<'_, '_, '_>)
source§fn draw_sprite(&self, sprite: &Sprite<'_>, rs: &RenderStates<'_, '_, '_>)
fn draw_sprite(&self, sprite: &Sprite<'_>, rs: &RenderStates<'_, '_, '_>)
source§fn draw_rc_sprite(&self, sprite: &RcSprite, rs: &RenderStates<'_, '_, '_>)
fn draw_rc_sprite(&self, sprite: &RcSprite, rs: &RenderStates<'_, '_, '_>)
RcSprite
source§fn draw_circle_shape(
&self,
circle_shape: &CircleShape<'_>,
rs: &RenderStates<'_, '_, '_>
)
fn draw_circle_shape(
&self,
circle_shape: &CircleShape<'_>,
rs: &RenderStates<'_, '_, '_>
)
CircleShape
source§fn draw_rectangle_shape(
&self,
rectangle_shape: &RectangleShape<'_>,
rs: &RenderStates<'_, '_, '_>
)
fn draw_rectangle_shape(
&self,
rectangle_shape: &RectangleShape<'_>,
rs: &RenderStates<'_, '_, '_>
)
RectangleShape
source§fn draw_convex_shape(
&self,
convex_shape: &ConvexShape<'_>,
rs: &RenderStates<'_, '_, '_>
)
fn draw_convex_shape(
&self,
convex_shape: &ConvexShape<'_>,
rs: &RenderStates<'_, '_, '_>
)
ConvexShape
source§fn draw_vertex_buffer(
&self,
vertex_buffer: &VertexBuffer,
rs: &RenderStates<'_, '_, '_>
)
fn draw_vertex_buffer(
&self,
vertex_buffer: &VertexBuffer,
rs: &RenderStates<'_, '_, '_>
)
VertexBuffer