blackMasoon wrote:what may be the reason?
anything.
Your post looks to me like "i have function called doJob() and when i call it, nothing happens. what may be the reason?"
My way is to take an example and try to repeat the problem in the code with minimum lines. So i took 02.Quake3Map and tested IVideoDriver::setViewPort(); i'm not sure how it supposed to work but i have 2 ways of usage this method:
1) outside device->run() cycle (this way seems to me correct if all we need is to set viewport and expect it to stay same until we change it).
2) inside device->run() cycle, so we call it each frame we render.
Next images show the difference of code samples i used (selected code -- the code i added into original Irrlicht' example):
So here is the result:
Software and BurningsVideo renderers: works the same; both ways works correct;
OpenGL and Direct3D8/9 renderers: works only when using second way (when we setViewPort() every render cycle);
/* maybe "device->run()" implementation resets viewport value for this renderes, but i didin't looked into it. */
Working result in OpenGL and Direct3D9:
As you may notice from the image, we see the difference: OpenGL's beginScene() implementation clears all the frame buffer with specified color
/* video::SColor(255,200,200,200) */ , not only viewport as Direct3D does. The same behavior (like with OpenGL) also seen in Software and BurningsVideo renderers.
/* i don't know what is correct, but i believe it must be the same in all renderers; and if asking me -- D3D do it correct, when touching only specified viewport. */
/* I'm not sure is next investigation a bug, maybe the documentation on setViewPort() should just describe when it is expected and correct to call this method. */
For example we can write next:
...
int lastFPS = -1;
while(device->run())
{
if (device->isWindowActive())
{
driver->setViewPort(core::recti(100, 100, 300, 300));
driver->beginScene(true, true, video::SColor(255,200,200,200));
driver->setViewPort(core::recti(100, 100, 500, 300));
smgr->drawAll();
driver->endScene();
...
and Direct3D9 - the only render from all 4 that shows correct result (all other renders renders into 100,100,500,300 with full update):