gba-x3dtest

diff src/game.c @ 17:0a7f402892b3

texture mapping
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 26 Jun 2014 06:57:51 +0300
parents c398d834d64a
children f907b2c50a8b
line diff
     1.1 --- a/src/game.c	Wed Jun 25 18:18:05 2014 +0300
     1.2 +++ b/src/game.c	Thu Jun 26 06:57:51 2014 +0300
     1.3 @@ -6,6 +6,7 @@
     1.4  #include "fixed.h"
     1.5  #include "palman.h"
     1.6  #include "ggen.h"
     1.7 +#include "data.h"
     1.8  
     1.9  extern int dbg_fill_dump;
    1.10  
    1.11 @@ -31,6 +32,7 @@
    1.12  static const short vcount = sizeof poly / sizeof *poly / 3;
    1.13  
    1.14  static struct mesh box;
    1.15 +static int tex;
    1.16  
    1.17  
    1.18  int game_init(void)
    1.19 @@ -40,6 +42,8 @@
    1.20  	palman_init();
    1.21  #endif
    1.22  
    1.23 +	tex = x3d_create_texture_rgb(test_width, test_height, test_pixels);
    1.24 +
    1.25  	x3d_projection(45.0, (WIDTH << 16) / HEIGHT, 65536 / 2, 65536 * 500);
    1.26  
    1.27  	init_mesh(&box);
    1.28 @@ -81,7 +85,9 @@
    1.29  	x3d_color(65536, 65536, 65536);
    1.30  #endif
    1.31  
    1.32 +	x3d_enable_texture(tex);
    1.33  	draw_mesh(&box);
    1.34 +	x3d_disable_texture();
    1.35  
    1.36  	/*
    1.37  	x3d_vertex_array(vcount, poly);