Table of Contents

Class OcclusionQuery

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll
public class OcclusionQuery : GraphicsResource, IDisposable
Inheritance
OcclusionQuery
Implements
Inherited Members

Constructors

OcclusionQuery(GraphicsDevice)

Initializes a new instance of the OcclusionQuery class.

public OcclusionQuery(GraphicsDevice graphicsDevice)

Parameters

graphicsDevice GraphicsDevice

The graphics device.

Exceptions

ArgumentNullException

graphicsDevice is null.

NotSupportedException

The current graphics profile does not support occlusion queries.

Properties

IsComplete

Gets a value indicating whether the occlusion query has completed.

public bool IsComplete { get; }

Property Value

bool

true if the occlusion query has completed; otherwise, false.

PixelCount

Gets the number of visible pixels.

public int PixelCount { get; }

Property Value

int

The number of visible pixels.

Exceptions

InvalidOperationException

The occlusion query has not yet completed. Check IsComplete before reading the result!

Methods

Begin()

Begins the occlusion query.

public void Begin()

Exceptions

InvalidOperationException

Begin() is called again before calling End().

Dispose(bool)

The method that derived classes should override to implement disposing of managed and native resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

True if managed objects should be disposed.

Remarks

Native resources should always be released regardless of the value of the disposing parameter.

End()

Ends the occlusion query.

public void End()

Exceptions

InvalidOperationException

End() is called before calling Begin().