RenderTexture Class

SFML.Net

RenderTexture Class
Target for off-screen 2D rendering into an texture
Inheritance Hierarchy
SystemObject  SFMLObjectBase
    SFML.GraphicsRenderTexture

Namespace: SFML.Graphics
Assembly: sfmlnet-graphics-2 (in sfmlnet-graphics-2.dll) Version: 2.2.0.0 (2.2.0)
Syntax
public class RenderTexture : ObjectBase, 
	RenderTarget
Public Class RenderTexture
	Inherits ObjectBase
	Implements RenderTarget
public ref class RenderTexture : public ObjectBase, 
	RenderTarget
type RenderTexture =  
    class
        inherit ObjectBase
        interface RenderTarget
    end

The RenderTexture type exposes the following members.

Constructors
  NameDescription
Public methodRenderTexture(UInt32, UInt32)
Create the render-texture with the given dimensions
Public methodRenderTexture(UInt32, UInt32, Boolean)
Create the render-texture with the given dimensions and an optional depth-buffer attached
Top
Methods
  NameDescription
Public methodClear
Clear the entire render texture with black color
Public methodClear(Color)
Clear the entire render texture with a single color
Protected methodDestroy
Handle the destruction of the object
(Overrides ObjectBaseDestroy(Boolean).)
Public methodDisplay
Update the contents of the target texture
Public methodDispose
Explicitely dispose the object
(Inherited from ObjectBase.)
Public methodDraw(Drawable)
Draw a drawable object to the render-target, with default render states
Public methodDraw(Drawable, RenderStates)
Draw a drawable object to the render-target
Public methodDraw(Vertex, PrimitiveType)
Draw primitives defined by an array of vertices, with default render states
Public methodDraw(Vertex, PrimitiveType, RenderStates)
Draw primitives defined by an array of vertices
Public methodDraw(Vertex, UInt32, UInt32, PrimitiveType)
Draw primitives defined by a sub-array of vertices, with default render states
Public methodDraw(Vertex, UInt32, UInt32, PrimitiveType, RenderStates)
Draw primitives defined by a sub-array of vertices
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Dispose the object
(Inherited from ObjectBase.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetView
Return the current active view
Public methodGetViewport
Get the viewport of a view applied to this target
Public methodMapCoordsToPixel(Vector2f)
Convert a point from world coordinates to target coordinates, using the current view This function is an overload of the mapCoordsToPixel function that implicitely uses the current view. It is equivalent to: target.MapCoordsToPixel(point, target.GetView());
Public methodMapCoordsToPixel(Vector2f, View)
Convert a point from world coordinates to target coordinates This function finds the pixel of the render-target 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-target, 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-target -- if the view is translated by (140, 25). This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.
Public methodMapPixelToCoords(Vector2i)
Convert a point from target coordinates to world coordinates, using the current view This function is an overload of the MapPixelToCoords function that implicitely uses the current view. It is equivalent to: target.MapPixelToCoords(point, target.GetView());
Public methodMapPixelToCoords(Vector2i, View)
Convert a point from target coordinates to world coordinates This function finds the 2D position that matches the given pixel of the render-target. 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-target, this assertion is not true anymore, ie. a point located at (10, 50) in your render-target may map to the point (150, 75) in your 2D world -- if the view is translated by (140, 25). For render-windows, 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 the other overload of the function if you want to use the current view of the render-target.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodPopGLStates
Restore the previously saved OpenGL render states and matrices. See the description of PushGLStates to get a detailed description of these functions.
Public methodPushGLStates
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: \li SFML's internal states are not messed up by your OpenGL code \li your OpenGL states are not modified by a call to a SFML function More specifically, it must be used around code that calls Draw functions. Example: // OpenGL code here... window.PushGLStates(); window.Draw(...); window.Draw(...); window.PopGLStates(); // OpenGL code here... 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.
Public methodResetGLStates
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 Draw() calls will work as expected. Example: // OpenGL code here... glPushAttrib(...); window.ResetGLStates(); window.Draw(...); window.Draw(...); glPopAttrib(...); // OpenGL code here...
Public methodSetActive
Activate of deactivate the render texture as the current target for rendering
Public methodSetView
Change the current active view
Public methodToString
Provide a string describing the object
(Overrides ObjectToString.)
Top
Properties
  NameDescription
Public propertyCPointer
Access to the internal pointer of the object. For internal use only
(Inherited from ObjectBase.)
Public propertyDefaultView
Default view of the render texture
Public propertySize
Size of the rendering region of the render texture
Public propertySmooth
Control the smooth filter
Public propertyTexture
Target texture of the render texture
Top
See Also