楼主借鉴了某位大大的《基于Kinect-OpenNI-OpenCV-OpenGL的环境三维重构》的帖子和邹大大的博客《OpenCV学习笔记(15)使用OpenGL显示双目视觉三维重构效果》中的三维点云显示方法,粗略搞了搞点云显示
// 3d_plot.cpp : 定义控制台应用程序的入口点。
//绘制三维点云数据,带有图像纹理信息
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <opencv2/opencv.hpp>
#include <math.h>
#include <GL/glut.h>
#include <iostream>
using namespace cv;
using namespace std;
const int width=468, height=495; //设定图像的大小和尺寸作为全局变量常数,这里手动设置
float xyzdata[height][width][3]; //数据矩阵
float texture[height][width][3]; //纹理矩阵
int glWinWidth = width, glWinHeight = height;
float scalar=60; //三维显示时缩放图像大小
bool mouseisdown=false;
bool loopr=false;
int mx,my; // 鼠标按键时在 OpenGL 窗口的坐标
int ry=20; // 摄像机相对注视点的观察角度
int rx=20;
/************************************************************************/
/* OpenGL