deepstone

diff src/mglgen.c @ 3:0e781cc43178

adding textures
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 21 Nov 2011 10:16:09 +0200
parents f04884489bad
children bce78aaafc68
line diff
     1.1 --- a/src/mglgen.c	Mon Nov 21 10:15:37 2011 +0200
     1.2 +++ b/src/mglgen.c	Mon Nov 21 10:16:09 2011 +0200
     1.3 @@ -27,40 +27,40 @@
     1.4  	mgl_begin(MGL_QUADS);
     1.5  	/* front */
     1.6  	mgl_normal(0, 0, 1);
     1.7 -	mgl_vertex3f(-hsz, hsz, hsz);
     1.8 -	mgl_vertex3f(-hsz, -hsz, hsz);
     1.9 -	mgl_vertex3f(hsz, -hsz, hsz);
    1.10 -	mgl_vertex3f(hsz, hsz, hsz);
    1.11 +	mgl_texcoord2f(0, 1); mgl_vertex3f(-hsz, hsz, hsz);
    1.12 +	mgl_texcoord2f(0, 0); mgl_vertex3f(-hsz, -hsz, hsz);
    1.13 +	mgl_texcoord2f(1, 0); mgl_vertex3f(hsz, -hsz, hsz);
    1.14 +	mgl_texcoord2f(1, 1); mgl_vertex3f(hsz, hsz, hsz);
    1.15  	/* back */
    1.16  	mgl_normal(0, 0, -1);
    1.17 -	mgl_vertex3f(hsz, hsz, -hsz);
    1.18 -	mgl_vertex3f(hsz, -hsz, -hsz);
    1.19 -	mgl_vertex3f(-hsz, -hsz, -hsz);
    1.20 -	mgl_vertex3f(-hsz, hsz, -hsz);
    1.21 +	mgl_texcoord2f(0, 1); mgl_vertex3f(hsz, hsz, -hsz);
    1.22 +	mgl_texcoord2f(0, 0); mgl_vertex3f(hsz, -hsz, -hsz);
    1.23 +	mgl_texcoord2f(1, 0); mgl_vertex3f(-hsz, -hsz, -hsz);
    1.24 +	mgl_texcoord2f(1, 1); mgl_vertex3f(-hsz, hsz, -hsz);
    1.25  	/* right */
    1.26  	mgl_normal(1, 0, 0);
    1.27 -	mgl_vertex3f(hsz, hsz, hsz);
    1.28 -	mgl_vertex3f(hsz, -hsz, hsz);
    1.29 -	mgl_vertex3f(hsz, -hsz, -hsz);
    1.30 -	mgl_vertex3f(hsz, hsz, -hsz);
    1.31 +	mgl_texcoord2f(0, 1); mgl_vertex3f(hsz, hsz, hsz);
    1.32 +	mgl_texcoord2f(0, 0); mgl_vertex3f(hsz, -hsz, hsz);
    1.33 +	mgl_texcoord2f(1, 0); mgl_vertex3f(hsz, -hsz, -hsz);
    1.34 +	mgl_texcoord2f(1, 1); mgl_vertex3f(hsz, hsz, -hsz);
    1.35  	/* left */
    1.36  	mgl_normal(-1, 0, 0);
    1.37 -	mgl_vertex3f(-hsz, hsz, -hsz);
    1.38 -	mgl_vertex3f(-hsz, -hsz, -hsz);
    1.39 -	mgl_vertex3f(-hsz, -hsz, hsz);
    1.40 -	mgl_vertex3f(-hsz, hsz, hsz);
    1.41 +	mgl_texcoord2f(0, 1); mgl_vertex3f(-hsz, hsz, -hsz);
    1.42 +	mgl_texcoord2f(0, 0); mgl_vertex3f(-hsz, -hsz, -hsz);
    1.43 +	mgl_texcoord2f(1, 0); mgl_vertex3f(-hsz, -hsz, hsz);
    1.44 +	mgl_texcoord2f(1, 1); mgl_vertex3f(-hsz, hsz, hsz);
    1.45  	/* top */
    1.46  	mgl_normal(0, 1, 0);
    1.47 -	mgl_vertex3f(-hsz, hsz, -hsz);
    1.48 -	mgl_vertex3f(-hsz, hsz, hsz);
    1.49 -	mgl_vertex3f(hsz, hsz, hsz);
    1.50 -	mgl_vertex3f(hsz, hsz, -hsz);
    1.51 +	mgl_texcoord2f(0, 1); mgl_vertex3f(-hsz, hsz, -hsz);
    1.52 +	mgl_texcoord2f(0, 0); mgl_vertex3f(-hsz, hsz, hsz);
    1.53 +	mgl_texcoord2f(1, 0); mgl_vertex3f(hsz, hsz, hsz);
    1.54 +	mgl_texcoord2f(1, 1); mgl_vertex3f(hsz, hsz, -hsz);
    1.55  	/* bottom */
    1.56  	mgl_normal(0, -1, 0);
    1.57 -	mgl_vertex3f(hsz, -hsz, -hsz);
    1.58 -	mgl_vertex3f(hsz, -hsz, hsz);
    1.59 -	mgl_vertex3f(-hsz, -hsz, hsz);
    1.60 -	mgl_vertex3f(-hsz, -hsz, -hsz);
    1.61 +	mgl_texcoord2f(0, 1); mgl_vertex3f(hsz, -hsz, -hsz);
    1.62 +	mgl_texcoord2f(0, 0); mgl_vertex3f(hsz, -hsz, hsz);
    1.63 +	mgl_texcoord2f(1, 0); mgl_vertex3f(-hsz, -hsz, hsz);
    1.64 +	mgl_texcoord2f(1, 1); mgl_vertex3f(-hsz, -hsz, -hsz);
    1.65  	mgl_end();
    1.66  }
    1.67