Fix UI colors in imgui-winit example (#166)

- Removes the sRGB workaround that was needed before `imgui-winit` 0.12
This commit is contained in:
Jay Oster 2021-05-08 23:14:26 -07:00 committed by GitHub
parent 0b26cf015f
commit f3d2b0643e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 17 deletions

View file

@ -41,12 +41,6 @@ impl Gui {
}),
}]);
// Fix incorrect colors with sRGB framebuffer
let style = imgui.style_mut();
for color in 0..style.colors.len() {
style.colors[color] = gamma_to_linear(style.colors[color]);
}
// Create Dear ImGui WGPU renderer
let device = pixels.device();
let queue = pixels.queue();
@ -140,14 +134,3 @@ impl Gui {
.handle_event(self.imgui.io_mut(), window, event);
}
}
fn gamma_to_linear(color: [f32; 4]) -> [f32; 4] {
const GAMMA: f32 = 2.2;
let x = color[0].powf(GAMMA);
let y = color[1].powf(GAMMA);
let z = color[2].powf(GAMMA);
let w = 1.0 - (1.0 - color[3]).powf(GAMMA);
[x, y, z, w]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB