25 #include <mrpt/examples_config.h> 28 MRPT_EXAMPLES_BASE_DIRECTORY +
29 string(
"opengl_textured_triangles_example/"));
43 opengl::CGridPlaneXY::Create(-20, 20, -20, 20, 0, 1);
44 obj->setColor(0.4, 0.4, 0.4);
50 obj->enableTickMarks();
51 obj->setAxisLimits(-10, -10, -10, 10, 10, 10);
56 obj->setColor(0, 0, 1);
58 obj->setLocation(0, 0, 1);
59 obj->setName(
"ball_1");
64 obj->setColor(1, 0, 0);
66 obj->setLocation(-1, -1, 1);
67 obj->setName(
"ball_2");
79 opengl::CSetOfTexturedTriangles::Create();
84 -2.0, -2.0, 0, 0, 256),
87 obj->insertTriangle(tri);
93 obj->insertTriangle(tri);
102 win.unlockAccess3DScene();
104 win.setCameraElevationDeg(25.0f);
113 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
114 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
115 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
117 obj = scene->getByName(
"ball_2");
119 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
120 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
121 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
124 win.unlockAccess3DScene();
129 std::this_thread::sleep_for(20ms);
136 int main(
int argc,
char* argv[])
143 catch (
const std::exception& e)
150 printf(
"Untyped exception!!");
GLclampf GLclampf GLclampf alpha
GLenum GLsizei GLenum GLenum const GLvoid * image
GLsizei GLsizei GLuint * obj
mrpt::gui::CDisplayWindow3D::Ptr win
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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.
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 class for storing images as grayscale or RGB bitmaps.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.