dbf-udg

diff src/udg.cc @ 7:603656331514

phong blobs
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 18 Feb 2013 05:44:17 +0200
parents 57ea4988a9f2
children f0a47f46ee45
line diff
     1.1 --- a/src/udg.cc	Mon Feb 18 04:41:26 2013 +0200
     1.2 +++ b/src/udg.cc	Mon Feb 18 05:44:17 2013 +0200
     1.3 @@ -39,7 +39,7 @@
     1.4  float cam_theta, cam_phi = 25, cam_dist = 9;
     1.5  unsigned int dither_tex;
     1.6  struct render_target *rtarg;
     1.7 -unsigned int prog;
     1.8 +unsigned int post_prog, phong_prog;
     1.9  
    1.10  int opt_highres, opt_regular_render;
    1.11  
    1.12 @@ -102,7 +102,11 @@
    1.13  		fclose(fp);
    1.14  	}
    1.15  
    1.16 -	if(!(prog = create_program_load("sdr/dither.v.glsl", "sdr/dither.p.glsl"))) {
    1.17 +	if(!(phong_prog = create_program_load("sdr/phong.v.glsl", "sdr/phong.p.glsl"))) {
    1.18 +		return false;
    1.19 +	}
    1.20 +
    1.21 +	if(!(post_prog = create_program_load("sdr/dither.v.glsl", "sdr/dither.p.glsl"))) {
    1.22  		return false;
    1.23  	}
    1.24  
    1.25 @@ -206,7 +210,9 @@
    1.26  	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
    1.27  	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 80.0);
    1.28  
    1.29 +	bind_program(phong_prog);
    1.30  	mball_render();
    1.31 +	bind_program(0);
    1.32  
    1.33  
    1.34  	if(!opt_regular_render) {
    1.35 @@ -225,11 +231,11 @@
    1.36  		glPushAttrib(GL_ENABLE_BIT);
    1.37  		glDisable(GL_DEPTH_TEST);
    1.38  
    1.39 -		bind_program(prog);
    1.40 -		set_uniform_int(prog, "framebuf", 0);
    1.41 -		set_uniform_int(prog, "dither_tex", 1);
    1.42 -		set_uniform_int(prog, "dither_levels", DITHER_LEVELS);
    1.43 -		set_uniform_int(prog, "dither_size", DITHER_SZ);
    1.44 +		bind_program(post_prog);
    1.45 +		set_uniform_int(post_prog, "framebuf", 0);
    1.46 +		set_uniform_int(post_prog, "dither_tex", 1);
    1.47 +		set_uniform_int(post_prog, "dither_levels", DITHER_LEVELS);
    1.48 +		set_uniform_int(post_prog, "dither_size", DITHER_SZ);
    1.49  
    1.50  		glActiveTextureARB(GL_TEXTURE0);
    1.51  		glBindTexture(GL_TEXTURE_2D, rtarg->color_tex);