intravenous

diff src/cockpit.cc @ 4:c6a6a64df6de

normalmap
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Apr 2012 05:20:03 +0300
parents 94d4c60af435
children
line diff
     1.1 --- a/src/cockpit.cc	Sun Apr 22 03:35:18 2012 +0300
     1.2 +++ b/src/cockpit.cc	Sun Apr 22 05:20:03 2012 +0300
     1.3 @@ -2,6 +2,9 @@
     1.4  #include "cockpit.h"
     1.5  #include "tex.h"
     1.6  
     1.7 +#define TEX_ASPECT	(16.0 / 9.0)
     1.8 +extern int win_xsz, win_ysz;
     1.9 +
    1.10  static unsigned int tex;
    1.11  
    1.12  bool cockpit_init()
    1.13 @@ -19,6 +22,9 @@
    1.14  
    1.15  void cockpit_draw()
    1.16  {
    1.17 +	float view_aspect = (float)win_xsz / (float)win_ysz;
    1.18 +	float aspect = TEX_ASPECT / view_aspect;
    1.19 +
    1.20  	glPushAttrib(GL_ENABLE_BIT);
    1.21  	glDisable(GL_LIGHTING);
    1.22  
    1.23 @@ -36,10 +42,10 @@
    1.24  
    1.25  	glBegin(GL_QUADS);
    1.26  	glColor3f(1, 1, 1);
    1.27 -	glTexCoord2f(0, 1); glVertex2f(-1, -1);
    1.28 -	glTexCoord2f(1, 1); glVertex2f(1, -1);
    1.29 -	glTexCoord2f(1, 0); glVertex2f(1, 1);
    1.30 -	glTexCoord2f(0, 0); glVertex2f(-1, 1);
    1.31 +	glTexCoord2f(0, 1); glVertex2f(-aspect, -1);
    1.32 +	glTexCoord2f(1, 1); glVertex2f(aspect, -1);
    1.33 +	glTexCoord2f(1, 0); glVertex2f(aspect, 1);
    1.34 +	glTexCoord2f(0, 0); glVertex2f(-aspect, 1);
    1.35  	glEnd();
    1.36  
    1.37  	glPopMatrix();