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
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.
ImGuiRenderer(GraphicsDevice, OutputDescription, int, int, ColorSpaceHandling)
Constructs a new ImGuiRenderer.
public ImGuiRenderer(GraphicsDevice gd, OutputDescription outputDescription, int width, int height, ColorSpaceHandling colorSpaceHandling)
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.
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
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)