Spaces:
Sleeping
Sleeping
File size: 1,409 Bytes
caf1218 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#include <pangolin/display/display.h>
#include <pangolin/display/view.h>
#include <pangolin/scene/axis.h>
#include <pangolin/scene/scenehandler.h>
int main( int /*argc*/, char** /*argv*/ )
{
pangolin::CreateWindowAndBind("Main",640,480);
glEnable(GL_DEPTH_TEST);
// Define Projection and initial ModelView matrix
pangolin::OpenGlRenderState s_cam(
pangolin::ProjectionMatrix(640,480,420,420,320,240,0.2,100),
pangolin::ModelViewLookAt(-2,2,-2, 0,0,0, pangolin::AxisY)
);
pangolin::Renderable tree;
for(size_t i=0; i < 10; ++i )
{
auto axis_i = std::make_shared<pangolin::Axis>();
axis_i->T_pc = pangolin::OpenGlMatrix::Translate(i*2.0, i*0.1, 0.0);
tree.Add(axis_i);
}
// Create Interactive View in window
pangolin::SceneHandler handler(tree, s_cam);
pangolin::View& d_cam = pangolin::CreateDisplay()
.SetBounds(0.0, 1.0, 0.0, 1.0, -640.0f/480.0f)
.SetHandler(&handler);
d_cam.SetDrawFunction([&](pangolin::View& view){
view.Activate(s_cam);
tree.Render();
});
while( !pangolin::ShouldQuit() )
{
// Clear screen and activate view to render into
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Swap frames and Process Events
pangolin::FinishFrame();
}
return 0;
}
|