Condividi tramite


Device.BeginScene Method

Represents the beginning of a scene.

Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax

'Declaration
Public Sub BeginScene
'Usage
Dim instance As Device

instance.BeginScene
public void BeginScene ()
public:
void BeginScene ()
public void BeginScene ()
public function BeginScene ()
Not applicable.

Exceptions

Exception type Condition

InvalidCallException

The method call is invalid. This occurs when BeginScene is called while already in a BeginScene and EndScene pair. Never call BeginScene twice without first calling EndScene.

Remarks

Every call to BeginScene should eventually be followed by a call to EndScene before the display is updated with Device.

If the method fails, the device was unable to begin the scene, and there is no need to call EndScene. Calls to EndScene fail if the previous call to BeginScene fails.

Example

The following code example shows how to begin and end a scene.

Protected Overrides Sub OnPaint(ByVal eventg As PaintEventArgs) 
    device.Clear(ClearFlags.Target, Color.Black, 0F, 0)
    device.BeginScene()
    sprite.Begin(SpriteFlags.None)
    sprite.Draw(texture, Vector3.Empty, New Vector3(10, 10, 0), &HFFFFFF)
    sprite.End()
    device.EndScene()
    device.Present()

End Sub
protected override void OnPaint(PaintEventArgs eventg)
{
    device.Clear(ClearFlags.Target, Color.Black, 0.0f, 0);
    device.BeginScene();
    sprite.Begin(SpriteFlags.None);
    sprite.Draw(texture, Vector3.Empty, new Vector3(10, 10, 0), 0x00ffffff);
    sprite.End();
    device.EndScene();
    device.Present();
}

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

Device Class
Device Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace