Jay Oster 96b6f6b59c Fix color scheme with gfx
- gfx uses an sRGB framebuffer, which means it expects all vertex colors to be in linear space
- imgui provides vertex colors in sRGB space! This causes the appearance of washed out colors
- Fix the color space conflict by converting the imgui colors to linear space
2018-04-26 20:04:40 -07:00

35 lines
903 B
Rust

extern crate gfx;
extern crate gfx_window_glutin;
extern crate glutin;
#[macro_use]
extern crate imgui;
extern crate imgui_gfx_renderer;
extern crate imgui_sys;
use imgui::*;
mod support_gfx;
const CLEAR_COLOR: [f32; 4] = [1.0, 1.0, 1.0, 1.0];
fn main() { support_gfx::run("hello_gfx.rs".to_owned(), CLEAR_COLOR, hello_world); }
fn hello_world<'a>(ui: &Ui<'a>) -> bool {
ui.window(im_str!("Hello world"))
.size((300.0, 100.0), ImGuiCond::FirstUseEver)
.build(|| {
ui.text(im_str!("Hello world!"));
ui.text(im_str!("こんにちは世界!"));
ui.text(im_str!("This...is...imgui-rs!"));
ui.separator();
let mouse_pos = ui.imgui().mouse_pos();
ui.text(im_str!(
"Mouse Position: ({:.1},{:.1})",
mouse_pos.0,
mouse_pos.1
));
});
true
}