I've been trying to get my code up and running with irrlicht-1.8.0-alpha (rev4306) and I noticed a small difference compared to irrlicht 1.7.3 in the void COpenGLDriver::setViewPort(const core::rect<s32>& area) function that prevents me from using multiple viewports in combination with multiple render targets.
In bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, bool clearZBuffer, SColor color) the viewport is automatically set to: glViewport(0,0,ScreenSize.Width,ScreenSize.Height) when I render to screen. To render to the correct viewport, I have to manually call setViewPort(const core::rect<s32>(my_x,my_y,my_width, my_height)) after caling setRenderTarget();
Code: Select all
void COpenGLDriver::setViewPort(const core::rect<s32>& area)
{
if (area == ViewPort)
return;
core::rect<s32> vp = area;
core::rect<s32> rendert(0,0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
vp.clipAgainst(rendert);
if (vp.getHeight()>0 && vp.getWidth()>0)
{
glViewport(vp.UpperLeftCorner.X,
getCurrentRenderTargetSize().Height - vp.UpperLeftCorner.Y - vp.getHeight(),
vp.getWidth(), vp.getHeight());
ViewPort = vp;
}
}
I would like to propose to either remove these lines from setViewPort():
Code: Select all
// if (area == ViewPort)
// return;
I hope this can be implemented in irrlicht 1.8