Polygon Mesh Processing Library
Loading...
Searching...
No Matches
Window Class Referenceabstract

A window provided by GLFW. More...

#include <pmp/visualization/window.h>

Inherited by TrackballViewer.

Public Member Functions

 Window (const char *title, int width, int height, bool showgui=true)
 constructor
 
virtual ~Window ()
 destructor
 
int run ()
 main window loop
 

Protected Member Functions

virtual void display ()=0
 this function is called when the scene has to be rendered.
 
virtual void keyboard (int, int, int, int)
 this function handles keyboard events
 
virtual void character (unsigned int)
 this function handles unicode character events
 
virtual void mouse (int, int, int)
 this function handles mouse button events
 
virtual void motion (double, double)
 this function handles mouse motion (passive/active position)
 
virtual void scroll (double, double)
 this function handles mouse scroll events
 
virtual void resize (int, int)
 this function is called if the window is resized
 
virtual void drop (int, const char **)
 this function is called if a file is dropped onto the window
 
virtual void process_imgui ()
 this function renders the ImGUI elements and handles their events
 
virtual void do_processing ()
 this function is called just before rendering
 
void init_imgui ()
 setup ImGUI user interface
 
void scale_imgui (float scale)
 scale ImGUI elements and font
 
bool show_imgui () const
 is ImGUI visible or hidden?
 
void show_imgui (bool b)
 show or hide ImGUI
 
void clear_help_items ()
 clear help items
 
void add_help_item (std::string key, std::string description, int position=-1)
 add key binding (or general action description)
 
void show_help ()
 show ImGUI help dialog
 
void screenshot ()
 take a screenshot, save it to title-n.png using the window title and an incremented number n.
 
int width () const
 width of window
 
int height () const
 height of window
 
float high_dpi_scaling () const
 highDPI scaling
 
float imgui_scaling () const
 imgui scaling
 
void cursor_pos (double &x, double &y) const
 get position of mouse cursor
 
bool left_mouse_pressed () const
 is left mouse button pressed down?
 
bool right_mouse_pressed () const
 is right mouse button pressed down?
 
bool middle_mouse_pressed () const
 is middle mouse button pressed down?
 
bool ctrl_pressed () const
 is CTRL modifier key pressed down?
 
bool alt_pressed () const
 is ALT modifier key pressed down?
 
bool shift_pressed () const
 is SHIFT modifier key pressed down?
 

Detailed Description

A window provided by GLFW.

Member Function Documentation

◆ display()

virtual void display ( )
protectedpure virtual

this function is called when the scene has to be rendered.

it clears the buffers, calls the draw() method, and performs buffer swap

Implemented in TrackballViewer.