40 mrpt::make_aligned_shared<opengl::CGridPlaneXY>(
41 -20, 20, -20, 20, 0, 1);
42 obj->setColor(0.4, 0.4, 0.4);
48 obj->enableTickMarks();
49 obj->setAxisLimits(-10, -10, -10, 10, 10, 10);
54 obj->setColor(0, 0, 1);
56 obj->setLocation(0, 0, 1);
57 obj->setName(
"ball_1");
62 obj->setColor(1, 0, 0);
64 obj->setLocation(-1, -1, 1);
65 obj->setName(
"ball_2");
77 CCamera& camera = render.getCamera(scene);
85 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
86 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
87 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
91 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
92 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
93 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
104 render.getFrame2(scene, frame);
107 win.showImage(frame);
109 std::this_thread::sleep_for(50ms);
116 int main(
int argc,
char* argv[])
123 catch (std::exception& e)
125 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
130 printf(
"Untyped exception!!");
GLsizei GLsizei GLuint * obj
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...
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)...
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)...