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 updateLastPos(int x, int y);
    void resizeViewport(int w, int h);
    const mrpt::viz::COrbitCameraController& orbitCameraController() const;
    mrpt::viz::COrbitCameraController& orbitCameraController();
    void setUseCameraFromScene(bool is);
    bool getUseCameraFromScene() const;
    void getLastMousePosition(int& x, int& y) const;
    mrpt::viz::Scene::Ptr& getOpenGLSceneRef();
    void setOpenGLSceneRef(mrpt::viz::Scene::Ptr scene);
    mrpt::opengl::ShaderProgramManager* getShaderManager();
};

// direct descendants

class CGlCanvasBaseHeadless;

Methods

void updateLastPos(int x, int y)

Records the latest known pointer position, in widget-local pixels.

See also:

getLastMousePosition()

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)

void getLastMousePosition(int& x, int& y) const

Latest pointer position seen by the canvas, in widget-local pixels.

See also:

updateLastPos()

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.