summaryrefslogtreecommitdiff
path: root/src/opengl.c
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2001-08-12 19:48:15 +0000
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 02:22:36 +0200
commit3ec3df2e66e591d483444ebe3d2ea76a9c5fddbf (patch)
tree6f93ff9f9c24291af870d87c6f09db65c1d84abd /src/opengl.c
parentb6076c656ea40abfbb3f9d2ba8e69b69c2d55d75 (diff)
Added noise overlay (for marine image enhancer).
Diffstat (limited to 'src/opengl.c')
-rw-r--r--src/opengl.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/opengl.c b/src/opengl.c
index 4da2b6c..0a2e563 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -27,6 +27,7 @@ extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr;
extern unsigned char GammaValues[256];
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
extern int SpecialFXImageNumber;
+extern int StaticImageNumber;
static D3DTexture *CurrTextureHandle;
@@ -603,6 +604,69 @@ void D3D_PredatorThermalVisionPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVER
glEnd();
}
+void DrawNoiseOverlay(int tr)
+{
+ GLfloat x[4], y[4], s[4], t[4], u, v;
+ int r, g, b;
+ D3DTexture *tex;
+ int size;
+
+ r = 255;
+ g = 255;
+ b = 255;
+
+ size = 256;
+
+ tex = ImageHeaderArray[StaticImageNumber].D3DTexture;
+
+ CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
+ // CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
+ CheckBoundTextureIsCorrect(tex->id);
+ // CheckDepthFuncIsCorrect(GL_ALWAYS);
+ glDepthFunc(GL_ALWAYS);
+
+ u = FastRandom()&255;
+ v = FastRandom()&255;
+
+ x[0] = -1.0f;
+ y[0] = -1.0f;
+ s[0] = u / 256.0f;
+ t[0] = v / 256.0f;
+ x[1] = 1.0f;
+ y[1] = -1.0f;
+ s[1] = (u + size) / 256.0f;
+ t[1] = v / 256.0f;
+ x[2] = 1.0f;
+ y[2] = 1.0f;
+ s[2] = (u + size) / 256.0f;
+ t[2] = (v + size) / 256.0f;
+ x[3] = -1.0f;
+ y[3] = 1.0f;
+ s[3] = u / 256.0f;
+ t[3] = (v + size) / 256.0f;
+
+ SelectPolygonBeginType(3); /* triangles */
+ glColor4ub(r, g, b, tr);
+
+ glTexCoord2f(s[0], t[0]);
+ glVertex3f(x[0], y[0], 1.0f);
+ glTexCoord2f(s[1], t[1]);
+ glVertex3f(x[1], y[1], 1.0f);
+ glTexCoord2f(s[3], t[3]);
+ glVertex3f(x[3], y[3], 1.0f);
+
+ glTexCoord2f(s[1], t[1]);
+ glVertex3f(x[1], y[1], 1.0f);
+ glTexCoord2f(s[2], t[2]);
+ glVertex3f(x[2], y[2], 1.0f);
+ glTexCoord2f(s[3], t[3]);
+ glVertex3f(x[3], y[3], 1.0f);
+
+ glEnd();
+
+ glDepthFunc(GL_LEQUAL);
+}
+
void D3D_PredatorScreenInversionOverlay()
{
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_DARKENINGCOLOUR);