Open3D (C++ API)  0.18.0+252c867
ImageShader.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "open3d/geometry/Image.h"
12 
13 namespace open3d {
14 namespace visualization {
15 
16 namespace glsl {
17 
18 class ImageShader : public ShaderWrapper {
19 public:
20  ~ImageShader() override { Release(); }
21 
22 protected:
23  ImageShader(const std::string &name) : ShaderWrapper(name) { Compile(); }
24 
25 protected:
26  bool Compile() final;
27  void Release() final;
28  bool BindGeometry(const geometry::Geometry &geometry,
29  const RenderOption &option,
30  const ViewControl &view) final;
31  bool RenderGeometry(const geometry::Geometry &geometry,
32  const RenderOption &option,
33  const ViewControl &view) final;
34  void UnbindGeometry() final;
35 
36 protected:
37  virtual bool PrepareRendering(const geometry::Geometry &geometry,
38  const RenderOption &option,
39  const ViewControl &view) = 0;
40  virtual bool PrepareBinding(const geometry::Geometry &geometry,
41  const RenderOption &option,
42  const ViewControl &view,
43  geometry::Image &image) = 0;
44 
45 protected:
48  GLuint vertex_UV_;
52  GLuint vertex_scale_;
53 
55 };
56 
58 public:
59  ImageShaderForImage() : ImageShader("ImageShaderForImage") {}
60 
61 protected:
62  virtual bool PrepareRendering(const geometry::Geometry &geometry,
63  const RenderOption &option,
64  const ViewControl &view) final;
65  virtual bool PrepareBinding(const geometry::Geometry &geometry,
66  const RenderOption &option,
67  const ViewControl &view,
68  geometry::Image &render_image) final;
69 };
70 
71 } // namespace glsl
72 
73 } // namespace visualization
74 } // namespace open3d
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:183
The base geometry class.
Definition: Geometry.h:18
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:34
Defines rendering options for visualizer.
Definition: RenderOption.h:20
View controller for visualizer.
Definition: ViewControl.h:23
ImageShaderForImage()
Definition: ImageShader.h:59
Definition: ImageShader.h:18
void Release() final
Definition: ImageShader.cpp:46
virtual bool PrepareBinding(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view, geometry::Image &image)=0
bool RenderGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: ImageShader.cpp:108
bool Compile() final
Definition: ImageShader.cpp:34
GLuint vertex_UV_
Definition: ImageShader.h:48
ImageShader(const std::string &name)
Definition: ImageShader.h:23
void UnbindGeometry() final
Definition: ImageShader.cpp:134
GLuint image_texture_
Definition: ImageShader.h:50
gl_util::GLVector3f vertex_scale_data_
Definition: ImageShader.h:54
GLuint vertex_scale_
Definition: ImageShader.h:52
GLuint vertex_position_buffer_
Definition: ImageShader.h:47
GLuint vertex_UV_buffer_
Definition: ImageShader.h:49
~ImageShader() override
Definition: ImageShader.h:20
bool BindGeometry(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view) final
Definition: ImageShader.cpp:51
virtual bool PrepareRendering(const geometry::Geometry &geometry, const RenderOption &option, const ViewControl &view)=0
GLuint vertex_position_
Definition: ImageShader.h:46
GLuint image_texture_buffer_
Definition: ImageShader.h:51
Definition: ShaderWrapper.h:21
std::string name
Definition: FilePCD.cpp:39
Eigen::Matrix< GLfloat, 3, 1, Eigen::ColMajor > GLVector3f
Definition: GLHelper.h:32
Definition: PinholeCameraIntrinsic.cpp:16