20 : nanogui::GLCanvas(parent)
28 #if MRPT_HAS_OPENGL_GLUT 29 std::lock_guard<std::mutex> lck(
scene_mtx);
36 m_backgroundColor.
R, m_backgroundColor.
G, m_backgroundColor.
B,
43 glGetIntegerv(GL_VIEWPORT, win_dims);
49 "Fatal error: there is no 'main' viewport in the 3D scene!");
53 for (
const auto& m_viewport :
scene->viewports())
55 win_dims[2], win_dims[3], win_dims[0], win_dims[1]);
57 catch (
const std::exception& e)
59 std::cerr <<
"[MRPT2NanoguiGLCanvas::drawGL] Exception:\n" 66 const nanogui::Vector2i& p,
const nanogui::Vector2i& rel,
int button,
74 const nanogui::Vector2i& p,
int button,
bool down,
int modifiers)
80 const nanogui::Vector2i& p,
const nanogui::Vector2f& rel)
86 #endif // MRPT_HAS_NANOGUI virtual bool scrollEvent(const nanogui::Vector2i &p, const nanogui::Vector2f &rel) override
#define THROW_EXCEPTION(msg)
void scrollEvent(const nanogui::Vector2i &p, const nanogui::Vector2f &rel)
virtual bool mouseMotionEvent(const nanogui::Vector2i &p, const nanogui::Vector2i &rel, int button, int modifiers) override
void render(const RenderContext &rc) const override
Render does nothing here.
MRPT2NanoguiGLCanvas(nanogui::Widget *parent)
virtual bool mouseButtonEvent(const nanogui::Vector2i &p, int button, bool down, int modifiers) override
internal::NanoGUICanvasHeadless m_headless_canvas
Used to keep track of mouse events on the camera.
void mouseButtonEvent(const nanogui::Vector2i &p, int button, bool down, int modifiers)
An RGBA color - floats in the range [0,1].
mrpt::opengl::COpenGLScene::Ptr scene
The scene to render in this control.
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
Classes for creating GUI windows for 2D and 3D visualization.
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
void mouseMotionEvent(const nanogui::Vector2i &p, const nanogui::Vector2i &rel, int button, int modifiers)
virtual void drawGL() override
mrpt::opengl::CCamera & updateCameraParams(mrpt::opengl::CCamera &cam) const
This function gets a reference to mrpt::opengl::CCamera and updates the camera parameters(pointing, zoom, azimuth, elevation, IsProjective, FOV)