pangolin-task2

本文详细解析了Pangolin库中Task2的代码,涉及控件初始化、类型转换和控件操作。控件包括按钮、滑条、复选框等,可通过配置文件设定。通过重载构造函数,Pangolin支持按钮、复选框、滑条的创建,并能实现回调函数与快捷键绑定,方便交互。总结中指出,Pangolin控件命名需遵循特定规则。
摘要由CSDN通过智能技术生成

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值