invisible
changeset 25:96b022f1210e
'w' to switch to wireframe
author | Eleni Maria Stea <eleni@mutantstargoat.com> |
---|---|
date | Sun, 17 Nov 2013 12:46:45 +0200 |
parents | 8b81571dd4dd |
children | 61d593076c56 |
files | src/main.cc |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line diff
1.1 --- a/src/main.cc Sun Nov 17 00:15:04 2013 +0200 1.2 +++ b/src/main.cc Sun Nov 17 12:46:45 2013 +0200 1.3 @@ -21,14 +21,15 @@ 1.4 static const char *filename = "data/textures/wallpaper.jpg"; 1.5 static const char *vsdr_path = "data/shaders/invisible.v.glsl"; 1.6 static const char *fsdr_path = "data/shaders/invisible.f.glsl"; 1.7 +static unsigned char tex; 1.8 static unsigned int sprog; 1.9 static unsigned int drawing; 1.10 static unsigned int debugging; 1.11 -static unsigned char tex; 1.12 static int tex_height; 1.13 static int tex_width; 1.14 static float aspect; 1.15 static bool show; 1.16 +static bool wireframe; 1.17 1.18 static void cleanup(); 1.19 static bool init(); 1.20 @@ -89,6 +90,10 @@ 1.21 glUseProgram(sprog); 1.22 1.23 // draw video frame 1.24 + 1.25 + if(wireframe) 1.26 + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 1.27 + 1.28 glMatrixMode(GL_MODELVIEW); 1.29 glPushMatrix(); 1.30 glTranslatef(0, 0, -QUAD_DIST); 1.31 @@ -112,6 +117,9 @@ 1.32 1.33 glUseProgram(0); 1.34 1.35 + if(wireframe) 1.36 + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 1.37 + 1.38 if(show) 1.39 glCallList(debugging); 1.40 glFlush(); 1.41 @@ -133,10 +141,10 @@ 1.42 { 1.43 switch(key) { 1.44 case 's': 1.45 - if(show) 1.46 - show = false; 1.47 - else 1.48 - show = true; 1.49 + show = show ? false : true; 1.50 + break; 1.51 + case 'w': 1.52 + wireframe = wireframe ? false : true; 1.53 break; 1.54 case 27: 1.55 exit(0);