dbf-udg

diff src/udg.cc @ 4:5fb21401b7c8

lala
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 07 Feb 2013 18:52:28 +0200
parents 403ec1be3a1a
children e09cbb2e9d4f
line diff
     1.1 --- a/src/udg.cc	Fri Jan 11 22:52:56 2013 +0200
     1.2 +++ b/src/udg.cc	Thu Feb 07 18:52:28 2013 +0200
     1.3 @@ -106,7 +106,6 @@
     1.4  
     1.5  void draw_backdrop()
     1.6  {
     1.7 -	/*
     1.8  	glPushAttrib(GL_ENABLE_BIT);
     1.9  	glDisable(GL_DEPTH_TEST);
    1.10  	glDisable(GL_LIGHTING);
    1.11 @@ -132,23 +131,27 @@
    1.12  	glPopMatrix();
    1.13  
    1.14  	glPopAttrib();
    1.15 -	*/
    1.16 -	draw_scroller(glutGet(GLUT_ELAPSED_TIME) / 1000.0);
    1.17 +	/*draw_scroller(glutGet(GLUT_ELAPSED_TIME) / 1000.0); */
    1.18  }
    1.19  
    1.20  void disp()
    1.21  {
    1.22  	float ldir[] = {-1, 1, 2, 0};
    1.23  
    1.24 +	int xres = xsz / DITHER_SZ;
    1.25 +	int yres = ysz / DITHER_SZ;
    1.26 +	/*int xres = xsz;
    1.27 +	int yres = ysz;*/
    1.28 +
    1.29  	if(!rtarg) {
    1.30 -		printf("(re)creating render target (%dx%d)\n", xsz / DITHER_SZ, ysz / DITHER_SZ);
    1.31 -		if(!(rtarg = create_rtarg(xsz / DITHER_SZ, ysz / DITHER_SZ))) {
    1.32 +		printf("(re)creating render target (%dx%d)\n", xres, yres);
    1.33 +		if(!(rtarg = create_rtarg(xres, yres))) {
    1.34  			exit(0);
    1.35  		}
    1.36  	}
    1.37  
    1.38  	glBindFramebufferEXT(GL_FRAMEBUFFER, rtarg->fbo);
    1.39 -	glViewport(0, 0, xsz / DITHER_SZ, ysz / DITHER_SZ);
    1.40 +	glViewport(0, 0, xres, yres);
    1.41  
    1.42  	glClearColor(1, 1, 1, 1);
    1.43  	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    1.44 @@ -255,6 +258,22 @@
    1.45  	switch(key) {
    1.46  	case 27:
    1.47  		exit(0);
    1.48 +
    1.49 +	case 'f':
    1.50 +		{
    1.51 +			static bool fullscreen;
    1.52 +			static int orig_x, orig_y;
    1.53 +
    1.54 +			fullscreen = !fullscreen;
    1.55 +			if(fullscreen) {
    1.56 +				orig_x = xsz;
    1.57 +				orig_y = ysz;
    1.58 +				glutFullScreen();
    1.59 +			} else {
    1.60 +				glutReshapeWindow(orig_x, orig_y);
    1.61 +			}
    1.62 +		}
    1.63 +		break;
    1.64  	}
    1.65  }
    1.66