16 #include <mrpt/examples_config.h>
18 MRPT_EXAMPLES_BASE_DIRECTORY +
36 CImage imgCol_2N, imgBW_2N;
54 for (
int y = 0;
y < H;
y++)
55 for (
int x = 0;
x < W;
x++)
56 *transpMask_N(
x,
y) = (((
x +
y) >> 5) & 1) ? 240 : 10;
59 transpMask_N.
scaleImage(transpMask_2N, 512, 512);
61 cout <<
"Loaded image size: " << imgCol_N.
getWidth() <<
"x"
63 cout <<
"2^N image size : " << imgCol_2N.
getWidth() <<
"x"
71 const double off_y_label = 4;
72 const double STEP_X = 15;
77 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
78 obj->assignImage(imgCol_N);
79 obj->setLocation(off_x, 0, 0);
80 theScene->insert(
obj);
83 "Color texture, random size, w/o transp");
84 gl_txt->setLocation(off_x, off_y_label, 0);
85 theScene->insert(gl_txt);
92 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
93 obj->assignImage(imgCol_N, transpMask_N);
94 obj->setLocation(off_x, 0, 0);
95 theScene->insert(
obj);
98 "Color texture, random size, with transp");
99 gl_txt->setLocation(off_x, off_y_label, 0);
100 theScene->insert(gl_txt);
107 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
108 obj->assignImage(imgBW_N);
109 obj->setLocation(off_x, 0, 0);
110 theScene->insert(
obj);
113 "B/W texture, random size, w/o transp");
114 gl_txt->setLocation(off_x, off_y_label, 0);
115 theScene->insert(gl_txt);
122 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
123 obj->assignImage(imgBW_N, transpMask_N);
124 obj->setLocation(off_x, 0, 0);
125 theScene->insert(
obj);
128 "B/W texture, random size, with transp");
129 gl_txt->setLocation(off_x, off_y_label, 0);
130 theScene->insert(gl_txt);
137 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
138 obj->assignImage(imgCol_2N);
139 obj->setLocation(off_x, 0, 0);
140 theScene->insert(
obj);
143 "Color texture, 2^N size, w/o transp");
144 gl_txt->setLocation(off_x, off_y_label, 0);
145 theScene->insert(gl_txt);
152 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
153 obj->assignImage(imgCol_2N, transpMask_2N);
154 obj->setLocation(off_x, 0, 0);
155 theScene->insert(
obj);
158 "Color texture, 2^N size, with transp");
159 gl_txt->setLocation(off_x, off_y_label, 0);
160 theScene->insert(gl_txt);
167 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
168 obj->assignImage(imgBW_2N);
169 obj->setLocation(off_x, 0, 0);
170 theScene->insert(
obj);
173 "B/W texture, 2^N size, w/o transp");
174 gl_txt->setLocation(off_x, off_y_label, 0);
175 theScene->insert(gl_txt);
182 mrpt::make_aligned_shared<opengl::CTexturedPlane>(-3, 3, -3, 3);
183 obj->assignImage(imgBW_2N, transpMask_2N);
184 obj->setLocation(off_x, 0, 0);
185 theScene->insert(
obj);
188 "B/W texture, 2^N size, with transp");
189 gl_txt->setLocation(off_x, off_y_label, 0);
190 theScene->insert(gl_txt);
194 win.setCameraZoom(150);
195 win.setCameraAzimuthDeg(90);
198 win.unlockAccess3DScene();
201 cout <<
"Close the window to end.\n";
204 win.addTextMessage(5, 5,
format(
"%.02fFPS",
win.getRenderingFPS()));
205 std::this_thread::sleep_for(2ms);
221 catch (std::exception& e)
223 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
228 printf(
"Untyped exception!!");