mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-10 03:51:25 +00:00
BY BINDING THE OLD TEXTURE, WE RESTORE IMGUI
This commit is contained in:
1 parent
730bf8b3ce
commit
bfe2e16a40
2 files changed
+17
-8
No files matched your search
@@ -1,17 +1,20 @@
|
||||
use imgui::*;
|
||||
|
||||
use gl::types::*;
|
||||
use gl;
|
||||
use gl_debug::enable_opengl_debugging;
|
||||
use glium::Display;
|
||||
use glium::backend::Facade;
|
||||
use glutin::ContextBuilder;
|
||||
use glutin::event::{Event, WindowEvent};
|
||||
use glutin::event_loop::{ControlFlow, EventLoop};
|
||||
use glium::backend::Facade;
|
||||
use glutin::window::WindowBuilder;
|
||||
use opengl_wrapper::{Texture, Buffer};
|
||||
use point_cloud::point_cloud_visualiser::{PointCloudVisualizer, PointCloudVisualizerError};
|
||||
use point_cloud::viewer_image::ViewerImage;
|
||||
use point_cloud::viewer_image::{ViewerImage, ImageDimensions};
|
||||
use sensor_control::CaptureProvider;
|
||||
use std::sync::Arc;
|
||||
use support;
|
||||
use gl_debug::enable_opengl_debugging;
|
||||
|
||||
pub fn run(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4a_calibration_t) {
|
||||
let system = support::init(file!());
|
||||
@@ -25,12 +28,12 @@ pub fn run(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4
|
||||
|
||||
enable_opengl_debugging();
|
||||
|
||||
/*let mut texture = ViewerImage::create(
|
||||
let mut texture = ViewerImage::create(
|
||||
800,
|
||||
800,
|
||||
None,
|
||||
None
|
||||
).expect("ViewerImage texture creation should work");*/
|
||||
).expect("ViewerImage texture creation should work");
|
||||
|
||||
system.main_loop(move |_, ui| {
|
||||
Window::new(im_str!("Hello world"))
|
||||
|
||||
@@ -97,7 +97,13 @@ impl ViewerImage {
|
||||
format.unwrap_or(gl::BGRA)
|
||||
)?;
|
||||
|
||||
// NB: To be a nice citizen with other tools, let's unbind.
|
||||
let mut last_texture_id = 0;
|
||||
|
||||
unsafe {
|
||||
// NB: To be a good citizen, let's rebind the old texture.
|
||||
gl::GetIntegerv(gl::TEXTURE_BINDING_2D, &mut last_texture_id);
|
||||
|
||||
gl::BindTexture(gl::TEXTURE_2D, viewer_image.texture.id());
|
||||
|
||||
gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR as i32);
|
||||
@@ -111,11 +117,11 @@ impl ViewerImage {
|
||||
width as i32,
|
||||
height as i32,
|
||||
);
|
||||
}
|
||||
|
||||
unsafe {
|
||||
//viewer_image.update_texture(data)?;
|
||||
viewer_image.update_texture(None)?;
|
||||
|
||||
// NB: To be a nice citizen with other tools, let's unbind.
|
||||
gl::BindTexture(gl::TEXTURE_2D, last_texture_id as u32);
|
||||
}
|
||||
|
||||
Ok(viewer_image)
|
||||
|
||||
Reference in new issue
Block a user