istereo2

diff src/istereo.c @ 15:7bd4264bf74a

gui done?
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 30 Sep 2015 04:41:21 +0300
parents ea928c313344
children f4dd01c36b0c
line diff
     1.1 --- a/src/istereo.c	Tue Sep 29 01:11:54 2015 +0300
     1.2 +++ b/src/istereo.c	Wed Sep 30 04:41:21 2015 +0300
     1.3 @@ -34,6 +34,8 @@
     1.4  #include "drawtext.h"
     1.5  #include "timer.h"
     1.6  
     1.7 +#undef STEREO_GUI
     1.8 +
     1.9  static void render(float t);
    1.10  static void draw_tunnel(float t);
    1.11  static void tunnel_vertex(float u, float v, float du, float dv, int tang_loc, float t);
    1.12 @@ -100,12 +102,11 @@
    1.13  		return -1;
    1.14  	}
    1.15  
    1.16 -	if(!(font = dtx_open_font_glyphmap(find_resource("linux-libertine_s24.glyphmap", 0, 0)))) {
    1.17 +	if(!(font = dtx_open_font_glyphmap(find_resource("droidsans_s24.glyphmap", 0, 0)))) {
    1.18  		fprintf(stderr, "failed to load font\n");
    1.19  		return -1;
    1.20  	}
    1.21  	dtx_vertex_attribs(get_attrib_loc(prog_ui, "attr_vertex"), get_attrib_loc(prog_ui, "attr_texcoord"));
    1.22 -	dtx_use_font(font, 24);
    1.23  
    1.24  	glEnable(GL_DEPTH_TEST);
    1.25  	glEnable(GL_CULL_FACE);
    1.26 @@ -113,6 +114,9 @@
    1.27  	if(ui_init() == -1) {
    1.28  		return -1;
    1.29  	}
    1.30 +	if(show_opt) {
    1.31 +		ui_show();
    1.32 +	}
    1.33  
    1.34  	cam_fov(42.5);
    1.35  	cam_clip(0.5, 250.0);
    1.36 @@ -199,19 +203,12 @@
    1.37  		render(tsec);
    1.38  	}
    1.39  
    1.40 -	/* TEST */
    1.41 -	/*bind_program(prog_ui);
    1.42 -
    1.43 -	gl_matrix_mode(GL_PROJECTION);
    1.44 -	gl_load_identity();
    1.45 -	gl_ortho(0, view_xsz, 0, view_ysz, -1, 1);
    1.46 -	gl_matrix_mode(GL_MODELVIEW);
    1.47 -	gl_load_identity();
    1.48 -	gl_apply_xform(prog_ui);
    1.49 -
    1.50 -	glDisable(GL_DEPTH_TEST);
    1.51 -	dtx_printf("hello world\n");
    1.52 -	glEnable(GL_DEPTH_TEST);*/
    1.53 +#ifndef STEREO_GUI
    1.54 +	if(ui_visible()) {
    1.55 +		glViewport(0, 0, view_xsz, view_ysz);
    1.56 +		ui_draw();
    1.57 +	}
    1.58 +#endif
    1.59  
    1.60  	assert(glGetError() == GL_NO_ERROR);
    1.61  }
    1.62 @@ -233,9 +230,12 @@
    1.63  		glDepthMask(1);
    1.64  	}
    1.65  
    1.66 -	if(show_opt) {
    1.67 +#ifdef STEREO_GUI
    1.68 +	if(ui_visible()) {
    1.69 +		ui_reshape(stereo ? view_xsz / 2.0 : view_xsz, view_ysz);
    1.70  		ui_draw();
    1.71  	}
    1.72 +#endif
    1.73  }
    1.74  
    1.75  static void draw_tunnel(float t)
    1.76 @@ -418,6 +418,11 @@
    1.77  {
    1.78  	if(show_opt) {
    1.79  		ui_button(bn, press, x, y);
    1.80 +	} else {
    1.81 +		if(press) {
    1.82 +			show_opt = 1;
    1.83 +			ui_show();
    1.84 +		}
    1.85  	}
    1.86  }
    1.87