class mrpt::gui::CGlCanvasBase

Overview

This base class implements a working with opengl::Camera and a OpenGL canvas, and it’s used in gui::CWxGLCanvasBase and gui::CQtGlCanvasBase.

#include <mrpt/gui/CGlCanvasBase.h>

class CGlCanvasBase
{
public:
    // construction

    CGlCanvasBase();
    CGlCanvasBase(const CGlCanvasBase&);
    CGlCanvasBase(CGlCanvasBase&&);

    // methods

    CGlCanvasBase& operator = (const CGlCanvasBase&);
    CGlCanvasBase& operator = (CGlCanvasBase&&);
    void setMousePos(int x, int y);
    void setMouseClicked(bool is);
    void updateLastPos(int x, int y);
    void resizeViewport(int w, int h);
    void setUseCameraFromScene(bool is);
    bool getUseCameraFromScene() const;
    mrpt::viz::Scene::Ptr& getOpenGLSceneRef();
    mrpt::opengl::ShaderProgramManager* getShaderManager();
};

// direct descendants

class CGlCanvasBaseHeadless;

Methods

void setMousePos(int x, int y)

Saves the click position of the mouse See also setMouseClicked(bool)

void setMouseClicked(bool is)

Sets the property mouseClicked By default, this property is false.

See also setMousePos(int, int)

void updateLastPos(int x, int y)

Sets the last mouse position.

void resizeViewport(int w, int h)

Calls the glViewport function.

void setUseCameraFromScene(bool is)

If set to true (default=false), the cameraPointingX,…

parameters are ignored and the camera stored in the 3D scene is used instead. See also bool getUseCameraFromScene()

bool getUseCameraFromScene() const

See also void setUseCameraFromScene(bool)

mrpt::viz::Scene::Ptr& getOpenGLSceneRef()

At constructor an empty scene is created.

The object is freed at GL canvas destructor. This function returns a smart pointer to the opengl scene getOpenGLSceneRef

mrpt::opengl::ShaderProgramManager* getShaderManager()

Returns the shader manager for the current compiled scene, or nullptr if the scene has not been compiled yet.

Must be called from the OpenGL context thread.