Modify SampleProgram to use 'safe' version of GetTexDataAsRGBA32, which was auto-generated by the CodeGenerator with the new variant functionality.

internals
giawa 6 years ago
parent 5afed427ad
commit 8be7644c3e
  1. 6
      src/ImGui.NET.SampleProgram/ImGuiController.cs

@ -244,11 +244,11 @@ namespace ImGuiNET
/// <summary> /// <summary>
/// Recreates the device texture used to render text. /// Recreates the device texture used to render text.
/// </summary> /// </summary>
public unsafe void RecreateFontDeviceTexture(GraphicsDevice gd) public void RecreateFontDeviceTexture(GraphicsDevice gd)
{ {
ImGuiIOPtr io = ImGui.GetIO(); ImGuiIOPtr io = ImGui.GetIO();
// Build // Build
byte* pixels; IntPtr pixels;
int width, height, bytesPerPixel; int width, height, bytesPerPixel;
io.Fonts.GetTexDataAsRGBA32(out pixels, out width, out height, out bytesPerPixel); io.Fonts.GetTexDataAsRGBA32(out pixels, out width, out height, out bytesPerPixel);
// Store our identifier // Store our identifier
@ -264,7 +264,7 @@ namespace ImGuiNET
_fontTexture.Name = "ImGui.NET Font Texture"; _fontTexture.Name = "ImGui.NET Font Texture";
gd.UpdateTexture( gd.UpdateTexture(
_fontTexture, _fontTexture,
(IntPtr)pixels, pixels,
(uint)(bytesPerPixel * width * height), (uint)(bytesPerPixel * width * height),
0, 0,
0, 0,

Loading…
Cancel
Save