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, ColorSpaceHandling, bool)

Constructs a new ImGuiRenderer.

public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height, ColorSpaceHandling colorSpaceHandling, bool autoInit = true)

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.

autoInit bool

When true, opens the first ImGui frame as part of construction. Pass false to configure ImGui.GetIO() (docking flags, fonts, style, etc.) before the first frame, then call Initialize().

ImGuiRenderer(GraphicsDevice, OutputDescription, int, int, bool)

Constructs a new ImGuiRenderer.

public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height, bool autoInit = true)

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.

autoInit bool

When true, opens the first ImGui frame as part of construction. Pass false to configure ImGui.GetIO() (docking flags, fonts, style, etc.) before the first frame, then call Initialize().

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

Initialize()

Opens the first ImGui frame, completing the renderer's setup so it is ready to receive ImGui draw commands. Has no effect if a frame is already in progress.

public void Initialize()

Remarks

Only needed when the renderer was constructed with autoInit: false, which defers opening the first frame so that callers can configure ImGui state that must be set before the very first NewFrame call (for example ImGuiNET.ImGuiConfigFlags.DockingEnable, custom fonts loaded via ImGui.GetIO().Fonts, or backend flags). After construction with autoInit: true (the default) this is already taken care of.

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