diff options
author | SmileTheory <SmileTheory@gmail.com> | 2013-03-05 01:41:51 -0800 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-03-19 16:41:14 +0000 |
commit | e02b6309db0b7d2f6e5c9788871330542653de54 (patch) | |
tree | 1d38b349cb4f36b9515ee72e50bbbb6a6db77c03 /src | |
parent | 0ee723eb4b35d858c10a5c907704607a769e6aa4 (diff) |
Calculate viewport and screen texture coordinates correctly for sun shadows. This fixes part of #5889.
Diffstat (limited to 'src')
-rw-r--r-- | src/renderergl2/tr_backend.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/renderergl2/tr_backend.c b/src/renderergl2/tr_backend.c index 18adc401..47a35fc2 100644 --- a/src/renderergl2/tr_backend.c +++ b/src/renderergl2/tr_backend.c @@ -1187,7 +1187,7 @@ const void *RB_DrawSurfs( const void *data ) { FBO_Bind(tr.screenShadowFbo); box[0] = (backEnd.refdef.x ) * tr.screenShadowFbo->width / (float)glConfig.vidWidth; - box[1] = (backEnd.refdef.y ) * tr.screenShadowFbo->height / (float)glConfig.vidHeight; + box[1] = (glConfig.vidHeight - ( backEnd.refdef.y + backEnd.refdef.height )) * tr.screenShadowFbo->height / (float)glConfig.vidHeight; box[2] = (backEnd.refdef.width ) * tr.screenShadowFbo->width / (float)glConfig.vidWidth; box[3] = (backEnd.refdef.height) * tr.screenShadowFbo->height / (float)glConfig.vidHeight; @@ -1195,9 +1195,9 @@ const void *RB_DrawSurfs( const void *data ) { qglScissor(box[0], box[1], box[2], box[3]); box[0] = (backEnd.refdef.x ) / (float)glConfig.vidWidth; - box[1] = (backEnd.refdef.y ) / (float)glConfig.vidHeight; + box[1] = 1.0 - (backEnd.refdef.y + backEnd.refdef.height) / (float)glConfig.vidHeight; box[2] = (backEnd.refdef.x + backEnd.refdef.width ) / (float)glConfig.vidWidth; - box[3] = (backEnd.refdef.y + backEnd.refdef.height) / (float)glConfig.vidHeight; + box[3] = 1.0 - (backEnd.refdef.y ) / (float)glConfig.vidHeight; texCoords[0][0] = box[0]; texCoords[0][1] = box[3]; texCoords[1][0] = box[2]; texCoords[1][1] = box[3]; |