dbf-udg

diff src/udg.cc @ 3:403ec1be3a1a

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 11 Jan 2013 22:52:56 +0200
parents c45c7a1f7d9d
children 5fb21401b7c8
line diff
     1.1 --- a/src/udg.cc	Wed Jan 09 02:37:05 2013 +0200
     1.2 +++ b/src/udg.cc	Fri Jan 11 22:52:56 2013 +0200
     1.3 @@ -2,16 +2,10 @@
     1.4  #include <stdlib.h>
     1.5  #include <math.h>
     1.6  #include <assert.h>
     1.7 -#include <GL/glew.h>
     1.8 -
     1.9 -#ifndef __APPLE__
    1.10 -#include <GL/glut.h>
    1.11 -#else
    1.12 -#include <GLUT/glut.h>
    1.13 -#endif
    1.14 -
    1.15 +#include "opengl.h"
    1.16  #include "sdr.h"
    1.17  #include "dither_matrix.h"
    1.18 +#include "scroller.h"
    1.19  
    1.20  #define DITHER_SZ		8
    1.21  #define DITHER_LEVELS	16
    1.22 @@ -19,7 +13,7 @@
    1.23  #if DITHER_SZ == 4
    1.24  #define dither_matrix	dither_matrix4
    1.25  #elif DITHER_SZ == 8
    1.26 -#define dither_matrix	dither_matrix8
    1.27 +#define dither_matrix	halftone_matrix8
    1.28  #else
    1.29  #error "invalid dither size"
    1.30  #endif
    1.31 @@ -98,6 +92,10 @@
    1.32  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    1.33  	glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, DITHER_SZ, DITHER_SZ * DITHER_LEVELS, 0, GL_LUMINANCE, GL_FLOAT, img);
    1.34  
    1.35 +	if(!init_scroller()) {
    1.36 +		return false;
    1.37 +	}
    1.38 +
    1.39  	glEnable(GL_CULL_FACE);
    1.40  	glEnable(GL_DEPTH_TEST);
    1.41  	glEnable(GL_LIGHTING);
    1.42 @@ -108,6 +106,7 @@
    1.43  
    1.44  void draw_backdrop()
    1.45  {
    1.46 +	/*
    1.47  	glPushAttrib(GL_ENABLE_BIT);
    1.48  	glDisable(GL_DEPTH_TEST);
    1.49  	glDisable(GL_LIGHTING);
    1.50 @@ -133,6 +132,8 @@
    1.51  	glPopMatrix();
    1.52  
    1.53  	glPopAttrib();
    1.54 +	*/
    1.55 +	draw_scroller(glutGet(GLUT_ELAPSED_TIME) / 1000.0);
    1.56  }
    1.57  
    1.58  void disp()
    1.59 @@ -154,8 +155,6 @@
    1.60  
    1.61  	draw_backdrop();
    1.62  
    1.63 -	glEnable(GL_DEPTH_TEST);
    1.64 -
    1.65  	glMatrixMode(GL_MODELVIEW);
    1.66  	glLoadIdentity();
    1.67  
    1.68 @@ -176,7 +175,6 @@
    1.69  	glFrontFace(GL_CCW);
    1.70  
    1.71  
    1.72 -
    1.73  	glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
    1.74  	glViewport(0, 0, xsz, ysz);
    1.75  
    1.76 @@ -200,8 +198,10 @@
    1.77  
    1.78  	glActiveTextureARB(GL_TEXTURE0);
    1.79  	glBindTexture(GL_TEXTURE_2D, rtarg->color_tex);
    1.80 +	glEnable(GL_TEXTURE_2D);
    1.81  	glActiveTextureARB(GL_TEXTURE1);
    1.82  	glBindTexture(GL_TEXTURE_2D, dither_tex);
    1.83 +	glEnable(GL_TEXTURE_2D);
    1.84  
    1.85  	glBegin(GL_QUADS);
    1.86  	glColor3f(0, 1, 0);