camke(6)配置pangolin

 

安装教程

https://blog.csdn.net/qq_32507255/article/details/115445932

 

实用教程

 

camke(6)配置pangolin

 

 

main.cpp

#include <pangolin/pangolin.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;
    tree.Add( std::make_shared<pangolin::Axis>() );

    // 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;
}

  

CMakeLists.txt

# Find Pangolin (https://github.com/stevenlovegrove/Pangolin)
find_package(Pangolin 0.4 REQUIRED)
include_directories(${Pangolin_INCLUDE_DIRS})

add_executable(SimpleScene main.cpp)
target_link_libraries(SimpleScene ${Pangolin_LIBRARIES})

  

 

编译

cd build

camke ..

make

./SimpleScene

 

camke(6)配置pangolin

 

 camke(6)配置pangolin

 

camke(6)配置pangolin

 

上一篇:InCAM高端印刷PCB电路板设计计算机辅助制造CAM软件


下一篇:ROS调用笔记本摄像头和外界摄像头问题汇总(本人亲身经历)非常好用