Generally speaking, anything that updates the UI is supposed to be done on 
the main thread.  What you're doing sounds suspiciously apt to have 
problems unless something in Android documentation validates your approach.

If you want to render stuff into a view off the main thread, consider 
instead using SurfaceView and its SurfaceHolder.  It specifically has 
provisions for drawing to its Canvas off the main thread.

Doug

On Tuesday, November 5, 2013 7:09:20 AM UTC-8, Michael Zoech wrote:
>
> Hi,
>
> In my current application that I'm developing I draw into an 
> android.graphics.Bitmap object from a non-UI thread. This is done from 
> native code via the AndroidBitmap_lockPixels and AndroidBitmap_unlockPixels 
> calls. Every time the drawing has finished, the UI thread gets notified 
> that the Bitmap has changed and the responsible View in the Activity is 
> invalidated and redrawn. All code that accesses the Bitmap is synchronized 
> on the Bitmap.
>
> The issue that I'm seeing is that if the rendering is too fast, after some 
> time the View is no longer updated and in the log the following is logged:
>
> E/OpenGLRenderer ... Cannot generate texture from bitmap
>
> None of the drawing calls produce any errors that anything is wrong.
>
> Searching on the internet reveals a few others who had similar issues, but 
> no real solutions or answers for that specific problem. Is it even allowed 
> to draw into the Bitmap from a non-UI thread? Is there a different way to 
> do something similar? I tried using just an IntBuffer and drawing the 
> IntBuffer in the view. While this works, it is also 2x slower than using a 
> Bitmap.
>
> Thanks,
> Michael
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to