RenderTexture Methods

SFML.Net

RenderTexture Methods

The RenderTexture type exposes the following members.

Methods
  Name Description
Public method Clear
Clear the entire render texture with black color
Public method Clear(Color)
Clear the entire render texture with a single color
Protected method Destroy
Handle the destruction of the object
(Overrides ObjectBaseDestroy(Boolean).)
Public method Display
Update the contents of the target texture
Public method Dispose
Explicitely dispose the object
(Inherited from ObjectBase.)
Public method Draw(Drawable)
Draw a drawable object to the render-target, with default render states
Public method Draw(Drawable, RenderStates)
Draw a drawable object to the render-target
Public method Draw(Vertex, PrimitiveType)
Draw primitives defined by an array of vertices, with default render states
Public method Draw(Vertex, PrimitiveType, RenderStates)
Draw primitives defined by an array of vertices
Public method Draw(Vertex, UInt32, UInt32, PrimitiveType)
Draw primitives defined by a sub-array of vertices, with default render states
Public method Draw(Vertex, UInt32, UInt32, PrimitiveType, RenderStates)
Draw primitives defined by a sub-array of vertices
Public method Equals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected method Finalize
Dispose the object
(Inherited from ObjectBase.)
Public method GetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method GetView
Return the current active view
Public method GetViewport
Get the viewport of a view applied to this target
Public method MapCoordsToPixel(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 method MapCoordsToPixel(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 method MapPixelToCoords(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 method MapPixelToCoords(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 method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public method PopGLStates
Restore the previously saved OpenGL render states and matrices. See the description of PushGLStates to get a detailed description of these functions.
Public method PushGLStates
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 method ResetGLStates
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 method SetActive
Activate of deactivate the render texture as the current target for rendering
Public method SetView
Change the current active view
Public method ToString
Provide a string describing the object
(Overrides ObjectToString.)
Top
See Also