Class CGlCanvasBase

Inheritance Relationships

Derived Type

Class Documentation

class CGlCanvasBase

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

Subclassed by mrpt::gui::CGlCanvasBaseHeadless

Public Functions

CGlCanvasBase() = default
virtual ~CGlCanvasBase()
CGlCanvasBase(const CGlCanvasBase&) = delete
CGlCanvasBase &operator=(const CGlCanvasBase&) = delete
CGlCanvasBase(CGlCanvasBase&&) noexcept = default
CGlCanvasBase &operator=(CGlCanvasBase&&) noexcept = default
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

inline const mrpt::viz::COrbitCameraController &orbitCameraController() const
inline mrpt::viz::COrbitCameraController &orbitCameraController()
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)

inline void getLastMousePosition(int &x, int &y) const
inline 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

void setOpenGLSceneRef(mrpt::viz::Scene::Ptr scene)
inline mrpt::opengl::ShaderProgramManager *getShaderManager()

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

Note

Must be called from the OpenGL context thread.

Protected Functions

virtual void swapBuffers() = 0
virtual void preRender() = 0
virtual void postRender() = 0
virtual void renderError(const std::string &err_msg) = 0
virtual double renderCanvas(int width = -1, int height = -1)