Open3D (C++ API)
Data Structures | Public Member Functions | Protected Member Functions | Protected Attributes
open3d::visualization::Visualizer Class Reference

#include <Visualizer.h>

Inheritance diagram for open3d::visualization::Visualizer:
open3d::visualization::VisualizerWithCustomAnimation open3d::visualization::VisualizerWithEditing open3d::visualization::VisualizerWithKeyCallback

Data Structures

struct  MouseControl
 

Public Member Functions

 Visualizer ()
 
virtual ~Visualizer ()
 
 Visualizer (Visualizer &&)=delete
 
 Visualizer (const Visualizer &)=delete
 
Visualizeroperator= (const Visualizer &)=delete
 
bool CreateVisualizerWindow (const std::string &window_name="Open3D", const int width=640, const int height=480, const int left=50, const int top=50, const bool visible=true)
 
void DestroyVisualizerWindow ()
 
void RegisterAnimationCallback (std::function< bool(Visualizer *)> callback_func)
 
void Run ()
 
void Close ()
 Function to to notify the window to be closed. More...
 
bool WaitEvents ()
 
bool PollEvents ()
 
virtual bool AddGeometry (std::shared_ptr< const geometry::Geometry > geometry_ptr)
 
virtual bool RemoveGeometry (std::shared_ptr< const geometry::Geometry > geometry_ptr)
 
virtual bool UpdateGeometry ()
 
virtual bool HasGeometry () const
 
virtual void UpdateRender ()
 Function to set the redraw flag as dirty. More...
 
virtual void PrintVisualizerHelp ()
 
virtual void UpdateWindowTitle ()
 
virtual void BuildUtilities ()
 
ViewControlGetViewControl ()
 
RenderOptionGetRenderOption ()
 
std::shared_ptr< geometry::ImageCaptureScreenFloatBuffer (bool do_render=true)
 
void CaptureScreenImage (const std::string &filename="", bool do_render=true)
 
std::shared_ptr< geometry::ImageCaptureDepthFloatBuffer (bool do_render=true)
 
void CaptureDepthImage (const std::string &filename="", bool do_render=true, double depth_scale=1000.0)
 
void CaptureDepthPointCloud (const std::string &filename="", bool do_render=true, bool convert_to_world_coordinate=false)
 
void CaptureRenderOption (const std::string &filename="")
 
void ResetViewPoint (bool reset_bounding_box=false)
 
const std::string & GetWindowName () const
 

Protected Member Functions

virtual bool InitOpenGL ()
 Function to initialize OpenGL. More...
 
virtual bool InitViewControl ()
 Function to initialize ViewControl. More...
 
virtual bool InitRenderOption ()
 Function to initialize RenderOption. More...
 
virtual void Render ()
 
void CopyViewStatusToClipboard ()
 
void CopyViewStatusFromClipboard ()
 
virtual void WindowRefreshCallback (GLFWwindow *window)
 
virtual void WindowResizeCallback (GLFWwindow *window, int w, int h)
 
virtual void MouseMoveCallback (GLFWwindow *window, double x, double y)
 
virtual void MouseScrollCallback (GLFWwindow *window, double x, double y)
 
virtual void MouseButtonCallback (GLFWwindow *window, int button, int action, int mods)
 
virtual void KeyPressCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
 
virtual void WindowCloseCallback (GLFWwindow *window)
 

Protected Attributes

GLFWwindow * window_ = NULL
 
std::string window_name_ = "Open3D"
 
std::function< bool(Visualizer *)> animation_callback_func_ = nullptr
 
std::function< bool(Visualizer *)> animation_callback_func_in_loop_
 
MouseControl mouse_control_
 
bool is_redraw_required_ = true
 
bool is_initialized_ = false
 
GLuint vao_id_
 
std::unique_ptr< ViewControlview_control_ptr_
 
std::unique_ptr< RenderOptionrender_option_ptr_
 
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
 
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
 
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
 
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
 
std::shared_ptr< geometry::TriangleMeshcoordinate_frame_mesh_ptr_
 
std::shared_ptr< glsl::CoordinateFrameRenderercoordinate_frame_mesh_renderer_ptr_
 

Constructor & Destructor Documentation

◆ Visualizer() [1/3]

open3d::visualization::Visualizer::Visualizer ( )

◆ ~Visualizer()

open3d::visualization::Visualizer::~Visualizer ( )
virtual

◆ Visualizer() [2/3]

open3d::visualization::Visualizer::Visualizer ( Visualizer &&  )
delete

◆ Visualizer() [3/3]

open3d::visualization::Visualizer::Visualizer ( const Visualizer )
delete

Member Function Documentation

◆ AddGeometry()

bool open3d::visualization::Visualizer::AddGeometry ( std::shared_ptr< const geometry::Geometry geometry_ptr)
virtual

Function to add geometry to the scene and create corresponding shaders

  1. After calling this function, the Visualizer owns the geometry object.
  2. This function MUST be called after CreateVisualizerWindow().
  3. This function returns FALSE when the geometry is of an unsupported type.
  4. If an added geometry is changed, the behavior of Visualizer is undefined. Programmers are responsible for calling UpdateGeometry() to notify the Visualizer that the geometry has been changed and the Visualizer should be updated accordingly.

Reimplemented in open3d::visualization::VisualizerWithEditing.

◆ BuildUtilities()

void open3d::visualization::Visualizer::BuildUtilities ( )
virtual

◆ CaptureDepthFloatBuffer()

std::shared_ptr< geometry::Image > open3d::visualization::Visualizer::CaptureDepthFloatBuffer ( bool  do_render = true)

◆ CaptureDepthImage()

void open3d::visualization::Visualizer::CaptureDepthImage ( const std::string &  filename = "",
bool  do_render = true,
double  depth_scale = 1000.0 
)

◆ CaptureDepthPointCloud()

void open3d::visualization::Visualizer::CaptureDepthPointCloud ( const std::string &  filename = "",
bool  do_render = true,
bool  convert_to_world_coordinate = false 
)

◆ CaptureRenderOption()

void open3d::visualization::Visualizer::CaptureRenderOption ( const std::string &  filename = "")

◆ CaptureScreenFloatBuffer()

std::shared_ptr< geometry::Image > open3d::visualization::Visualizer::CaptureScreenFloatBuffer ( bool  do_render = true)

◆ CaptureScreenImage()

void open3d::visualization::Visualizer::CaptureScreenImage ( const std::string &  filename = "",
bool  do_render = true 
)

◆ Close()

void open3d::visualization::Visualizer::Close ( )

Function to to notify the window to be closed.

◆ CopyViewStatusFromClipboard()

void open3d::visualization::Visualizer::CopyViewStatusFromClipboard ( )
protected

◆ CopyViewStatusToClipboard()

void open3d::visualization::Visualizer::CopyViewStatusToClipboard ( )
protected

◆ CreateVisualizerWindow()

bool open3d::visualization::Visualizer::CreateVisualizerWindow ( const std::string &  window_name = "Open3D",
const int  width = 640,
const int  height = 480,
const int  left = 50,
const int  top = 50,
const bool  visible = true 
)

Function to create a window and initialize GLFW This function MUST be called from the main thread.

◆ DestroyVisualizerWindow()

void open3d::visualization::Visualizer::DestroyVisualizerWindow ( )

Function to destroy a window This function MUST be called from the main thread.

◆ GetRenderOption()

RenderOption& open3d::visualization::Visualizer::GetRenderOption ( )
inline

◆ GetViewControl()

ViewControl& open3d::visualization::Visualizer::GetViewControl ( )
inline

◆ GetWindowName()

const std::string& open3d::visualization::Visualizer::GetWindowName ( ) const
inline

◆ HasGeometry()

bool open3d::visualization::Visualizer::HasGeometry ( ) const
virtual

◆ InitOpenGL()

bool open3d::visualization::Visualizer::InitOpenGL ( )
protectedvirtual

Function to initialize OpenGL.

◆ InitRenderOption()

bool open3d::visualization::Visualizer::InitRenderOption ( )
protectedvirtual

Function to initialize RenderOption.

Reimplemented in open3d::visualization::VisualizerWithEditing.

◆ InitViewControl()

bool open3d::visualization::Visualizer::InitViewControl ( )
protectedvirtual

◆ KeyPressCallback()

void open3d::visualization::Visualizer::KeyPressCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)
protectedvirtual

◆ MouseButtonCallback()

void open3d::visualization::Visualizer::MouseButtonCallback ( GLFWwindow *  window,
int  button,
int  action,
int  mods 
)
protectedvirtual

◆ MouseMoveCallback()

void open3d::visualization::Visualizer::MouseMoveCallback ( GLFWwindow *  window,
double  x,
double  y 
)
protectedvirtual

◆ MouseScrollCallback()

void open3d::visualization::Visualizer::MouseScrollCallback ( GLFWwindow *  window,
double  x,
double  y 
)
protectedvirtual

◆ operator=()

Visualizer& open3d::visualization::Visualizer::operator= ( const Visualizer )
delete

◆ PollEvents()

bool open3d::visualization::Visualizer::PollEvents ( )

Function to process the event queue and return if the window is closed Use this function if you want to manage the while loop yourself. This function will NOT block the thread. Thus it is suitable for computation heavy task behind the scene.

◆ PrintVisualizerHelp()

void open3d::visualization::Visualizer::PrintVisualizerHelp ( )
virtual

◆ RegisterAnimationCallback()

void open3d::visualization::Visualizer::RegisterAnimationCallback ( std::function< bool(Visualizer *)>  callback_func)

Function to register a callback function for animation The callback function returns if UpdateGeometry() needs to be run

◆ RemoveGeometry()

bool open3d::visualization::Visualizer::RemoveGeometry ( std::shared_ptr< const geometry::Geometry geometry_ptr)
virtual

Function to remove geometry from the scene

  1. After calling this function, the Visualizer releases the pointer of the geometry object.
  2. This function MUST be called after CreateVisualizerWindow().
  3. This function returns FALSE if the geometry to be removed is not added by AddGeometry

◆ Render()

void open3d::visualization::Visualizer::Render ( )
protectedvirtual

Function to do the main rendering The function first sets view point, then draw geometry (pointclouds and meshes individually).

◆ ResetViewPoint()

void open3d::visualization::Visualizer::ResetViewPoint ( bool  reset_bounding_box = false)

◆ Run()

void open3d::visualization::Visualizer::Run ( )

Function to activate the window This function will block the current thread until the window is closed.

◆ UpdateGeometry()

bool open3d::visualization::Visualizer::UpdateGeometry ( )
virtual

Function to update geometry This function must be called when geometry has been changed. Otherwise the behavior of Visualizer is undefined.

◆ UpdateRender()

void open3d::visualization::Visualizer::UpdateRender ( )
virtual

Function to set the redraw flag as dirty.

◆ UpdateWindowTitle()

void open3d::visualization::Visualizer::UpdateWindowTitle ( )
virtual

◆ WaitEvents()

bool open3d::visualization::Visualizer::WaitEvents ( )

Function to process the event queue and return if the window is closed Use this function if you want to manage the while loop yourself. This function will block the thread.

◆ WindowCloseCallback()

void open3d::visualization::Visualizer::WindowCloseCallback ( GLFWwindow *  window)
protectedvirtual

◆ WindowRefreshCallback()

void open3d::visualization::Visualizer::WindowRefreshCallback ( GLFWwindow *  window)
protectedvirtual

◆ WindowResizeCallback()

void open3d::visualization::Visualizer::WindowResizeCallback ( GLFWwindow *  window,
int  w,
int  h 
)
protectedvirtual

Field Documentation

◆ animation_callback_func_

std::function<bool(Visualizer *)> open3d::visualization::Visualizer::animation_callback_func_ = nullptr
protected

◆ animation_callback_func_in_loop_

std::function<bool(Visualizer *)> open3d::visualization::Visualizer::animation_callback_func_in_loop_
protected
Initial value:
=
nullptr

◆ coordinate_frame_mesh_ptr_

std::shared_ptr<geometry::TriangleMesh> open3d::visualization::Visualizer::coordinate_frame_mesh_ptr_
protected

◆ coordinate_frame_mesh_renderer_ptr_

std::shared_ptr<glsl::CoordinateFrameRenderer> open3d::visualization::Visualizer::coordinate_frame_mesh_renderer_ptr_
protected

◆ geometry_ptrs_

std::unordered_set<std::shared_ptr<const geometry::Geometry> > open3d::visualization::Visualizer::geometry_ptrs_
protected

◆ geometry_renderer_ptrs_

std::unordered_set<std::shared_ptr<glsl::GeometryRenderer> > open3d::visualization::Visualizer::geometry_renderer_ptrs_
protected

◆ is_initialized_

bool open3d::visualization::Visualizer::is_initialized_ = false
protected

◆ is_redraw_required_

bool open3d::visualization::Visualizer::is_redraw_required_ = true
protected

◆ mouse_control_

MouseControl open3d::visualization::Visualizer::mouse_control_
protected

◆ render_option_ptr_

std::unique_ptr<RenderOption> open3d::visualization::Visualizer::render_option_ptr_
protected

◆ utility_ptrs_

std::vector<std::shared_ptr<const geometry::Geometry> > open3d::visualization::Visualizer::utility_ptrs_
protected

◆ utility_renderer_ptrs_

std::vector<std::shared_ptr<glsl::GeometryRenderer> > open3d::visualization::Visualizer::utility_renderer_ptrs_
protected

◆ vao_id_

GLuint open3d::visualization::Visualizer::vao_id_
protected

◆ view_control_ptr_

std::unique_ptr<ViewControl> open3d::visualization::Visualizer::view_control_ptr_
protected

◆ window_

GLFWwindow* open3d::visualization::Visualizer::window_ = NULL
protected

◆ window_name_

std::string open3d::visualization::Visualizer::window_name_ = "Open3D"
protected

The documentation for this class was generated from the following files: