4 static void update_fbtex();
6 static unsigned int fb_tex;
7 static int fb_tex_width, fb_tex_height;
9 void slow_post(unsigned int sdr)
13 glBindTexture(GL_TEXTURE_2D, fb_tex);
14 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, win_width, win_height);
16 glPushAttrib(GL_ENABLE_BIT);
17 glDisable(GL_DEPTH_TEST);
18 glDisable(GL_LIGHTING);
22 float umax = (float)win_width / (float)fb_tex_width;
23 float vmax = (float)win_height / (float)fb_tex_height;
28 glTexCoord2f(umax, 0);
30 glTexCoord2f(umax, vmax);
32 glTexCoord2f(0, vmax);
39 static int next_pow2(int x)
50 static void update_fbtex()
52 if(win_width <= fb_tex_width && win_height <= fb_tex_height) {
53 return; // nothing to do
56 glGenTextures(1, &fb_tex);
57 glBindTexture(GL_TEXTURE_2D, fb_tex);
58 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
59 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
61 glBindTexture(GL_TEXTURE_2D, fb_tex);
64 fb_tex_width = next_pow2(win_width);
65 fb_tex_height = next_pow2(win_height);
66 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, fb_tex_width, fb_tex_height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);