invisible

diff src/main.cc @ 13:65fd6d7c42b1

foo: show/hide rgb video and depth frames
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Tue, 05 Nov 2013 00:24:25 +0200
parents 226073258785
children b6de02e21d82
line diff
     1.1 --- a/src/main.cc	Mon Nov 04 23:39:22 2013 +0200
     1.2 +++ b/src/main.cc	Tue Nov 05 00:24:25 2013 +0200
     1.3 @@ -1,7 +1,6 @@
     1.4  #include <GL/glew.h>
     1.5  #include <GL/glut.h>
     1.6  
     1.7 -#include <assert.h>
     1.8  #include <stdio.h>
     1.9  
    1.10  #include "kinect.h"
    1.11 @@ -13,6 +12,8 @@
    1.12  KinectParams kin_params;
    1.13  Frame *frame;
    1.14  
    1.15 +static bool show;
    1.16 +
    1.17  static void cleanup();
    1.18  
    1.19  static void display();
    1.20 @@ -67,19 +68,18 @@
    1.21  		fprintf(stderr, "Failed to process events.\n");
    1.22  		exit(0);
    1.23  	}
    1.24 -	assert(glGetError() == GL_NO_ERROR);
    1.25  	frame->process();
    1.26  
    1.27  	glEnable(GL_TEXTURE_2D);
    1.28 -	glBindTexture(GL_TEXTURE_2D, frame->video_tex);
    1.29 -	assert(glGetError() == GL_NO_ERROR);
    1.30 -	draw_tess_quad(-1, -1, 0.6, 0.6, 1, 1);
    1.31 -//	glBindTexture(GL_TEXTURE_2D, frame->depth_tex);
    1.32 -//	draw_tes..
    1.33 +	if(show) {
    1.34 +		glBindTexture(GL_TEXTURE_2D, frame->video_tex);
    1.35 +		draw_tess_quad(-1, -1, 1, 2, 1, 1);
    1.36 +		glBindTexture(GL_TEXTURE_2D, frame->depth_tex);
    1.37 +		draw_tess_quad(0, -1, 1, 2, 1, 1);
    1.38 +	}
    1.39  	glDisable(GL_TEXTURE_2D);
    1.40  
    1.41  	glutSwapBuffers();
    1.42 -	assert(glGetError() == GL_NO_ERROR);
    1.43  }
    1.44  
    1.45  static void reshape(int w, int h)
    1.46 @@ -93,6 +93,12 @@
    1.47  static void keyb(unsigned char key, int x, int y)
    1.48  {
    1.49  	switch(key) {
    1.50 +	case 's':
    1.51 +		if(show)
    1.52 +			show = false;
    1.53 +		else
    1.54 +			show = true;
    1.55 +		break;
    1.56  	case 27:
    1.57  		exit(0);
    1.58  	default: