compositor... properties

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

compositor... properties

Post by endernafi » Tue Feb 19, 2013 5:49 pm

Hello Dear LiveCoders,

I need a -or more- runrev guru(s).
I'm fiddling around with the below properties for a while now:
compositorCacheLimit, compositorTileSize, compositorType.
But I couldn't see any performance benefits.

Here is a sample code:

Code: Select all

on preOpenStack
   if the environment is "mobile" then
      iphoneUseDeviceResolution true, true
      start using stack "animationEngine"
      start using stack "kafes"
      set the compositorCacheLimit of this stack to 4 * 9 * (4 * (item 1 of the screenLoc) * (item 2 of the screenLoc))
-- 9 is the number of controls of this single-card stack.
      set the compositorTileSize of this stack to 128
      switch the platform
         case "iphone"
            set the compositorType of this stack to "opengl"
            break
         case "android"
            set the compositorType of this stack to "software"
            break
      end switch
      set the acceleratedRendering of this stack to true
   end if
end preOpenStack

A couple of questions:

* Does the order of these commands make a difference?
Setting the acceleratedRendering first or last;
or setting the compositorTileSize before the compositorCacheLimit, etc.

* What's the best way to determine the values of these properties?

* In which scenarios do these commands create a performance boost?
For example, in a game which consists hundreds of buttons and thousands of sprite png's or ...


Any hints and info much appreciated.


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: compositor... properties

Post by Simon » Tue Feb 19, 2013 9:14 pm

Hi Ender,
The dictionary says:
"Use the acceleratedRendering property to put LiveCode into accelerated rendering mode and set the compositor properties to recommended defaults."
That means don't use both.

I'll let someone else answer your other questions, way over my head.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: compositor... properties

Post by endernafi » Tue Feb 19, 2013 9:25 pm

Thanks Simon,

I didn't think that way.
But it makes sense, now reading your reply.
One shouldn't use both.

Still wondering though, whether changing that settings makes any performance boost.

I'll post the question in the mail list, too.
There are plenty of gurus there
and I think many of 'em can't find much time to read the forum posts.

Thanks again Simon...

Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: compositor... properties

Post by endernafi » Wed Feb 20, 2013 12:30 am

Ok,
It was a good decision of me to post this question to the mail-list.
The roundup of Jacque's detailed answer:
*
There's no need to mess around with the compositor properties.
Leaving the defaults as is and using the acceleratedRendering is enough.
But the tricky part is one should use it only when one need it.
*

And here is Thomas McGrath's clarification from another post:
*
1. on preopenCard - set the acceleratedRendering of this stack to true (only on cards that have scrolling or dynamic groups/objects
2. Immediately before moving an object turn on dynamic or when scrolling a group turn on scrolling
once moving the scroll or object has already been cached and drawn so these are no longer necessary.
No need to turn these things on and leave them on because they are not needed and the result is that things will actually slow down.
3. Immediately after moving or scrolling an object turn off the scrolling or dynamic settings
4. on closeCard - set the acceleratedRendering of this stack to false (turn it off since it is not needed)
*


So, here is the recipe:

If you don't have any scrolling groups or moving objects
-> don't turn on acceleratedRendering
and keep the layerMode of controls of the card as static.

If you have a scrolling group
-> turn on acceleratedRendering
and set the layerMode of group {only the topmost group, not the objects of group} to scrolling
immediately before scrolling;
then turn off acceleratedRendering
and set the layerMode of group to static after scrolling.

If you have a couple of moving objects and they move on occasion {i.e. following a click / touch}
-> turn on acceleratedRendering
and set the layerMode of the object(s) to dynamic immediately before the move;
then turn off acceleratedRendering
and set the layerMode of the object(s) to static once the move is done.

If you have multiple moving objects and / or they move constantly
{falling snow particles or rain drops, zooming stars like the Windows' simple screensaver, etc.}
-> turn on acceleratedRendering in the preOpenCard handler
and set the layerMode of the respective object(s) or group(s) to dynamic;
then turn off acceleratedRendering
and set the layerMode of those object(s) and / or group(s) to static
in the closeCard handler.


If I did any mistake or misunderstood the concept, please correct me.


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: compositor... properties

Post by endernafi » Tue Feb 26, 2013 7:36 pm

First real world implementation...
The results are spectacular 8)
A 16.000 px high group of news does scroll flawlessly in my low-end test device iPod Touch.
Before this retouch, it was scrolling bumpy.
Btw, each news group contains a 128*128 px picture, two text fields and a button.

Here is a snippet of my code:

Code: Select all

on scrollerBeginDrag
   set the layerMode of group "theNews" to "scrolling"
   set the acceleratedRendering of this stack to true
end scrollerBeginDrag

on scrollerDidScroll pX, pY
   switch mobileControlTarget()
      case "theNewsScroller"
         set the vScroll of group "theNews" to pY
         break
   end switch
end scrollerDidScroll

on scrollerEndDecelerate
   set the layerMode of group "theNews" to "static"
   set the acceleratedRendering of this stack to false
end scrollerEndDecelerate

Thanks everyone, especially Jacque...


Regards,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: compositor... properties

Post by Jellicle » Tue Feb 26, 2013 10:41 pm

Ender, that certainly helps with the actual scrolling of my data grids, but there is a slight delay each time the scrolling starts (I have to check for which one of three data grids are being scrolled).

So close :)

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: compositor... properties

Post by endernafi » Wed Feb 27, 2013 2:00 am

So close :D
So close, indeed 8)

Once I find a solution for that delay, I'll post it here.


Cheers,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

samu
Posts: 1
Joined: Sun Sep 12, 2021 9:11 pm

move objects

Post by samu » Sun Sep 12, 2021 9:23 pm

how can objects move constantly, and then how can i stop them?

Post Reply

Return to “iOS Deployment”