Struct sfml::graphics::RenderTexture [] [src]

pub struct RenderTexture { /* fields omitted */ }

Target for off-screen 2D rendering into a texture

Methods

impl RenderTexture
[src]

Construct a new render texture

Arguments

  • width - Width of the render texture
  • height - Height of the render texture
  • depthBuffer - Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture)

Return Some(RenderTexture) or None

Update the contents of the target texture

Activate or deactivate a render texture as the current target for rendering

Arguments

  • active - true to activate, false to deactivate

Get the target texture of a render texture

Return the target texture

Enable or disable the smooth filter on a render texture

Arguments

  • smooth - true to enable smoothing, false to disable it

Tell whether the smooth filter is enabled or not for a render texture

Return true if smoothing is enabled, false if it is disabled

Enable or disable texture repeating.

This function is similar to Texture::setRepeated. This parameter is disabled by default.

Tell whether the texture is repeated or not.

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. 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.

Trait Implementations

impl RenderTarget for RenderTexture
[src]

Get the size of the rendering region of a render texture

Return the size in pixels

Clear the rendertexture with the given color

Arguments

  • color - Fill color

Change the current active view of a render texture

Arguments

  • view - the new view

Get the current active view of a render texture

Return the current active view

Get the default view of a render texture

Return the default view of the render texture

Get the viewport of a view applied to this target

Arguments

  • view - Target view

Return the viewport rectangle, expressed in pixels in the current target

Convert a point from texture coordinates to world coordinates

This function finds the 2D position that matches the given pixel of the render-texture. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render texture, this assertion is not true anymore, ie. a point located at (10, 50) in your render-texture may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25).

This function is typically used to find which point (or object) is located below the mouse cursor.

This version uses a custom view for calculations, see map_pixel_to_coords if you want to use the current view of the render-texture.

Arguments

  • point - Pixel to convert
  • view - The view to use for converting the point

Return the converted point, in "world" units

Convert a point from texture coordinates to world coordinates

This function finds the 2D position that matches the given pixel of the render-texture. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render texture, this assertion is not true anymore, ie. a point located at (10, 50) in your render-texture may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25).

This function is typically used to find which point (or object) is located below the mouse cursor.

This version the current view for calculations, see map_pixel_to_coordss if you want to use a custom view

Arguments

  • point - Pixel to convert

Return the converted point, in "world" units

Convert a point from world coordinates to render texture coordinates

This function finds the pixel of the render-texture that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render texture, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-texture -- if the view is translated by (140, 25).

This version uses a custom view for calculations, see map_coords_to_pixel_current_view if you want to use the current view of the render-texture.

Arguments

  • point - Point to convert
  • view - The view to use for converting the point

Convert a point from world coordinates to render texture coordinates

This function finds the pixel of the render-texture that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render texture, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-texture -- if the view is translated by (140, 25).

This version uses the default view for calculations, see map_coords_to_pixel if you want to use as custom view.

Arguments

  • point - Point to convert

Draw a drawable object to the render-target

Arguments

  • object - Object to draw

Draw a drawable object to the render-target

Arguments

  • object - Object to draw
  • renderStates - The RenderStates to associate to the object

Draw Text

Draw Shape

Draw Sprite

Draw CircleShape

Draw RectangleShape

Draw ConvexShape

Draw VertexArray

draw primitives

Save the current OpenGL render states and matrices

This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with popGLStates, it ensures that: SFML's internal states are not messed up by your OpenGL code and that your OpenGL states are not modified by a call to a SFML function

Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the resetGLStates function if you do so.

Restore the previously saved OpenGL render states and matrices

Reset the internal OpenGL states so that the target is ready for drawing

This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent SFML draw calls will work as expected.

impl Drop for RenderTexture
[src]

A method called when the value goes out of scope. Read more