cubemapper

diff src/main.cc @ 2:e308561f9889

correct cubemap export and visualization
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 28 Jul 2017 13:24:34 +0300
parents d7a29cb7ac8d
children 2bfafdced01a
line diff
     1.1 --- a/src/main.cc	Fri Jul 28 07:44:35 2017 +0300
     1.2 +++ b/src/main.cc	Fri Jul 28 13:24:34 2017 +0300
     1.3 @@ -12,11 +12,13 @@
     1.4  static void mouse(int bn, int st, int x, int y);
     1.5  static void motion(int x, int y);
     1.6  
     1.7 +static int win_width, win_height;
     1.8 +
     1.9  int main(int argc, char **argv)
    1.10  {
    1.11  	glutInitWindowSize(1024, 768);
    1.12  	glutInit(&argc, argv);
    1.13 -	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    1.14 +	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE);
    1.15  	glutCreateWindow("cubemapper");
    1.16  
    1.17  	glutDisplayFunc(display);
    1.18 @@ -54,6 +56,29 @@
    1.19  	glutReshapeWindow(x, y);
    1.20  }
    1.21  
    1.22 +void app_print_text(int x, int y, const char *str)
    1.23 +{
    1.24 +	glMatrixMode(GL_PROJECTION);
    1.25 +	glPushMatrix();
    1.26 +	glLoadIdentity();
    1.27 +	glOrtho(0, win_width, 0, win_height, -1, 1);
    1.28 +
    1.29 +	glMatrixMode(GL_MODELVIEW);
    1.30 +	glPushMatrix();
    1.31 +	glLoadIdentity();
    1.32 +
    1.33 +	glRasterPos2i(x, y);
    1.34 +
    1.35 +	while(*str) {
    1.36 +		glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, *str++);
    1.37 +	}
    1.38 +
    1.39 +	glMatrixMode(GL_PROJECTION);
    1.40 +	glPopMatrix();
    1.41 +	glMatrixMode(GL_MODELVIEW);
    1.42 +	glPopMatrix();
    1.43 +}
    1.44 +
    1.45  static void display()
    1.46  {
    1.47  	app_draw();
    1.48 @@ -61,6 +86,8 @@
    1.49  
    1.50  static void reshape(int x, int y)
    1.51  {
    1.52 +	win_width = x;
    1.53 +	win_height = y;
    1.54  	app_reshape(x, y);
    1.55  }
    1.56