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
gdGraphicsDeviceThe GraphicsDevice used to create and update resources.
outputDescriptionOutputDescriptionThe output format.
widthintThe initial width of the rendering target. Can be resized.
heightintThe initial height of the rendering target. Can be resized.
colorSpaceHandlingColorSpaceHandlingIdentifies how the renderer should treat vertex colors.
autoInitboolWhen
true, opens the first ImGui frame as part of construction. Passfalseto configureImGui.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
gdGraphicsDeviceThe GraphicsDevice used to create and update resources.
outputDescriptionOutputDescriptionThe output format.
widthintThe initial width of the rendering target. Can be resized.
heightintThe initial height of the rendering target. Can be resized.
autoInitboolWhen
true, opens the first ImGui frame as part of construction. Passfalseto configureImGui.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
deltaSecondsfloat
ClearCachedImageResources()
public void ClearCachedImageResources()
CreateDeviceResources(GraphicsDevice, OutputDescription)
public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDescription)
Parameters
gdGraphicsDeviceoutputDescriptionOutputDescription
CreateDeviceResources(GraphicsDevice, OutputDescription, ColorSpaceHandling)
public void CreateDeviceResources(GraphicsDevice gd, OutputDescription outputDescription, ColorSpaceHandling colorSpaceHandling)
Parameters
gdGraphicsDeviceoutputDescriptionOutputDescriptioncolorSpaceHandlingColorSpaceHandling
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
imGuiBindingnint
Returns
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
factoryResourceFactorytextureTexture
Returns
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
factoryResourceFactorytextureViewTextureView
Returns
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
RemoveImGuiBinding(Texture)
public void RemoveImGuiBinding(Texture texture)
Parameters
textureTexture
RemoveImGuiBinding(TextureView)
public void RemoveImGuiBinding(TextureView textureView)
Parameters
textureViewTextureView
Render(GraphicsDevice, CommandList)
Renders the ImGui draw list data.
public void Render(GraphicsDevice gd, CommandList cl)
Parameters
gdGraphicsDeviceclCommandList
Update(float, InputSnapshot)
Updates ImGui input and IO configuration state.
public void Update(float deltaSeconds, InputSnapshot snapshot)
Parameters
deltaSecondsfloatsnapshotInputSnapshot
WindowResized(int, int)
public void WindowResized(int width, int height)