3dphotoshoot

diff src/game.cc @ 22:d7fe157c402d

fonts
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 13 Jun 2015 05:32:07 +0300
parents 4ca4e3c5a754
children 2712c5da2e00
line diff
     1.1 --- a/src/game.cc	Thu Jun 11 04:56:33 2015 +0300
     1.2 +++ b/src/game.cc	Sat Jun 13 05:32:07 2015 +0300
     1.3 @@ -8,10 +8,12 @@
     1.4  #include "sanegl.h"
     1.5  #include "texture.h"
     1.6  #include "shader.h"
     1.7 +#include "text.h"
     1.8  
     1.9  static void draw_quad(float hsz, float vsz);
    1.10  
    1.11 -static int win_width, win_height;
    1.12 +int win_width, win_height;
    1.13 +
    1.14  static float win_aspect;
    1.15  static int video_width, video_height;
    1.16  static float video_aspect;
    1.17 @@ -21,10 +23,8 @@
    1.18  
    1.19  extern "C" int game_init(void)
    1.20  {
    1.21 -	unsigned int vsdr, psdr_cam, psdr_tex;
    1.22 -
    1.23  	//glEnable(GL_DEPTH_TEST);
    1.24 -	glEnable(GL_CULL_FACE);
    1.25 +	//glEnable(GL_CULL_FACE);
    1.26  
    1.27  	glClearColor(0.4, 0.4, 0.4, 1);
    1.28  
    1.29 @@ -102,10 +102,19 @@
    1.30  
    1.31  	glEnable(GL_BLEND);
    1.32  	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    1.33 +	draw_quad(0.5, 0.5);
    1.34 +	glDisable(GL_BLEND);
    1.35  
    1.36 -	draw_quad(0.5, 0.5);
    1.37 +	gl_matrix_mode(GL_TEXTURE);
    1.38 +	gl_load_identity();
    1.39  
    1.40 -	glDisable(GL_BLEND);
    1.41 +
    1.42 +	// draw some text
    1.43 +	text_color(1, 1, 1, 1);
    1.44 +	for(int i=0; i<25; i++) {
    1.45 +		text_position(0, i);
    1.46 +		text_printf("%d%s line of text", i, i == 1 ? "st" : (i == 2 ? "nd" : (i == 3 ? "rd" : "th")));
    1.47 +	}
    1.48  }
    1.49  
    1.50  static void draw_quad(float hsz, float vsz)