Task2
Pangolin 提供的例子程序 SimpleDisplay
#include <iostream>
#include <pangolin/pangolin.h>
struct CustomType
{
CustomType()
: x(0), y(0.0f) {}
CustomType(int x, float y, std::string z)
: x(x), y(y), z(z) {}
int x;
float y;
std::string z;
};
std::ostream& operator<< (std::ostream& os, const CustomType& o){
os << o.x << " " << o.y << " " << o.z;
return os;
}
std::istream& operator>> (std::istream& is, CustomType& o){
is >> o.x;
is >> o.y;
is >> o.z;
return is;
}
void SampleMethod()
{
std::cout << "You typed ctrl-r or pushed reset" << std::endl;
}
int main(/*int argc, char* argv[]*/)
{
// Load configuration data
pangolin::ParseVarsFile("app.cfg");
// Create OpenGL window in single line
pangolin::CreateWindowAndBind("Main",640,480);
// 3D Mouse handler requires depth testing to be enabled
glEnable(GL_DEPTH_TEST);
// Define Camera Render Object (for view / scene browsing)
pangolin::OpenGlRenderState s_cam(
pangolin::ProjectionMatrix(640,480,420,420,320,240,0.1,1000),
pangolin::ModelViewLookAt(-0,0.5,-3, 0,0,0, pangolin::AxisY)
);
const int UI_WIDTH = 180;
// Add named OpenGL viewport to window and provide 3D Handler
pangolin::View& d_cam = pangolin::CreateDisplay()
.SetBounds(0.0, 1.0, pangolin::Attach::Pix(UI_WIDTH), 1.0, -640.0f/480.0f)
.SetHandler