GraphicsDevice Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Performs primitive-based rendering, creates resources, handles system-level variables, and creates shaders.
Inheritance Hierarchy
System.Object
Microsoft.Xna.Framework.Graphics.GraphicsDevice
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework.Graphics (in Microsoft.Xna.Framework.Graphics.dll)
Syntax
'Declaration
Public MustInherit Class GraphicsDevice
public abstract class GraphicsDevice
The GraphicsDevice type exposes the following members.
Properties
Name | Description | |
---|---|---|
Adapter | Gets the graphics adapter. | |
BlendFactor | Gets or sets the color used for a constant-blend factor during alpha blending. The default value is White. | |
BlendState | Gets or sets a system-defined instance of a blend state object initialized for alpha blending. The default value is Opaque. | |
DepthStencilState | Gets or sets a system-defined instance of a depth-stencil state object. The default value is Default. | |
Indices | Gets or sets index data. The default value is null. | |
MultiSampleMask | Gets or sets a bitmask controlling modification of the samples in a multisample render target. The default value is -1 (0xffffffff). | |
PresentationParameters | Gets the presentation parameters associated with this graphics device. | |
RasterizerState | Gets or sets rasterizer state. The default value is CullCounterClockwise. | |
ReferenceStencil | Gets or sets a reference value for stencil testing. The default value is zero. | |
SamplerStates | Gets a collection of SamplerState objects for the current GraphicsDevice. | |
ScissorRectangle | Gets or sets the rectangle used for scissor testing. By default, the size matches the render target size. | |
Textures | Gets the collection of textures that have been assigned to the texture stages of the device. | |
Viewport | Gets or sets a viewport identifying the portion of the render target to receive draw calls. |
Top
Methods
Name | Description | |
---|---|---|
Clear(Color) | Clears resource buffers. | |
Clear(ClearOptions, Color, Single, Int32) | Clears resource buffers. | |
DrawIndexedPrimitives | Renders the specified geometric primitive, based on indexing into an array of vertices. | |
DrawPrimitives | Renders a sequence of non-indexed geometric primitives of the specified type from the current set of data input streams. | |
GetRenderTargets | Gets a render target surface. | |
GetVertexBuffers | Gets the vertex buffers. | |
SetRenderTarget(RenderTarget2D) | Sets a new render target for this GraphicsDevice. | |
SetRenderTarget(RenderTargetCube, CubeMapFace) | Sets a new render target for this GraphicsDevice. | |
SetRenderTargets | Sets an array of render targets. | |
SetVertexBuffer(VertexBuffer) | Sets or binds a vertex buffer to the device. | |
SetVertexBuffer(VertexBuffer, Int32) | Sets or binds a vertex buffer to the device. | |
SetVertexBuffers | Sets the vertex buffers. |
Top
Extension Methods
Name | Description | |
---|---|---|
GetPixelShader | Gets the PixelShader that is associated with the specified GraphicsDevice. (Defined by GraphicsDeviceExtensions.) | |
GetVertexShader | Gets the VertexShader associated with the specified GraphicsDevice. (Defined by GraphicsDeviceExtensions.) | |
SetPixelShader | Associates the specified PixelShader with the specified GraphicsDevice. (Defined by GraphicsDeviceExtensions.) | |
SetPixelShaderConstantFloat4<T>(Int32, T%) | Overloaded. Sets a constant register to a generic data type which is passed to the pixel shader on the graphics device. (Defined by GraphicsDeviceExtensions.) | |
SetPixelShaderConstantFloat4<T>(Int32, Int32, T%) | Overloaded. Sets a constant register to a generic data type which is passed to the pixel shader on the graphics device. (Defined by GraphicsDeviceExtensions.) | |
SetVertexShader | Associates the specified VertexShader with the specified GraphicsDevice. (Defined by GraphicsDeviceExtensions.) | |
SetVertexShaderConstantFloat4<T>(Int32, T%) | Overloaded. Sets a constant register to a generic data type which is passed to the vertex shader on the graphics device. (Defined by GraphicsDeviceExtensions.) | |
SetVertexShaderConstantFloat4<T>(Int32, Int32, T%) | Overloaded. Sets a constant register to a generic data type which is passed to the vertex shader on the graphics device. (Defined by GraphicsDeviceExtensions.) |
Top
Version Information
Silverlight
Supported in: 5
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.