Table of Contents

Class OcclusionQuery

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

Used to perform an occlusion query against the latest drawn objects.

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)

protected override void Dispose(bool disposing)

Parameters

disposing bool

End()

Ends the occlusion query.

public void End()

Exceptions

InvalidOperationException

End() is called before calling Begin().