From dd728a6a2fb42ab8de291545925f90db45d07317 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 10 Jan 2009 18:22:47 +0000 Subject: [PATCH] add a new vec2 LowerRightCorner to the glsl shader. The screen texture is in 0..LowerRightCorner git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8640 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gl_rmain.c b/gl_rmain.c index 5aa039e0..c70ea51f 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -484,6 +484,7 @@ static const char *builtinshaderstring = "// uniform vec4 UserVec4;\n" "// uniform float ClientTime;\n" "// uniform vec2 PixelSize;\n" +"// uniform vec2 LowerRightCorner;\n" "void main(void)\n" "{\n" " gl_FragColor = texture2D(Texture_First, gl_TexCoord[0].xy);\n" @@ -1214,6 +1215,7 @@ typedef struct r_glsl_permutation_s int loc_UserVec4; int loc_ClientTime; int loc_PixelSize; + int loc_LowerRightCorner; } r_glsl_permutation_t; @@ -1374,6 +1376,7 @@ static void R_GLSL_CompilePermutation(shadermode_t mode, shaderpermutation_t per p->loc_UserVec4 = qglGetUniformLocationARB(p->program, "UserVec4"); p->loc_ClientTime = qglGetUniformLocationARB(p->program, "ClientTime"); p->loc_PixelSize = qglGetUniformLocationARB(p->program, "PixelSize"); + p->loc_LowerRightCorner = qglGetUniformLocationARB(p->program, "LowerRightCorner"); // initialize the samplers to refer to the texture units we use if (p->loc_Texture_First >= 0) qglUniform1iARB(p->loc_Texture_First , GL20TU_FIRST); if (p->loc_Texture_Second >= 0) qglUniform1iARB(p->loc_Texture_Second , GL20TU_SECOND); @@ -3524,6 +3527,8 @@ static void R_BlendView(void) qglUniform1fARB(r_glsl_permutation->loc_ClientTime, cl.time); if (r_glsl_permutation->loc_PixelSize >= 0) qglUniform2fARB(r_glsl_permutation->loc_PixelSize, 1.0/r_bloomstate.screentexturewidth, 1.0/r_bloomstate.screentextureheight); + if (r_glsl_permutation->loc_LowerRightCorner >= 0) + qglUniform2fARB(r_glsl_permutation->loc_LowerRightCorner, vid.width/r_bloomstate.screentexturewidth, vid.height/r_bloomstate.screentextureheight); if (r_glsl_permutation->loc_UserVec1 >= 0) { float a=0, b=0, c=0, d=0; -- 2.39.2