Double buffering problems.

Report any Hollywood bugs here
g0blin
Posts: 77
Joined: Tue Oct 04, 2011 9:06 am

Re: Double buffering problems.

Post by g0blin »

@ 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:

Code: Select all

Flip  ; flip front/back buffer
Cls   ; clear buffer
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.

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()
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.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Double buffering problems.

Post by airsoftsoftwair »

Please get in touch via email. I can provide you a work-in-progress build of Hollywood so you can check if the problem is still there. If it's a Hollywood bug, I might have already fixed it...
g0blin
Posts: 77
Joined: Tue Oct 04, 2011 9:06 am

Re: Double buffering problems.

Post by g0blin »

Great!
E-mail sent.
Post Reply