something is drawing on top of the texture!

This commit is contained in:
Brandon Thomas committed 2020-04-22 01:04:35 -04:00
1 parent 8e5f526c2c
commit d52d7d9b8e
2 files changed
+24 -12

No files matched your search

+12 -5
View File
@@ -53,11 +53,16 @@ pub fn run(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4
let gl_texture_id = load_texture("n64logo.png");
let imgui_texture_id = TextureId::from(gl_texture_id as usize);
let mut visualizer = PointCloudVisualizer::new(
true,
calibration_data
);
let mut gl_texture_id_3 = load_texture("sneslogo.png");
let mut imgui_texture_id_3 = TextureId::from(gl_texture_id_3 as usize);
rebinder.restore();
let mut texture = ViewerImage::create(
@@ -118,10 +123,13 @@ pub fn run(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4
ui.separator();
Image::new(imgui_texture_id, [100.0, 100.0]).build(&ui);
ui.separator();
Image::new(imgui_texture_id_2, [100.0, 100.0]).build(&ui);
ui.separator();
Image::new(imgui_texture_id_3, [100.0, 100.0]).build(&ui);
ui.separator();
unsafe {
gl::ClearColor(0.2, 0.2, 0.2, 1.0);
@@ -134,7 +142,7 @@ pub fn run(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4
window.gl_swap_window();
if let Some(capture) = capture_provider.get_capture() {
visualizer.update_texture(&texture, capture)
visualizer.update_texture_id(gl_texture_id_3, capture)
.map(|_| {
println!("UPDATED TEXTURE!");
})
@@ -155,8 +163,7 @@ pub fn run(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4
}
}
fn asdf(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4a_calibration_t) {
/*fn asdf(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4a_calibration_t) {
let system = support::init(file!());
let context = system.display.get_context();
@@ -329,4 +336,4 @@ fn asdf(capture_provider: Arc<CaptureProvider>, calibration_data: k4a_sys::k4a_c
//gl_window.swap_buffers().unwrap();
}
});
}
}*/
+12 -7
View File
@@ -1,19 +1,20 @@
//! Based off Microsoft's MIT-licensed k4a library code and examples, specifically
//! `k4apointcloudvisualizer.h`
use point_cloud::point_cloud_renderer_shader::{PointCloudRendererShader, PointCloudRendererError};
use k4a_sys_wrapper::{Capture, Transformation};
use gl::types::*;
use k4a_sys_wrapper::Image;
use k4a_sys_wrapper::ImageFormat;
use opengl_wrapper::{Texture, Renderbuffer, Framebuffer};
use point_cloud::point_cloud_compute_shader::{PointCloudComputeShader, PointCloudComputeError};
use std::fmt::{Error, Formatter};
use k4a_sys_wrapper::{Capture, Transformation};
use opengl_wrapper::OpenGlError;
use opengl_wrapper::{Texture, Renderbuffer, Framebuffer};
use point_cloud::pixel_structs::BgraPixel;
use point_cloud::pixel_structs::DepthPixel;
use std::mem::size_of;
use point_cloud::point_cloud_compute_shader::{PointCloudComputeShader, PointCloudComputeError};
use point_cloud::point_cloud_renderer_shader::{PointCloudRendererShader, PointCloudRendererError};
use point_cloud::viewer_image::ViewerImage;
use rand::Rng;
use std::fmt::{Error, Formatter};
use std::mem::size_of;
pub type Result<T> = std::result::Result<T, PointCloudVisualizerError>;
@@ -213,6 +214,10 @@ impl PointCloudVisualizer {
}
pub fn update_texture(&mut self, texture: &ViewerImage, capture: Capture) -> Result<()> {
self.update_texture_id(texture.texture_id(), capture)
}
pub fn update_texture_id(&mut self, texture_id: GLuint, capture: Capture) -> Result<()> {
println!("==== Visualizer.update_texture()");
// Update the point cloud renderer with the latest point data
@@ -235,7 +240,7 @@ impl PointCloudVisualizer {
// TODO:
// glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, static_cast<GLuint>(**texture), 0);
// gl::FramebufferTexture(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, texture_buffer, 0);
gl::FramebufferTexture(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, texture.texture_id(), 0);
gl::FramebufferTexture(gl::FRAMEBUFFER, gl::COLOR_ATTACHMENT0, texture_id, 0);
// DrawBuffers writes to a COLOR BUFFER
//