Re: Double buffering problems.
Posted: Sat Nov 15, 2014 11:08 am
@ airsoftsoftwair
I've been flawlessly running (at the same time) your DoubleBuffer.hws AND SinusScroller.hws demos for over an hour, now.
They work fine.
While re-analyzing your codes I noticed that you always use this approach:
It looked weird to me because I thought that "Cls" command was supposed to clear the screen, thus cancelling the screen you just rendered with the "Flip" command. Since the documentation says that "Cls" behaves differently in accordance to the selected output device, it is now my understanding that it has no effect on what you see on screen (the front buffer).
In other words, reversing those commands while double buffering is active would actually never clear the back buffer which gets constantly overwritten and, possibly (???), overloaded? Could this be the case?
I'll explain better. This is the code I use for rendering the end credits. What you see on screen ehrn this script runs is a sequence of images that merge nicely one into the other in the background, while rolling credits scroll in the foreground. Please note that "Cls" is call before "Flip()". This code works nicely at first, but at a certain point it just stalls forever.
I'll try to reverse Cls and Flip commands, hoping it works. There are other piece of codes like this one in my game. Could it finally be the reason why this happens??
Best regards
Gianluca
=== EDIT ===
I switched the intructions in my code and I'm now testing it.
In the meantime, your examples keep working...
=== EDIT #2 ===
Nothing to do. It stalled after a couple of minutes.
I'll now try to cut down the number of active brushes.
I've been flawlessly running (at the same time) your DoubleBuffer.hws AND SinusScroller.hws demos for over an hour, now.
They work fine.
While re-analyzing your codes I noticed that you always use this approach:
Code: Select all
Flip ; flip front/back buffer
Cls ; clear buffer
In other words, reversing those commands while double buffering is active would actually never clear the back buffer which gets constantly overwritten and, possibly (???), overloaded? Could this be the case?
I'll explain better. This is the code I use for rendering the end credits. What you see on screen ehrn this script runs is a sequence of images that merge nicely one into the other in the background, while rolling credits scroll in the foreground. Please note that "Cls" is call before "Flip()". This code works nicely at first, but at a certain point it just stalls forever.
Code: Select all
BeginDoubleBuffer()
CopyBrush(581, 580)
Repeat
If j<255
Cls
MixBrush(580, 580+backdrop, j)
DisplayBrush(580, #RIGHT, #CENTER)
j=j+1
For Local i=431 To 461 Do DisplayBrush(i, #LEFT, scroll_y+50*(i-431))
scroll_y=scroll_y-speed
If scroll_y<(-1400) Then scroll_y=550
Flip()
Else
j=1
If backdrop<7 Then backdrop=backdrop+1 Else backdrop=0
EndIf
If IsMusicPlaying(311)=False Then PlayMusic(311)
WaitTimer(1, 40)
Until IsLeftMouse()= True
EndDoubleBuffer()Best regards
Gianluca
=== EDIT ===
I switched the intructions in my code and I'm now testing it.
In the meantime, your examples keep working...
=== EDIT #2 ===
Nothing to do. It stalled after a couple of minutes.
I'll now try to cut down the number of active brushes.