Go to the documentation of this file.
9 #ifndef CDisplayWindow3D_H
10 #define CDisplayWindow3D_H
23 class C3DWindowDialog;
24 class CMyGLCanvas_DisplayWindow3D;
120 using Ptr = std::shared_ptr<CDisplayWindow3D>;
121 using ConstPtr = std::shared_ptr<const CDisplayWindow3D>;
159 unsigned int initialWindowWidth = 400,
160 unsigned int initialWindowHeight = 300);
164 const std::string& windowCaption,
unsigned int initialWindowWidth = 400,
165 unsigned int initialWindowHeight = 300);
331 const size_t unique_index = 0,
339 const double x_frac,
const double y_frac,
const std::string& text,
341 const double font_size,
343 const size_t unique_index = 0,
const double font_spacing = 1.5,
344 const double font_kerning = 0.1,
const bool draw_shadow =
false,
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
void setMaxRange(double new_max)
Changes the camera max clip range (z) (used for gluPerspective.
void setFOV(float v)
Changes the camera field of view (in degrees) (used for gluPerspective).
void internal_emitGrabImageEvent(const std::string &fil)
called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers
virtual void setCursorCross(bool cursorIsCross) override
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
The basic event type for the observer-observable pattern in MRPT.
bool isCameraProjective() const
Sets the camera as projective, or orthogonal.
std::recursive_mutex m_csAccess3DScene
Critical section for accesing m_3Dscene.
float getFOV() const
Return the camera field of view (in degrees) (used for gluPerspective)
float getCameraElevationDeg() const
Get camera parameters programmatically.
mrpt::void_ptr_noncopy m_GLRenderingContext
virtual ~CDisplayWindow3D()
Destructor.
mrpt::opengl::COpenGLScene::Ptr m_3Dscene
Internal OpenGL object (see general discussion in about usage of this object)
void grabImagesStart(const std::string &grab_imgs_prefix=std::string("video_"))
Start to save rendered images to disk.
bool isCapturingImgs() const
static CDisplayWindow3D::Ptr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer.
CDisplayWindow3D(const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Constructor.
TOpenGLFontStyle
Different style for vectorized font rendering.
void createOpenGLContext()
Throws an exception on initialization error.
void setWindowTitle(const std::string &str) override
Changes the window title.
@ NICE
renders glyphs filled with antialiased outlines
mrpt::void_ptr_noncopy m_DisplayDeviceContext
void internalSetMinMaxRange()
CDisplayWindow3D * source_object
GLsizei GLsizei GLuint * obj
void getCameraPointingToPoint(float &x, float &y, float &z) const
Get camera parameters programmatically.
std::string m_grab_imgs_prefix
void setCameraZoom(float zoom)
Changes the camera parameters programmatically.
void captureImagesStart()
Enables the grabbing of CImage objects from screenshots of the window.
virtual bool getLastMousePosition(int &x, int &y) const override
Gets the last x,y pixel coordinates of the mouse.
mrpt::opengl::COpenGLScene::Ptr & get3DSceneAndLock()
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introductio...
Auxiliary class for safely claiming the 3DScene of a mrpt::gui::CDisplayWindow3D.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void addTextMessage(const double x, const double y, const std::string &text, const mrpt::img::TColorf &color=mrpt::img::TColorf(1.0, 1.0, 1.0), const size_t unique_index=0, const mrpt::opengl::TOpenGLFont font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24)
Add 2D text messages overlapped to the 3D rendered scene.
double getRenderingFPS() const
Get the average Frames Per Second (FPS) value from the last 250 rendering events.
mrpt::opengl::COpenGLViewport::Ptr getDefaultViewport()
A short cut for getting the "main" viewport of the scene object, it is equivalent to:
void resize(unsigned int width, unsigned int height) override
Resizes the window, stretching the image to fit into the display area.
void clearTextMessages()
Clear all text messages created with addTextMessage().
An event sent by a CDisplayWindow3D window when an image is saved after enabling this feature with CD...
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
void useCameraFromScene(bool useIt=true)
If set to true (default = false), the mouse-based scene navigation will be disabled and the camera po...
float getCameraAzimuthDeg() const
Get camera parameters programmatically.
std::shared_ptr< const CDisplayWindow3D > ConstPtr
The base class for GUI window classes.
void setCameraProjective(bool isProjective)
Sets the camera as projective, or orthogonal.
void setCameraPointingToPoint(float x, float y, float z)
Changes the camera parameters programmatically.
void unlockAccess3DScene()
Unlocks the access to the internal 3D scene.
bool getLastMousePositionRay(mrpt::math::TLine3D &ray) const
Gets the 3D ray for the direction line of the pixel where the mouse cursor is at.
float getCameraZoom() const
Get camera parameters programmatically.
mrpt::gui::CDisplayWindow3D::Ptr win
void captureImagesStop()
Stop image grabbing.
std::string grabImageGetNextFile()
Increments by one the image counter and return the next image file name (Users normally don't want to...
void setCameraElevationDeg(float deg)
Changes the camera parameters programmatically.
mrpt::system::TTimeStamp m_lastFullScreen
A RGB color - floats in the range [0,1].
friend class CMyGLCanvas_DisplayWindow3D
std::shared_ptr< CDisplayWindow3D > Ptr
virtual void do_nothing() override
Just to allow this class to be polymorphic.
void forceRepaint()
Repaints the window.
void setImageView_fast(mrpt::img::CImage &img)
Just like setImageView but moves the internal image memory instead of making a copy,...
std::mutex m_last_captured_img_cs
GLenum GLsizei GLsizei height
A class for storing images as grayscale or RGB bitmaps.
mrptEvent3DWindowGrabImageFile(CDisplayWindow3D *obj, const std::string &_img_file)
CDisplayWindow3DLocker(CDisplayWindow3D &win, mrpt::opengl::COpenGLScene::Ptr &out_scene_ptr)
Acquires the lock of the 3D scene of the referenced window, and returns a copy of the smart pointer t...
unsigned int m_grab_imgs_idx
void internal_setRenderingFPS(double FPS)
Set the rendering FPS (users don't call this, the method is for internal MRPT objects only)
std::shared_ptr< CImage > Ptr
void updateWindow()
Repaints the window.
bool getLastWindowImage(mrpt::img::CImage &out_img) const
Retrieve the last captured image from the window.
3D line, represented by a base point and a director vector.
GLsizei const GLchar ** string
std::shared_ptr< COpenGLScene > Ptr
void setPos(int x, int y) override
Changes the position of the window on the screen.
void setCameraAzimuthDeg(float deg)
Changes the camera parameters programmatically.
void repaint()
Repaints the window.
const std::string & img_file
The absolute path of the file that has been just saved.
void setImageView(const mrpt::img::CImage &img)
Set the "main" viewport into "image view"-mode, where an image is efficiently drawn (fitting the view...
mrpt::img::CImage::Ptr getLastWindowImagePtr() const
Retrieve the last captured image from the window, as a smart pointer.
std::shared_ptr< COpenGLViewport > Ptr
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
@ MRPT_GLUT_BITMAP_TIMES_ROMAN_24
void setMinRange(double new_min)
Changes the camera min clip range (z) (used for gluPerspective).
mrpt::img::CImage::Ptr m_last_captured_img
void grabImagesStop()
Stops image grabbing started by grabImagesStart.
~CDisplayWindow3DLocker()
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |