#include <mrpt/gui/CDisplayWindow3D.h>
Public Member Functions | |
CDisplayWindow3D (const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300) | |
Constructor. | |
virtual | ~CDisplayWindow3D () |
Destructor. | |
opengl::COpenGLScenePtr & | get3DSceneAndLock () |
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!) This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked. | |
void | unlockAccess3DScene () |
Unlocks the access to the internal 3D scene. | |
void | forceRepaint () |
Repaints the window. | |
void | repaint () |
Repaints the window. | |
void | updateWindow () |
Repaints the window. | |
float | getMinRange () const |
Return the camera min range (z) (used for gluPerspective). | |
float | getMaxRange () const |
Return the camera max range (z) (used for gluPerspective). | |
float | getFOV () const |
Return the camera field of view (in degrees) (used for gluPerspective). | |
void | setMinRange (float v) |
Changes the camera min range (z) (used for gluPerspective). | |
void | setMaxRange (float v) |
Changes the camera max range (z) (used for gluPerspective). | |
void | setFOV (float v) |
Changes the camera field of view (in degrees) (used for gluPerspective). | |
void | resize (unsigned int width, unsigned int height) |
Resizes the window, stretching the image to fit into the display area. | |
void | setPos (int x, int y) |
Changes the position of the window on the screen. | |
void | setWindowTitle (const std::string &str) |
Changes the window title. | |
void | setCameraElevationDeg (float deg) |
Changes the camera parameters programatically. | |
void | setCameraAzimuthDeg (float deg) |
Changes the camera parameters programatically. | |
void | setCameraPointingToPoint (float x, float y, float z) |
Changes the camera parameters programatically. | |
void | setCameraZoom (float zoom) |
Changes the camera parameters programatically. | |
void | setCameraProjective (bool isProjective) |
Sets the camera as projective, or orthogonal. | |
float | getCameraElevationDeg () const |
Get camera parameters programatically. | |
float | getCameraAzimuthDeg () const |
Get camera parameters programatically. | |
void | getCameraPointingToPoint (float &x, float &y, float &z) const |
Get camera parameters programatically. | |
float | getCameraZoom () const |
Get camera parameters programatically. | |
bool | isCameraProjective () const |
Sets the camera as projective, or orthogonal. | |
void | grabImagesStart (const std::string &grab_imgs_prefix=std::string("video_")) |
Start to save rendered images to disk. | |
void | grabImagesStop () |
Stops image grabbing started by grabImagesStart. | |
void | captureImagesStart () |
Enables the grabbing of CImage objects from screenshots of the window. | |
void | captureImagesStop () |
Stop image grabbing. | |
void | getLastWindowImage (mrpt::utils::CImage &out_img) const |
Retrieve the last captured image from the window. | |
mrpt::utils::CImagePtr | getLastWindowImagePtr () const |
Retrieve the last captured image from the window, as a smart pointer. | |
std::string | grabImageGetNextFile () |
Increments by one the image counter and return the next image file name (Users normally don't want to call this method). | |
bool | isCapturingImgs () const |
Private Member Functions | |
void | createOpenGLContext () |
Throws an exception on initialization error. | |
void | doRender () |
Private Attributes | |
float | m_minRange |
float | m_maxRange |
float | m_FOV |
opengl::COpenGLScenePtr | m_3Dscene |
Internal OpenGL object (see general discussion in about usage of this object). | |
synch::CCriticalSection | m_csAccess3DScene |
Critical section for accesing m_3Dscene. | |
void_ptr_noncopy | m_DisplayDeviceContext |
void_ptr_noncopy | m_GLRenderingContext |
std::string | m_grab_imgs_prefix |
unsigned int | m_grab_imgs_idx |
bool | m_is_capturing_imgs |
CImagePtr | m_last_captured_img |
synch::CCriticalSection | m_last_captured_img_cs |
Friends | |
class | C3DWindowDialog |
class | CMyGLCanvas_DisplayWindow3D |
This class always contains internally an instance of opengl::COpenGLScene, which the objects, viewports, etc. to be rendered.
Since MRPT 0.6.2, images can be grabbed automatically to disk for easy creation of videos. See CDisplayWindow3D::grabImagesStart
Since the 3D rendering is performed in a detached thread, especial care must be taken when updating the 3D scene to be rendered. The process involves an internal critical section and it must always consist of these steps:
CDisplayWindow3D win("My window"); // Adquire the scene: opengl::COpenGLScenePtr &ptrScene = win.get3DSceneAndLock(); // Modify the scene: ptrScene->... // or replace by another scene: ptrScene = otherScene; // Unlock it, so the window can use it for redraw: win.unlockAccess3DScene(); // Update window, if required win.forceRepaint();
An alternative way of updating the scene is by creating, before locking the 3D window, a new object of class COpenGLScene, then locking the window only for replacing the smart pointer. This may be advantageous is generating the 3D scene takes a long time, since while the window is locked it will not be responsive to the user input or window redraw.
Definition at line 92 of file CDisplayWindow3D.h.
mrpt::gui::CDisplayWindow3D::CDisplayWindow3D | ( | const std::string & | windowCaption = std::string() , |
|
unsigned int | initialWindowWidth = 400 , |
|||
unsigned int | initialWindowHeight = 300 | |||
) |
Constructor.
virtual mrpt::gui::CDisplayWindow3D::~CDisplayWindow3D | ( | ) | [virtual] |
Destructor.
void mrpt::gui::CDisplayWindow3D::captureImagesStart | ( | ) |
void mrpt::gui::CDisplayWindow3D::captureImagesStop | ( | ) |
void mrpt::gui::CDisplayWindow3D::createOpenGLContext | ( | ) | [private] |
Throws an exception on initialization error.
void mrpt::gui::CDisplayWindow3D::doRender | ( | ) | [private] |
void mrpt::gui::CDisplayWindow3D::forceRepaint | ( | ) |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method.
opengl::COpenGLScenePtr& mrpt::gui::CDisplayWindow3D::get3DSceneAndLock | ( | ) |
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!) This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked.
float mrpt::gui::CDisplayWindow3D::getCameraAzimuthDeg | ( | ) | const |
Get camera parameters programatically.
float mrpt::gui::CDisplayWindow3D::getCameraElevationDeg | ( | ) | const |
Get camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::getCameraPointingToPoint | ( | float & | x, | |
float & | y, | |||
float & | z | |||
) | const |
Get camera parameters programatically.
float mrpt::gui::CDisplayWindow3D::getCameraZoom | ( | ) | const |
Get camera parameters programatically.
float mrpt::gui::CDisplayWindow3D::getFOV | ( | ) | const [inline] |
Return the camera field of view (in degrees) (used for gluPerspective).
Definition at line 175 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::getLastWindowImage | ( | mrpt::utils::CImage & | out_img | ) | const |
Retrieve the last captured image from the window.
You MUST CALL FIRST captureImagesStart to enable image grabbing.
mrpt::utils::CImagePtr mrpt::gui::CDisplayWindow3D::getLastWindowImagePtr | ( | ) | const |
Retrieve the last captured image from the window, as a smart pointer.
This method is more efficient than getLastWindowImage since only a copy of the pointer is performed, while getLastWindowImage would copy the entire image.
You MUST CALL FIRST captureImagesStart to enable image grabbing.
float mrpt::gui::CDisplayWindow3D::getMaxRange | ( | ) | const [inline] |
Return the camera max range (z) (used for gluPerspective).
Definition at line 171 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::getMinRange | ( | ) | const [inline] |
Return the camera min range (z) (used for gluPerspective).
Definition at line 167 of file CDisplayWindow3D.h.
std::string mrpt::gui::CDisplayWindow3D::grabImageGetNextFile | ( | ) |
Increments by one the image counter and return the next image file name (Users normally don't want to call this method).
void mrpt::gui::CDisplayWindow3D::grabImagesStart | ( | const std::string & | grab_imgs_prefix = std::string("video_") |
) |
Start to save rendered images to disk.
Images will be saved independently as png files, depending on the template path passed to this method. For example:
path_prefix: "./video_"
Will generate "./video_000001.png", etc.
void mrpt::gui::CDisplayWindow3D::grabImagesStop | ( | ) |
bool mrpt::gui::CDisplayWindow3D::isCameraProjective | ( | ) | const |
Sets the camera as projective, or orthogonal.
bool mrpt::gui::CDisplayWindow3D::isCapturingImgs | ( | ) | const [inline] |
Definition at line 287 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::repaint | ( | ) | [inline] |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method.
Definition at line 158 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::resize | ( | unsigned int | width, | |
unsigned int | height | |||
) | [virtual] |
Resizes the window, stretching the image to fit into the display area.
Implements mrpt::gui::CBaseGUIWindow.
void mrpt::gui::CDisplayWindow3D::setCameraAzimuthDeg | ( | float | deg | ) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setCameraElevationDeg | ( | float | deg | ) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setCameraPointingToPoint | ( | float | x, | |
float | y, | |||
float | z | |||
) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setCameraProjective | ( | bool | isProjective | ) |
Sets the camera as projective, or orthogonal.
void mrpt::gui::CDisplayWindow3D::setCameraZoom | ( | float | zoom | ) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setFOV | ( | float | v | ) | [inline] |
Changes the camera field of view (in degrees) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 190 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::setMaxRange | ( | float | v | ) | [inline] |
Changes the camera max range (z) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 185 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::setMinRange | ( | float | v | ) | [inline] |
Changes the camera min range (z) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 180 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::setPos | ( | int | x, | |
int | y | |||
) | [virtual] |
void mrpt::gui::CDisplayWindow3D::setWindowTitle | ( | const std::string & | str | ) | [virtual] |
void mrpt::gui::CDisplayWindow3D::unlockAccess3DScene | ( | ) |
Unlocks the access to the internal 3D scene.
Typically user will want to call forceRepaint after updating the scene.
void mrpt::gui::CDisplayWindow3D::updateWindow | ( | ) | [inline] |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method.
Definition at line 163 of file CDisplayWindow3D.h.
friend class C3DWindowDialog [friend] |
friend class CMyGLCanvas_DisplayWindow3D [friend] |
Definition at line 98 of file CDisplayWindow3D.h.
opengl::COpenGLScenePtr mrpt::gui::CDisplayWindow3D::m_3Dscene [private] |
Internal OpenGL object (see general discussion in about usage of this object).
Definition at line 106 of file CDisplayWindow3D.h.
Definition at line 116 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::m_FOV [private] |
Definition at line 101 of file CDisplayWindow3D.h.
Definition at line 117 of file CDisplayWindow3D.h.
unsigned int mrpt::gui::CDisplayWindow3D::m_grab_imgs_idx [private] |
Definition at line 120 of file CDisplayWindow3D.h.
std::string mrpt::gui::CDisplayWindow3D::m_grab_imgs_prefix [private] |
Definition at line 119 of file CDisplayWindow3D.h.
bool mrpt::gui::CDisplayWindow3D::m_is_capturing_imgs [private] |
Definition at line 122 of file CDisplayWindow3D.h.
CImagePtr mrpt::gui::CDisplayWindow3D::m_last_captured_img [private] |
Definition at line 123 of file CDisplayWindow3D.h.
Definition at line 124 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::m_maxRange [private] |
Definition at line 101 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::m_minRange [private] |
Definition at line 101 of file CDisplayWindow3D.h.
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |