ICompositionGlContext Interface
Definition
An OpenGL context that is suitable for interop with a Avalonia.Rendering.Composition.Compositor. Create instances via Avalonia.OpenGL.OpenGlCompositionInterop.TryCreateCompatibleGlContextAsync(Avalonia.Rendering.Composition.Compositor,Avalonia.OpenGL.CompositionGlContextOptions).
public interface ICompositionGlContext
Remarks
All members can only be used on the thread the associated Avalonia.Rendering.Composition.Compositor belongs to.
Methods
| Name | Description |
|---|---|
| CreateTexture | Creates a texture that can be used to update a Avalonia.Rendering.Composition.CompositionDrawingSurface instance. |
CreateTexture Method
Creates a texture that can be used to update a Avalonia.Rendering.Composition.CompositionDrawingSurface instance.
public Avalonia.OpenGL.ICompositionGlTexture CreateTexture(Avalonia.Rendering.Composition.CompositionDrawingSurface surface, Avalonia.PixelSize size)
Parameters
surface Avalonia.Rendering.Composition.CompositionDrawingSurface
The surface that will be updated by the texture. Must belong to Avalonia.OpenGL.ICompositionGlContext.Compositor.
size Avalonia.PixelSize
The pixel size of the texture.
Returns
Avalonia.OpenGL.ICompositionGlTexture
Exceptions
Properties
| Name | Description |
|---|---|
| Compositor | The associated compositor. |
| GlContext | The OpenGL context. |
| IsValidForInterop | Returns true if this OpenGL context is still suitable for interop with the Compositor. This property might become false in cases like a device loss event on the compositor side. In that case presentation is no longer possible, however Avalonia.OpenGL.ICompositionGlContext.GlContext itself might still be usable for salvaging user resources. Once the property becomes false, this instance should be disposed and recreated via Avalonia.OpenGL.OpenGlCompositionInterop.TryCreateCompatibleGlContextAsync(Avalonia.Rendering.Composition.Compositor,Avalonia.OpenGL.CompositionGlContextOptions). A recreated context shares no OpenGL objects with the old one. |
Compositor Property
The associated compositor.
public Avalonia.Rendering.Composition.Compositor Compositor { get; set; }
GlContext Property
The OpenGL context.
public Avalonia.OpenGL.IGlContext GlContext { get; set; }
IsValidForInterop Property
Returns true if this OpenGL context is still suitable for interop with the Compositor. This property might become false in cases like a device loss event on the compositor side. In that case presentation is no longer possible, however Avalonia.OpenGL.ICompositionGlContext.GlContext itself might still be usable for salvaging user resources. Once the property becomes false, this instance should be disposed and recreated via Avalonia.OpenGL.OpenGlCompositionInterop.TryCreateCompatibleGlContextAsync(Avalonia.Rendering.Composition.Compositor,Avalonia.OpenGL.CompositionGlContextOptions). A recreated context shares no OpenGL objects with the old one.
public bool IsValidForInterop { get; set; }