invisible

diff src/frame.cc @ 12:226073258785

quick backup: display video, draw tesselated quads
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Mon, 04 Nov 2013 23:39:22 +0200
parents d2158a527488
children 65fd6d7c42b1
line diff
     1.1 --- a/src/frame.cc	Mon Nov 04 21:53:21 2013 +0200
     1.2 +++ b/src/frame.cc	Mon Nov 04 23:39:22 2013 +0200
     1.3 @@ -1,4 +1,5 @@
     1.4  #include <GL/gl.h>
     1.5 +#include <assert.h>
     1.6  #include <cxcore.h>
     1.7  #include <opencv2/imgproc/imgproc.hpp>
     1.8  #include <opencv2/photo/photo.hpp>
     1.9 @@ -37,23 +38,28 @@
    1.10  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    1.11  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    1.12  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    1.13 -	glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, video_buf.size().width, video_buf.size().height,
    1.14 -			0, GL_BGRA, GL_UNSIGNED_BYTE, &video_buf);
    1.15 +	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, KINECT_VIDEO_WIDTH, KINECT_VIDEO_HEIGHT,
    1.16 +			0, GL_BGR, GL_UNSIGNED_BYTE, 0);
    1.17  
    1.18  	glBindTexture(GL_TEXTURE_2D, depth_tex);
    1.19  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    1.20  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    1.21  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    1.22  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    1.23 -	glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, depth_buf.size().width, depth_buf.size().height,
    1.24 -			0, GL_BGRA, GL_UNSIGNED_BYTE, &depth_buf);
    1.25 -
    1.26 +	glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, KINECT_DEPTH_WIDTH, KINECT_DEPTH_HEIGHT,
    1.27 +			0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0);
    1.28  }
    1.29  
    1.30  void Frame::process()
    1.31  {
    1.32 -	if(has_video && has_depth)
    1.33 -		printf("Depth and Rgb\n");
    1.34 +	if(has_video) {
    1.35 +		glBindTexture(GL_TEXTURE_2D, video_tex);
    1.36 +		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, KINECT_VIDEO_WIDTH, KINECT_VIDEO_HEIGHT, GL_BGR, GL_UNSIGNED_BYTE, video_buf.data);
    1.37 +		//glBindTexture(GL_TEXTURE_2D, depth_tex);
    1.38 +		//subi;
    1.39 +	}
    1.40 +	if(has_video && has_depth) {//pot
    1.41 +	}
    1.42  }
    1.43  
    1.44  void video_cb(freenect_device *kin_dev, void *video, uint32_t time)
    1.45 @@ -107,8 +113,6 @@
    1.46  	cv::threshold(mask, mask, 254, 255, 3);
    1.47  	cv::inpaint(frame->depth_buf, mask, frame->depth_buf, 1, cv::INPAINT_NS);
    1.48  */
    1.49 -	cv::imshow("foo", frame->depth_buf);
    1.50 -	cv::waitKey(30);
    1.51  	has_depth = true;
    1.52  }
    1.53