Page 2 of 5

Re: Best way to do lots of moving things on screen?

Posted: Sun Jun 16, 2019 1:01 pm
by Bugala
I am truly surpised how powerful Hollywood is. I made this test code:

Code: Select all

EscapeQuit(True)
@DISPLAY {Width = 1920, Height = 1080}

@REQUIRE "rebelsdl"

CreateBrush(1, 5, 5, #WHITE, {hardware=True})

BeginDoubleBuffer(True) ; set up a hardware double buffer

StartTimer(1)
SetFillStyle(#FILLCOLOR)
For move=1 To 300
     For a = 1 To 100
	For b = 1 To 100
	     DisplayBrush(1, 10 + (a*8) + move, 10+(8*b))
	Next
     Next
Flip
Cls
Next
DebugPrint(GetTimer(1))
Then I tried this both as it is, as well as removing Require RebelSDL, I also tried this by instead drawing same sized filled boxes and here are the restuls:

NO RebelSDL filled boxes: 10300
RebelSDL filled boxes: 9886
NO RebelSDL brushes: 9300
RebelSDL brushes(code above): 8900

First of all, surprisingly displaying brushes was faster than drawing, and another surprise was that RebelSDL gave only very little advantage over Hollywood in my machine. My machine was Win10 Intel Nuc 3, which is starting to be bit old already, and was a low powered machine even when i bought it maybe 5 years ago.

Re: Best way to do lots of moving things on screen?

Posted: Sun Jun 16, 2019 1:22 pm
by airsoftsoftwair
This is not the correct way to do benchmarks. Flip() will synchronize with the monitor's vertical refresh so your loop will be throttled instead of running as fast as possible. If you want to test raw blitting performance with RebelSDL, you need to set "EnableVSync" to FALSE in your @REQUIRE call.

Re: Best way to do lots of moving things on screen?

Posted: Sun Jun 16, 2019 2:57 pm
by Bugala
ah, thanks for clarifying that. Well, regardless, seems even bare hollywood is very fast actually. Faster than I expected. I was expecting it to start stumbling after couple hundred rectangles, and was expecting drawing be even slower.

Oh, and reminds me, when i forgot to add the double buffer first, the Rebel SDL became very slow, just like you warned that RebelSDL not using properly, might make even Hollywood things slower.

Re: Best way to do lots of moving things on screen?

Posted: Tue Jun 18, 2019 11:28 am
by Bugala
I am need of help in getting Buttons made with RebelSDL, or by otherwords, without having layers on.

When I try to make #SIMPLEBUTTON, it complains I need a BGpic active, when i use "SelectBIPic()", it complains i need layers on.

So how do I make the buttons wihtout putting Layers on?

Re: Best way to do lots of moving things on screen?

Posted: Tue Jun 18, 2019 11:34 am
by Bugala
And another thing. If I understood right, Hardware brushes cannot be altered? If so, then can I make Brush a hardware brush at later point?

Right now I have this system where background is drawn first to a brush, then I keep displaying this whole screen size brush every cycle, but I would like that to be hardware brush naturally.

Re: Best way to do lots of moving things on screen?

Posted: Fri Jun 21, 2019 12:32 pm
by airsoftsoftwair
Bugala wrote:
Tue Jun 18, 2019 11:28 am
When I try to make #SIMPLEBUTTON, it complains I need a BGpic active
You're probably trying to construct a button while a double buffer is active... that won't work. Create your buttons before the double buffer...

Re: Best way to do lots of moving things on screen?

Posted: Fri Jun 21, 2019 12:33 pm
by airsoftsoftwair
Bugala wrote:
Tue Jun 18, 2019 11:34 am
And another thing. If I understood right, Hardware brushes cannot be altered? If so, then can I make Brush a hardware brush at later point?

Right now I have this system where background is drawn first to a brush, then I keep displaying this whole screen size brush every cycle, but I would like that to be hardware brush naturally.
Sure, you can convert brushes to hardware brushes using CopyBrush()...

Re: Best way to do lots of moving things on screen?

Posted: Fri Jun 21, 2019 1:39 pm
by Bugala
airsoftsoftwair wrote:
Fri Jun 21, 2019 12:33 pm

Sure, you can convert brushes to hardware brushes using CopyBrush()...
Ah, didnt think of that. Thanks!

Re: Best way to do lots of moving things on screen?

Posted: Fri Jun 21, 2019 1:41 pm
by Bugala
airsoftsoftwair wrote:
Fri Jun 21, 2019 12:32 pm

You're probably trying to construct a button while a double buffer is active... that won't work. Create your buttons before the double buffer...
Thats funny. So I as long as i make them before doublebuffer is on, they work fine even doublebuffer is on. No wonder I couldnt figure that one out. Anyway, no problem doing that way.

Re: Best way to do lots of moving things on screen?

Posted: Mon Jun 24, 2019 12:10 pm
by xabierpayet
Hello Bugala, and Andreas, i test the snippet supplied by Bugala, and my results are better without RebelSDL, using RebelSDL i have 132000 ms time when i execute the script ,whithout RebelSDL my result is 12900 ms, this in windows 10 64 bits, any idea about why this is happening?