Cuellarjmcg

Hi Nate,

Trying my game with the latest changes using Libgdx runtime (and the SkeletonRenderer class), I saw a spike in my render calls (from 2 to 16 and counting).

I see that everytime I add another character which uses a skeleton it adds another render call.

Seeing at SkeletonRenderer, I guess the culprit is here:
public void draw (SpriteBatch batch, Skeleton skeleton) {
boolean premultipliedAlpha = this.premultipliedAlpha;
int srcFunc = premultipliedAlpha ? GL11.GL_ONE : GL11.GL_SRC_ALPHA;
batch.setBlendFunction(srcFunc, GL11.GL_ONE_MINUS_SRC_ALPHA);
Setting the blend function calls renderMesh(), which will flush the batch and.. well, you know the framework a lot more than me so you know what happens xD.

I know that I can subclass SkeletonRenderer and remove that part or skip it if I aren't using premultipliedAlpha (which will use the current blendfunction from the batch) which won't add more render calls, but other people would have the same problem so I think that a property to skip the set of the blending would be better.

Thanks in advance for your response.
Cuellarjmcg

Kickstarter Backer
  • 記事: 92

Nate

Update your libgdx. :) I added this line in libgdx when I added the premultplied stuff in spine-libgdx:
https://github.com/libgdx/libgdx/blob/m ... java#L1063
アバター
Nate

Nate
  • 記事: 9730

Cuellarjmcg

Nate さんが書きました:Update your libgdx. :) I added this line in libgdx when I added the premultplied stuff in spine-libgdx:
https://github.com/libgdx/libgdx/blob/m ... java#L1063
I see. Yep, the update did the work, render calls are back to normal :) thanks.
Cuellarjmcg

Kickstarter Backer
  • 記事: 92


Return to Runtimes