From 61f97fae40dfadca44ac91f93a567715cf7e09e5 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 31 Jul 2014 17:41:56 +0200 Subject: [PATCH] Fix issue with render target in OpenGL when size not specified --HG-- branch : multipass-stereo --- code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 10dea6d7e..58d708b09 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -2314,11 +2314,16 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width if(tex->isBloomTexture() && supportBloomEffect()) { + // NOTE: No support for mip map level here! + uint32 w, h; getWindowSize(w, h); getViewport(_OldViewport); + if (!width) width = tex->getWidth(); + if (!height) height = tex->getHeight(); + CViewport newVP; newVP.init(0, 0, ((float)width/(float)w), ((float)height/(float)h)); setupViewport(newVP); @@ -2401,7 +2406,7 @@ bool CDriverGL::copyTargetToTexture (ITexture *tex, bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height) { H_AUTO_OGL(CDriverGL_getRenderTargetSize) - NLMISC::CSmartPtr tex = _TextureTarget ? _TextureTarget : (_RenderTargetFBO ? _RenderTargetFBO : NULL); + NLMISC::CSmartPtr tex = _RenderTargetFBO ? _RenderTargetFBO : (_TextureTarget ? _TextureTarget : NULL); if (tex) { width = tex->getWidth();