[Solved] TPixmap on Android

BlitzMax Forums/Brucey's Modules/[Solved] TPixmap on Android

RustyKristi(Posted 2016) [#1]
I'm getting some hint and it seems I have problems working with TPixmap on Android. My module heavily uses this function and apparently BRL.GLMax2D only works on Desktop.


Derron(Posted 2016) [#2]
Nothing stops you from using the SDL-GL-one like brucey suggested in another thread.


TPixmap is defined in brl.mod/pixmap.mod


Edit: I do not know whether there is a bug on android or not, so this is just a "theoretical" thing.


bye
Ron


Derron(Posted 2016) [#3]
Ok here you go:


It exposes either something I miss in the code - or a bug in the android-support of BMX-NG.
Why? It cannot draw the pixmap, but is able to draw the image based on the pixmap.


bye
Ron


Brucey(Posted 2016) [#4]
As far as I remember (without looking at the code), DrawPixmap is not implemented by the shader-based Max2D.
Given how terribly slow DrawPixmap is normally (due to the way the data gets copied over every draw), you probably shouldn't want to be using it anyway.


Derron(Posted 2016) [#5]
Hmm, couldn't the module emulate DrawPixmap?

I mean in an very inefficient manner: creating an image on each "drawPixmap()"-request and then drawing the image.

This would at least create some kind of "compatibility".


bye
Ron


RustyKristi(Posted 2016) [#6]
As far as I remember (without looking at the code), DrawPixmap is not implemented by the shader-based Max2D.
Given how terribly slow DrawPixmap is normally (due to the way the data gets copied over every draw), you probably shouldn't want to be using it anyway.



Thanks for clearing this up guys.

@Brucey,

As Derron mentioned, are there any ways to emulate this or some sort of replacement?


Brucey(Posted 2016) [#7]
I've just updated GL2SDLMax2D to now render (via DrawImage) on a call to DrawPixmap.
Since it's copying data every draw, it will be a resource hog on mobile, so YMMV.


RustyKristi(Posted 2016) [#8]
Thanks Brucey, works straight off the bat! I got 22fps on my cheap quad core phone but I'm not complaining. I'm just happy that it works :D

Now.. how do I optimize it and make it at least 60fps XD

@Derron, I would like to try the code you posted above. I'm always open for other techniques if that provides a solution


Derron(Posted 2016) [#9]
Optimize: use timage instead of tpixmap.

Why do you want to draw pixmaps? use the lockimage-approach I have posted and only adjust the pixmap when content has to change.

@my sample
Copy paste compile. I tried it on my phone and it works.


Bye
Ron


Brucey(Posted 2016) [#10]
how do I optimize it and make it at least 60fps

Why do you want to use DrawPixmap?


RustyKristi(Posted 2016) [#11]
Why do you want to use DrawPixmap?


Hey Brucey, just trying some pseudo3d stuff and some examples I found uses DrawPixmap..