Device Class (Microsoft.DirectX.Direct3D)
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, gets and sets palettes, and creates shaders.
Visual Basic NotInheritable Public Class Device
C# public sealed class Device : MarshalByRefObject, IDisposable C++ public ref class Device sealed : MarshalByRefObject, IDisposable JScript public final class Device extends MarshalByRefObject implements IDisposable
The following table lists the members exposed by the object.
Event Description DeviceLost Occurs when a device is about to be lost (for example, immediately prior to a reset). DeviceReset Occurs after a device is reset, allowing an application to re-create all Pool.Default resources. DeviceResizing Occurs when a device is resizing, allowing the application to cancel the default handling of the resize. Disposing Occurs when the Dispose method is called or when the Device object is finalized and collected by the garbage collector of the .NET common language runtime.
Method Description BeginScene Begins a scene. BeginStateBlock Signals Direct3D to begin recording a device state block. CheckCooperativeLevel Reports the current cooperative-level status of the Direct3D device for a windowed or full-screen application. Clear Clears the viewport or a set of rectangles in the viewport to a specified RGBA color, clears the depth buffer, and erases the stencil buffer. ColorFill Allows an application to fill a rectangular area of a Default surface with a specified color. CreateDepthStencilSurface Creates a depth stencil resource. CreateOffscreenPlainSurface Creates an off-screen surface. CreateRenderTarget Creates a render target surface. DeletePatch Frees a cached high-order patch. Device Initializes a new instance of the current class. Dispose Immediately releases the unmanaged resources used by the Device object. DrawIndexedPrimitives Renders the specified geometric primitive, based on indexing into an array of vertices. DrawIndexedUserPrimitives Renders the specified geometric primitive with data specified by a user memory pointer. DrawPrimitives Renders a sequence of non-indexed geometric primitives of the specified type from the current set of data input streams. DrawRectanglePatch Draws a rectangular patch using the currently set streams. DrawTrianglePatch Draws a triangular patch using the currently set streams. DrawUserPrimitives Renders data specified by a user memory pointer as a sequence of geometric primitives of the specified type. EndScene Ends a scene that was started by calling the Device.BeginScene method. EndStateBlock Signals Microsoft Direct3D to stop recording a device state block and retrieve a pointer to the state block interface. Equals Returns a value that indicates whether the current instance is equal to a specified object. EvictManagedResources Evicts all managed resources, including Direct3D resources and those that are driver-managed. Finalize Allows the Device object to free resources before it is destroyed by the garbage collector. GetBackBuffer Retrieves a back buffer from a device's swap chain. GetCubeTexture Retrieves the cube texture assigned to a stage for a device. GetFrontBufferData Generates a copy of a device's front buffer and places it in a system memory buffer provided by the application. GetGammaRamp Retrieves the gamma correction ramp for the swap chain. GetHashCode Returns the hash code for the current instance. GetObjectByValue This member supports the infrastructure for Microsoft DirectX 9.0 for Managed Code and is not intended to be used directly from your code. GetPaletteEntries Retrieves palette entries. GetPixelShaderBooleanConstant Retrieves a Boolean shader constant. GetPixelShaderInt32Constant Retrieves an integer shader constant. GetPixelShaderSingleConstant Retrieves a floating-point shader constant. GetRasterStatus Returns information that describes the raster of the monitor on which the swap chain is presented. GetRenderStateBoolean Retrieves the Boolean value of a given render state. GetRenderStateInt32 Retrieves the integer value of a given render state. GetRenderStateSingle Retrieves the floating-point value of a given render state. GetRenderTarget Retrieves a render target surface. GetRenderTargetData Copies the render target data from device memory to system memory. GetSamplerStageStateBoolean Retrieves the Boolean value of a given sampler stage state. GetSamplerStageStateInt32 Retrieves the integer value of a given sampler stage state. GetSamplerStageStateSingle Retrieves the floating-point value of a given sampler stage state. GetStreamSource Retrieves a vertex buffer bound to the specified data stream. GetStreamSourceFrequency Retrieves the stream source frequency divider value. GetSwapChain Retrieves a reference to a swap chain. GetTexture Retrieves a texture assigned to a stage for a device. GetTextureStageStateBoolean Retrieves the Boolean value of a given texture stage state. GetTextureStageStateInt32 Retrieves the integer value of a given texture stage state. GetTextureStageStateSingle Retrieves the floating-point value of a given texture stage state. GetTransform Retrieves a matrix that describes a transformation state. GetVertexShaderBooleanConstant Retrieves a Boolean vertex shader constant. GetVertexShaderInt32Constant Retrieves an integer vertex shader constant. GetVertexShaderSingleConstant Retrieves a floating-point vertex shader constant. GetVolumeTexture Retrieves the volume texture assigned to a stage for a device. MultiplyTransform Multiplies a device's world, view, or projection matrices by a specified matrix. op_Equality Compares the current instance of a class to another instance to determine whether they are the same. op_Inequality Compares the current instance of a class to another instance to determine whether they are different. Present Presents the display with the contents of the next buffer in the sequence of back buffers owned by the device. ProcessVertices Applies the vertex processing defined by the vertex shader to the set of input data streams, generating a single stream of interleaved vertex data to the destination vertex buffer. raise_DeviceLost Raises a Device.DeviceLost event when called from within a derived class. raise_DeviceReset Raises a Device.DeviceReset event when called from within a derived class. raise_DeviceResizing Raises a Device.DeviceResizing event when called from within a derived class. raise_Disposing Raises the Microsoft.DirectX.Direct3D.Device.Disposing event when called from within a derived class. Reset Resets the presentation parameters for the current device. SetCursor Sets the current cursor. SetCursorPosition Sets the cursor position and update options. SetCursorProperties Sets properties for the cursor. SetDialogBoxesEnabled Enables the use of Microsoft Windows Graphics Device Interface (GDI) dialog boxes in full-screen applications. SetGammaRamp Sets the gamma correction ramp for the implicit swap chain. SetPaletteEntries Sets palette entries. SetPixelShaderConstant Sets a pixel shader constant. SetPixelShaderConstantBoolean Sets Boolean shader constants. SetPixelShaderConstantInt32 Sets integer shader constants. SetPixelShaderConstantSingle Sets floating-point shader constants. SetRenderState Sets a render state value. SetRenderTarget Sets a new color buffer for a device. SetSamplerState Sets a sampler stage state value. SetStreamSource Binds a vertex buffer to a device data stream. SetStreamSourceFrequency Sets the stream source frequency divider value. SetTexture Assigns a texture to a device stage. SetTextureStageState Sets a texture stage state value. SetTransform Sets a single device transform. SetVertexShaderConstant Sets a vertex shader constant. SetVertexShaderConstantBoolean Sets Boolean vertex shader constants. SetVertexShaderConstantInt32 Sets integer vertex shader constants. SetVertexShaderConstantSingle Sets floating-point vertex shader constants. ShowCursor Displays or hides the cursor. StretchRectangle Copies the contents of the source rectangle to the destination rectangle. TestCooperativeLevel Reports the current cooperative-level status of the Direct3D device for a windowed or full-screen application. UpdateSurface Copies rectangular subsets of pixels from one surface to another. UpdateTexture Updates the dirty portions of a texture. UpdateUnmanagedPointer Updates the unmanaged pointer for this Device object. This method supports the Microsoft .NET Framework infrastructure and is not intended to be used directly in your code. ValidateDevice Reports the device's ability to render the current texture-blending operations and arguments in a single pass.
Property Description AvailableTextureMemory Retrieves an estimate of the amount of available texture memory. ClipPlanes Retrieves the clipping planes on the current device. ClipStatus Retrieves or sets a ClipStatus object. CreationParameters Retrieves the creation parameters of the device. CurrentTexturePalette Retrieves or sets the current texture palette. DepthStencilSurface Retrieves or sets the depth stencil surface owned by the Device object. DeviceCaps Retrieves the capabilities of the rendering device. DisplayMode Retrieves the display mode's spatial resolution, color resolution, and refresh frequency. Disposed Gets a value that indicates whether the object is disposed. Indices Retrieves or sets index data. IsUsingEventHandlers Retrieves or sets a value that indicates whether the device should use event handlers. Lights Retrieves the LightsCollection collection on the current device. Material Retrieves or sets the current material properties for the device. NPatchMode Retrieves or sets the N-patch mode segments. NumberOfSwapChains Retrieves the number of implicit swap chains. PixelShader Retrieves or sets the current pixel shader. PresentationParameters Retrieves presentation parameters for a device. RasterStatus Retrieves information that describes the raster of the monitor on which the swap chain is presented. RenderState Retrieves a render-state value for a device. SamplerState Retrieves a device's sampler states. ScissorRectangle Retrieves or sets the scissor rectangle. SoftwareVertexProcessing Retrieves or sets the vertex processing mode. TextureState Retrieves a state value for an assigned texture. Transform Retrieves a matrix that describes a transformation state. UnmanagedComPointer Returns the unmanaged Component Object Model (COM) IDirect3DDevice9 interface pointer. VertexDeclaration Retrieves or sets a vertex shader declaration. VertexFormat Retrieves or sets the supported flexible vertex formats. VertexShader Retrieves or sets the current vertex shader. Viewport Retrieves or sets the viewport parameters for the current device.
Generate a Scene
This example shows how to begin scene generation and draw primitives.
The SetStreamSource method binds a vertex buffer to a device data stream to create an association between the vertex data and one of several data stream ports that feed the primitive processing functions. The parameters for this method are the number of the data stream, the name of the VertexBuffer object, and the stream vertex stride.
In the following C# code example, it is assumed that the device is the rendering Device, and vBuffer is a vertex buffer filled with CustomVertex.PositionNormal data.[C#] device.BeginScene(); device.SetStreamSource(0, vBuffer, 0); device.VertexFormat = CustomVertex.PositionNormal.Format; device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1); device.EndScene();
Namespace Microsoft.DirectX.Direct3D Assembly Microsoft.DirectX.Direct3D (microsoft.directx.direct3d.dll) Strong Name Microsoft.DirectX.Direct3D, Version=1.0.900.0, Culture=neutral, PublicKeyToken=d3231b57b74a1492