25 #include <mrpt/examples_config.h>
28 MRPT_EXAMPLES_BASE_DIRECTORY +
29 string(
"opengl_textured_triangles_example/"));
43 mrpt::make_aligned_shared<opengl::CGridPlaneXY>(
44 -20, 20, -20, 20, 0, 1);
45 obj->setColor(0.4, 0.4, 0.4);
51 obj->enableTickMarks();
52 obj->setAxisLimits(-10, -10, -10, 10, 10, 10);
57 obj->setColor(0, 0, 1);
59 obj->setLocation(0, 0, 1);
60 obj->setName(
"ball_1");
65 obj->setColor(1, 0, 0);
67 obj->setLocation(-1, -1, 1);
68 obj->setName(
"ball_2");
80 mrpt::make_aligned_shared<opengl::CSetOfTexturedTriangles>();
85 -2.0, -2.0, 0, 0, 256),
88 obj->insertTriangle(tri);
94 obj->insertTriangle(tri);
103 win.unlockAccess3DScene();
105 win.setCameraElevationDeg(25.0f);
114 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
115 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
116 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
118 obj = scene->getByName(
"ball_2");
120 obj->getPoseX() + cos(
obj->getPoseY() / 2) * 0.05,
121 obj->getPoseY() - sin(
obj->getPoseX() / 2) * 0.09,
122 obj->getPoseZ() - sin(
obj->getPoseX() / 2) * 0.08);
125 win.unlockAccess3DScene();
130 std::this_thread::sleep_for(20ms);
137 int main(
int argc,
char* argv[])
144 catch (std::exception& e)
146 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
151 printf(
"Untyped exception!!");