8 #include "../proc/synthetic-stream.h"
18 #include <glad/glad.h>
36 void align_gl::cleanup_gpu_resources()
40 _other_texture.reset();
45 void align_gl::create_gpu_resources()
47 _renderer = std::make_shared<rs2::gl::pointcloud_renderer>();
48 _pc = std::make_shared<rs2::gl::pointcloud>();
49 _other_texture = std::make_shared<rs2::texture_buffer>();
50 _upload = std::make_shared<rs2::gl::uploader>();
51 _enabled = glsl_enabled() ? 1 : 0;
63 auto p = _pc->calculate(
depth);
72 frame_ref->
set_sensor(depth_ptr->get_sensor());
80 gf->get_gpu_section().output_texture(0, &aligned_tex, tex_type.type);
82 width,
height, 0, tex_type.gl_format, tex_type.data_type,
nullptr);
84 auto prof =
depth.get_profile();
91 aligned = _upload->process(aligned);
92 aligned = _upload->process(aligned);
97 int *viewport,
double alpha,
double beta,
double skew,
110 double N = near_clip;
124 ortho(0,0) = 2.f/(
R-L); ortho(0,3) = float(-(
R+L)/(
R-L));
125 ortho(1,1) = 2.f/(
T-B); ortho(1,3) = float(-(
T+B)/(
T-B));
126 ortho(2,2) = -2.f/float(F-N); ortho(2,3) = float(-(F+N)/(F-N));
134 tproj(0,0) = float(
alpha); tproj(0,1) = float(skew); tproj(0,2) = 0.f;
135 tproj(1,1) = float(
beta); tproj(1,2) = float(
v0);
136 tproj(2,2) = float(-(N+F)); tproj(2,3) = float(-N*F);
151 perform_gl_action([&] {
158 texture = input_frame.get_texture_id(0);
162 _other_texture->upload(tex, tex.get_profile().format());
163 texture = _other_texture->get_gl_handle();
173 width,
height, 0, textype.gl_format, textype.data_type,
nullptr);
194 projection(3, 2) *= -1.f;
195 projection(2, 3) *= -1.f;
196 projection(2, 2) *= -1.f;
205 for (
int i = 0;
i < 3;
i++)
207 for (
int j = 0;
j < 3;
j++)
214 _renderer->process(
model);
233 auto p = _pc->calculate(
depth);
242 gf->get_gpu_section().output_texture(0, &output_rgb, tex_type.type);
244 width,
height, 0, tex_type.gl_format, tex_type.data_type,
nullptr);
248 auto prof =
depth.get_profile();
250 auto extr = prof.get_extrinsics_to(prof);
251 render(
p, other,
intr,
extr, output_rgb);
259 auto opt = std::make_shared<librealsense::ptr_option<int>>(
260 0, 1, 0, 1, &
_enabled,
"GLSL enabled");