41 obj->setColor(0.4, 0.4, 0.4);
47 obj->enableTickMarks();
48 obj->setAxisLimits(-10, -10, -10, 10, 10, 10);
53 obj->setColor(0, 0, 1);
55 obj->setLocation(0, 0, 1);
56 obj->setName(
"ball_1");
61 obj->setColor(1, 0, 0);
63 obj->setLocation(-1, -1, 1);
64 obj->setName(
"ball_2");
76 CCamera& camera = render.getCamera(scene);
84 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
85 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
86 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
90 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
91 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
92 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
103 render.getFrame2(scene, frame);
106 win.showImage(frame);
108 std::this_thread::sleep_for(50ms);
115 int main(
int argc,
char* argv[])
122 catch (
const std::exception& e)
129 printf(
"Untyped exception!!");
GLsizei GLsizei GLuint * obj
static Ptr Create(Args &&... args)
void setZoomDistance(float z)
This class creates a window as a graphical user interface (GUI) for displaying images to the user...
mrpt::gui::CDisplayWindow3D::Ptr win
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CRenderizable::Ptr getByName(const std::string &str, const std::string &viewportName=std::string("main"))
Returns the first object with a given name, or nullptr (an empty smart pointer) if not found...
The namespace for 3D scene representation and rendering.
bool kbhit() noexcept
An OS-independent version of kbhit, which returns true if a key has been pushed.
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives...
static Ptr Create(Args &&... args)
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
Classes for creating GUI windows for 2D and 3D visualization.
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
GLenum GLsizei GLsizei height
void insert(const CRenderizable::Ptr &newObject, const std::string &viewportName=std::string("main"))
Insert a new object into the scene, in the given viewport (by default, into the "main" viewport)...
static Ptr Create(Args &&... args)
A class for storing images as grayscale or RGB bitmaps.
A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext)...