GLBasic forum

Codesnippets => Code Snippets => Topic started by: Qedo on 2017-Nov-11

Title: FASTMEM2SPRITE
Post by: Qedo on 2017-Nov-11
For my application I found a certain slowness with MEM2SPRITE so I searched in the GLBASIC forum for a solution to this problem without finding anything.
So I wrote FASTMEM2SPRITE using the OpenGL routines. The result it is very fast and in some conditions, in high sprite resolution, even a 6X ratio on my computer. In Android, the increase is even slightly higher. The syntax is the same, obviously by adding FAST to the command. The only difference is that to draw the sprite because of the different coordinates of the OpenGL screen (bottom / left) you have to use the ZOOMSPRITE nsprite, 0,0, 1, -1 (vertical mirror).
Tried on Win and Android.
If you have better solution then you will be happy to receive your jobs.
Use it freely and let me know.
Ciao
Title: Re: FASTMEM2SPRITE
Post by: dreamerman on 2017-Nov-13
Very nice indeed, short and clean. Currently I don't have any use for it but with this speed can be surely used for some in-game effects.
Another good thing is that you can get CreateScreen out of function and this will speed it two times - that's good for effects on already created sprites/textures.
Title: Re: FASTMEM2SPRITE
Post by: Qedo on 2017-Nov-25
Thank you dreamerman for trying FASTMEM2SPRITE.
I have made new and more precise benchmarks and these results for 50 cycles:

Win10:
 MEM2SPRITE 17000 millisec
 FASTMEM2SPRITE 500 millisec
 ratio 34

Android 6.0:
 MEM2SPRITE 27000 millisec
 FASTMEM2SPRITE 270 millisec
 ratio 100

Unexpected FASTMEM2SPRITE  in Android is faster than in Win.
Ciao
Title: Re: FASTMEM2SPRITE
Post by: Kitty Hello on 2017-Nov-25
Oooh!  =D. What crap did I program, then!?
Title: Re: FASTMEM2SPRITE
Post by: r0ber7 on 2018-Aug-01
Thanks, I have exactly the place to use this. :-)