[android-developers] Off-screen View hierarchy in OpenGL ES. Views incorrectly invalidating each other.
Hi all,
I'm making an app that has standard Android Views on OpenGL ES
textures, allowing them to be rendered on any 3D mesh. I have
everything working, like touch and correct View invalidates. The way
I'm doing it is putting all the Android Views that are supposed to
rendered to textures in my root content view, along with the actual GL
Surface View. All the Android views have overridden draw methods, that
draw to a texture matching the View's size, instead of the screen. I
call those views the off-screen View hierarchy.
My problem is, every View in the off-screen View hierarchy is
positioned at the same coordinate (0, 0), in order for it to be drawn
to the top left pixel of its own texture. This has the effect that
when a View; let's say a Button, is invalidated because the user
pressed it, all the other Views are also automatically invalidated.
This is because Android redraws all views which intersect with an
invalidated View, and in the off-screen View hierarchy they are all
positioned at (0, 0) and all overlapping. This is not what I want,
since all views are drawn to different textures and they are not
really overlapping on screen, just in the off-screen View hierarchy.
I really want to prevent Views in the off-screen View hierarchy from
invalidating each other but all the things I have tried already,
failed:
* I tried offsetting each View so that it does not overlap any other
View. Then I translate the canvas just before drawing to get the View
to be drawn on coordinate (0, 0) of the texture. The problem I face
with this method is that when I have many Views, so that some must be
offset to the extent that they are outside the "screen", they are not
rendered at all (Probably an optimization in the View framework, not
drawing Views outside the screen, but I need all Views to be drawn
when requested).
* I tried overriding all the different invalidate()-methods of View,
to prevent Views from invalidating each other. That doesn't help at
all, and it really looks like the method I should be overriding is
ViewGroup.invalidateChild(), which is final, and can't be overridden.
* I tried adding each off-screen View via addContentView() instead of
putting them all in a single View hierarchy, but they still invalidate
each other.
Does anyone with great knowledge of the View-framework have a solution
to this?
Thanks!
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home