invisible

changeset 14:b6de02e21d82

quick backup: todo: remove orthographic from background quad, calculate translation (fov), add subdivision
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Wed, 06 Nov 2013 01:08:50 +0200
parents 65fd6d7c42b1
children 351dad433990
files src/main.cc
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/src/main.cc	Tue Nov 05 00:24:25 2013 +0200
     1.2 +++ b/src/main.cc	Wed Nov 06 01:08:50 2013 +0200
     1.3 @@ -6,12 +6,15 @@
     1.4  #include "kinect.h"
     1.5  #include "frame.h"
     1.6  #include "tesquad.h"
     1.7 +#include "texture.h"
     1.8  
     1.9  freenect_context *kin_ctx;
    1.10  freenect_device *kin_dev;
    1.11  KinectParams kin_params;
    1.12  Frame *frame;
    1.13  
    1.14 +static const char *filename = "data/textures/wallpaper.jpg";
    1.15 +static unsigned char tex;
    1.16  static bool show;
    1.17  
    1.18  static void cleanup();
    1.19 @@ -46,24 +49,28 @@
    1.20  	glutKeyboardFunc(keyb);
    1.21  	glutIdleFunc(idle);
    1.22  
    1.23 +	atexit(cleanup);
    1.24 +
    1.25  	glClearColor(1, 1, 1, 1);
    1.26 +
    1.27      frame = new Frame;
    1.28 +	if(!(tex = load_texture(filename))) {
    1.29 +		fprintf(stderr, "Failed to load texture: %s\n", filename);
    1.30 +		exit(1);
    1.31 +	}
    1.32  
    1.33 -	atexit(cleanup);
    1.34  	glutMainLoop();
    1.35  }
    1.36  
    1.37  static void display()
    1.38  {
    1.39 -	glClear(GL_COLOR_BUFFER_BIT);
    1.40 +	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    1.41  
    1.42  	glMatrixMode(GL_MODELVIEW);
    1.43  	glLoadIdentity();
    1.44 -
    1.45 -	glClearColor(1, 0, 0, 1);
    1.46 +	glClearColor(1, 1, 1, 1);
    1.47  
    1.48  	has_depth = false; has_video = false;
    1.49 -
    1.50  	if(freenect_process_events(kin_ctx) != 0) {
    1.51  		fprintf(stderr, "Failed to process events.\n");
    1.52  		exit(0);
    1.53 @@ -71,11 +78,14 @@
    1.54  	frame->process();
    1.55  
    1.56  	glEnable(GL_TEXTURE_2D);
    1.57 +	glBindTexture(GL_TEXTURE_2D, tex);
    1.58 +	draw_tess_quad(-1, -1, 2, 2, 1, 1, true);
    1.59 +
    1.60  	if(show) {
    1.61  		glBindTexture(GL_TEXTURE_2D, frame->video_tex);
    1.62 -		draw_tess_quad(-1, -1, 1, 2, 1, 1);
    1.63 +		draw_tess_quad(-1, -1, 1, 1, 1, 1, true);
    1.64  		glBindTexture(GL_TEXTURE_2D, frame->depth_tex);
    1.65 -		draw_tess_quad(0, -1, 1, 2, 1, 1);
    1.66 +		draw_tess_quad(-1, 0, 1, 1, 1, 1, true);
    1.67  	}
    1.68  	glDisable(GL_TEXTURE_2D);
    1.69