Table of Contents

Class ImGuiRenderer

Namespace
NeoVeldrid
Assembly
NeoVeldrid.ImGui.dll

Can render draw lists produced by ImGui. Also provides functions for updating ImGui input.

public class ImGuiRenderer : IDisposable
Inheritance
ImGuiRenderer
Implements
Inherited Members

Constructors

ImGuiRenderer(GraphicsDevice, OutputDescription, int, int)

Constructs a new ImGuiRenderer.

public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height)

Parameters

gd GraphicsDevice

The GraphicsDevice used to create and update resources.

outputDescription OutputDescription

The output format.

width int

The initial width of the rendering target. Can be resized.

height int

The initial height of the rendering target. Can be resized.

ImGuiRenderer(GraphicsDevice, OutputDescription, int, int, ColorSpaceHandling)

Constructs a new ImGuiRenderer.

public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height, ColorSpaceHandling colorSpaceHandling)

Parameters

gd GraphicsDevice

The GraphicsDevice used to create and update resources.

outputDescription OutputDescription

The output format.

width int

The initial width of the rendering target. Can be resized.

height int

The initial height of the rendering target. Can be resized.

colorSpaceHandling ColorSpaceHandling

Identifies how the renderer should treat vertex colors.

Methods

BeginUpdate(float)

Called before we handle the input in Update(float, InputSnapshot). This render ImGui and update the state.

protected void BeginUpdate(float deltaSeconds)

Parameters

deltaSeconds float

ClearCachedImageResources()

public void ClearCachedImageResources()

CreateDeviceResources(GraphicsDevice, OutputDescription)

public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDescription)

Parameters

gd GraphicsDevice
outputDescription OutputDescription

CreateDeviceResources(GraphicsDevice, OutputDescription, ColorSpaceHandling)

public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDescription, ColorSpaceHandling colorSpaceHandling)

Parameters

gd GraphicsDevice
outputDescription OutputDescription
colorSpaceHandling ColorSpaceHandling

DestroyDeviceObjects()

public void DestroyDeviceObjects()

Dispose()

Frees all graphics resources used by the renderer.

public void Dispose()

EndUpdate()

Called at the end of Update(float, InputSnapshot). This tells ImGui that we are on the next frame.

protected void EndUpdate()

GetImageResourceSet(nint)

Retrieves the shader texture binding for the given helper handle.

public ResourceSet GetImageResourceSet(nint imGuiBinding)

Parameters

imGuiBinding nint

Returns

ResourceSet

GetOrCreateImGuiBinding(ResourceFactory, Texture)

Gets or creates a handle for a texture to be drawn with ImGui. Pass the returned handle to Image() or ImageButton().

public nint GetOrCreateImGuiBinding(ResourceFactory factory, Texture texture)

Parameters

factory ResourceFactory
texture Texture

Returns

nint

GetOrCreateImGuiBinding(ResourceFactory, TextureView)

Gets or creates a handle for a texture to be drawn with ImGui. Pass the returned handle to Image() or ImageButton().

public nint GetOrCreateImGuiBinding(ResourceFactory factory, TextureView textureView)

Parameters

factory ResourceFactory
textureView TextureView

Returns

nint

RecreateFontDeviceTexture()

Recreates the device texture used to render text.

public void RecreateFontDeviceTexture()

RecreateFontDeviceTexture(GraphicsDevice)

Recreates the device texture used to render text.

public void RecreateFontDeviceTexture(GraphicsDevice gd)

Parameters

gd GraphicsDevice

RemoveImGuiBinding(Texture)

public void RemoveImGuiBinding(Texture texture)

Parameters

texture Texture

RemoveImGuiBinding(TextureView)

public void RemoveImGuiBinding(TextureView textureView)

Parameters

textureView TextureView

Render(GraphicsDevice, CommandList)

Renders the ImGui draw list data.

public void Render(GraphicsDevice gd, CommandList cl)

Parameters

gd GraphicsDevice
cl CommandList

Update(float, InputSnapshot)

Updates ImGui input and IO configuration state.

public void Update(float deltaSeconds, InputSnapshot snapshot)

Parameters

deltaSeconds float
snapshot InputSnapshot

WindowResized(int, int)

public void WindowResized(int width, int height)

Parameters

width int
height int