GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2014-Nov-12

Title: stretchsprite or polyvector
Post by: MrPlow on 2014-Nov-12
Hi

Just wondering if the virtual screen setup benefits from switching from stretchsprite to polyvector on Android

Anyone notice significant benefits?
(btw - my app has to use smoothshading true or its a mess - I know smoothshading is a bit of a hit)


Title: Re: stretchsprite or polyvector
Post by: Ian Price on 2014-Nov-13
I've not really noticed any significant difference with those two commands on any format tbh. I tried them both with AquaVenture on Android - OUYA and GameStick and webos (pre->TouchPad) - FPS didn't really alter no matter what I used.
Title: Re: stretchsprite or polyvector
Post by: MrPlow on 2014-Nov-13
Thanks Ian...

Didn't seem to notice any difference either.

I'm happy to use it as long the polyvector has the same compatibility as stretchsprite across android devices.
:)
Title: Re: stretchsprite or polyvector
Post by: spacefractal on 2014-Nov-13
But if you remove virtual screen and draw anything diirectly, You do a lots better perforcement.

Im mostly uses polyvector to draw tiles etc to reduce number of draw calls. But often I'm do mix.
Title: Re: stretchsprite or polyvector
Post by: Ian Price on 2014-Nov-13
You still have to GRABSPRITE though if you don't use a virtual screen and that eats CPU too. Or are you doing something different?

Polyvectors aren't always quicker than sprites for tiles, even if you use POLYNEWSTRIP. You have to test per device. :(
Title: Re: stretchsprite or polyvector
Post by: kanonet on 2014-Nov-13
Of cause you could also stretch each sprite individual, using STRETCHSPRITE or POLYVECTOR, so you wont need offscreen or GRABSPRITE at all. But I dont know how this works performance wise.
Title: Re: stretchsprite or polyvector
Post by: spacefractal on 2014-Nov-13
For big textures there was a quite big advance using polyvector if you draw it more than once. Framerate did fall very much, so it's depend on content.

In greedy mouse I'm for gain double speed using backbuffer directly without never use grab sprite or virtual screen.

I'm in some instance used 2kb or even 4kb textures and used layers.

So it's all depend on content and size.
Title: Re: stretchsprite or polyvector
Post by: Ian Price on 2014-Nov-13
Quoteusing backbuffer directly without never use grab sprite or virtual screen.
How exactly were you doing that?
Title: Re: stretchsprite or polyvector
Post by: spacefractal on 2014-Nov-13
I'm just either use zoom sprite, strect sprite or poly vectors directly.

Btw look in the android virtual screen rutine for the paint image function.
Title: Re: stretchsprite or polyvector
Post by: kanonet on 2014-Nov-13
Do you get extra speed boost, if you pack all your small sprites into one big texture atlas and draw this with polyvector? On desktop that should be fast, but I dont know much about Android performance.
Title: Re: stretchsprite or polyvector
Post by: spacefractal on 2014-Nov-13
There was various issues with virtual screens, which is why im not want to uses them. one was the big performance drop. Another issues was alpha multiply issues, which im newer got a workaround. So im quickly dropped virtual screens again and imply my own scaling drawing functions. But for me its depend on content what there is best. Sometimes im uses POLYVECTORS. Sometimes im dont. This can been in various reasons.

For tiled background im allways use POLYVECTOR to avoid hotspot issues when the graphics got scaled (and grant framerate), or the game draw insane many layered tiles (they are 2-3 layed in Greedy Mouse as well 2 layeres in Karma Miwa).

Howover im cant uses colored POLYVECTORS as well alpha on POLYVECTORS at all, which can get a large performance drop. so uses ALPHAMODE with care, but instead uses alpha on the assets its self instead. in Karma Miwa im do checks framerate. if its drop under 30fps, then the first thing the game do is disable the color POLYVECTOR on the font.

You can do enable or disable SMOOTHSHADING. But my games does rarely uses SMOOTHSHADING true really and newer on tiles.

But in the end im dont use GRABSPRITE or virtual screens in none of my games. Instead im created scaled based paint functions.

PS. Some users did have a insane big performence advance when only doing POLYVECTORS, but that is not allways possible.
Title: Re: stretchsprite or polyvector
Post by: bigsofty on 2014-Nov-13
Quote from: kanonet on 2014-Nov-13
Do you get extra speed boost, if you pack all your small sprites into one big texture atlas and draw this with polyvector? On desktop that should be fast, but I dont know much about Android performance.
Yes, batching prevents the GPU texture cache from being thrashed, this is especially true on mobile divices with limited VRAM.

If you want the most speed, dip into a little C and OpenGL, keep within GLBasic 1.x OpenGL ES spec. and use batching with degenerate triangle strips in vertex arrays for your sprites. Faster than VBOs IIRC. Shaders would be faster but there's no mobile support.
Title: Re: stretchsprite or polyvector
Post by: spacefractal on 2014-Nov-13
its mightnot been that much impact when using virtual screen, but there is quite much impact when drawing directely to the backbuffer as im does in my games.
Title: Re: stretchsprite or polyvector
Post by: MrPlow on 2014-Nov-17
Cheers guys
I would normally do a createscreen 0 and usescreen 0 then stretchsprite that but now I will use the polyvector instead of the stretchsprite.