--- /dev/null
+#include "opengl.h"
+#include "texture.h"
+#include "post.h"
+#include "demo.h"
+
+void overlay(unsigned int tex, float aspect, float alpha)
+{
+ float xscale = aspect / win_aspect;
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef(xscale, 1.0, 1.0);
+
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_LIGHTING);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_TEXTURE_2D);
+
+ glBindTexture(GL_TEXTURE_2D, tex);
+
+ glBegin(GL_QUADS);
+ glColor4f(1, 1, 1, alpha);
+ glTexCoord2f(0, 1);
+ glVertex2f(-1, -1);
+ glTexCoord2f(1, 1);
+ glVertex2f(1, -1);
+ glTexCoord2f(1, 0);
+ glVertex2f(1, 1);
+ glTexCoord2f(0, 0);
+ glVertex2f(-1, 1);
+ glEnd();
+
+ glPopAttrib();
+
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+}
+
+void overlay_tex(struct texture *tex, float alpha)
+{
+ overlay(tex->id, (float)tex->width / tex->height, alpha);
+}