viewport flikering

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

viewport flikering

Post by pin3 »

I`m trying to draw multiple viewports on screen. The problem is I don`t want to update the viewports in each beginScene() cycle. I.e each viewport gets updated once uponatime. However on each beginScene all the viewports get cleared so it all white until the viewport is drawn again
If draw a viewport per frame, with 4 vp I end up with the each viewport being white 3/4 of the time.
[update] I got it to work with setting the beginScene clear Backbuffer to false however I still get the gui flikering. Unlike the viewports I want the gui updated on a per frame basis.
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

try only calling endScene after the last render. I'm not sure how safe this is, but it should do what you want.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

put your gui to another separate viewport?
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

the way I have it

beginScene()

setVP(1);
sceneManager->drawAll
setVP(2);
sceneManager->drawAll
setVP(3);
sceneManager->drawAll
setVP(4);
sceneManager->drawAll
setVp(5);
guiManager->drawAll

endScene();

how do I endScene after the last render?
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

hmm, that's what I had in mind. I can't see why it wouldn't work, since Irrlicht isn't supposed to copy the view to the screen until endScene is called. maybe the problem is with another bit of the code.. can you post your actual code? (the bit between begin/end scene should be enough)
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

DavidJE13 your right that's pseudo code for how things used to be but I changed things in the mean time .


DrawViewport(int Frame)
{
if(Frame == 0)
{
setVP(1);
sceneManager->DrawEverything
}
if(Frame == 1)
{
setVP(2);
sceneManager->DrawEverything
}
if(Frame == 2)
{
//setVP(3);
sceneManager->DrawEverything
}
}

int Frame

beginScene()
Frame++
if(Frame ==4)
{
Frame =0
}
DrawViewport(Frame)
setVp(5);
guiManager->DrawEverything

endScene();
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

hmm, again that should work (although you will have a problem with the gui showing ~3 previous frames in each segment)

Either the code you posted isn't entirely representative of your app, or the bug is elsewhere. Possibly in the setup - what driver/OS are you using?
I'm going to do a few tests with this, see if I can reproduce the glitch.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Code: Select all

int Frame 

beginScene() 
Frame++ 
if(Frame ==4) 
{ 
Frame =0 
} 
DrawViewport(Frame) 
setVp(5); 
guiManager->DrawEverything 

endScene();
No, this will not work because it only draws one viewport between the begin and end scene calls. If you want to avoid flicker, you need to draw all viewports between those calls.

Travis
Post Reply