Thanks Romain, besides OpenGL, the ScrollView is intended to have a number 
of other UI elements (readonly TextViews, Buttons etc.). 
The OpenGL portion itself will take less than one screen. However, the 
entire ScrollView will take up more than one screen.

1. I could potentially implement all of them in OpenGL ES, however, my 
sense was that it will be better to implement TextViews,Buttons etc with 
standard Android framework elements and Java.
Would you recommend reconsidering whether to implement the entire UI 
(TextViews, Buttons etc.) in OpenGL

2. If OpenGL-inside-ScrollView isn't feasible for 2.3, would you say that a 
good alternative option is to build Skia/C++ code and then call native Skia 
APIs from within the C++ component. I don't need to write text with the 
drawing code and don't need 3D rendering. I just need 2D drawing

3. The third alternative would be to use JNI and pass all data (around 2000 
floats) from C++ code to Java code and draw everything with the Android 
canvas. 
I haven't done any perf testing to figure out the performance implications 
of the Canvas approach (passing data from C++ to Java, calling Canvas apis 
and Canvas code calling the underlying Skia apis)

I'd appreciate thoughts on the three alternatives (or any others that I 
might have missed)


On Tuesday, August 21, 2012 10:09:51 PM UTC-7, Romain Guy (Google) wrote:
>
> It would be very difficult to recreate TextureView on 2.3. Could you 
> simply implement scrolling in GL instead?
> On Aug 22, 2012 5:47 AM, "aprogrammer" <ram...@gmail.com <javascript:>> 
> wrote:
>
>> Our business logic is in C++ and the drawing code gets its data from this 
>> C++ code.
>> So I'd rather do the drawing in C++ instead of the overhead of passing 
>> all the data to Java (and the Java code would call Android framework which 
>> internally calls C code anyway)
>>
>> With C++ for Android, my understanding is that OpenGL ES and Skia are the 
>> two best options. 
>> We have already written OpenGL ES prototype code (on iOS), OpenGL is is 
>> more portable and it seems reasonable to assume that it offers better 
>> performance than Skia. 
>>
>> Of course, I'm open to hearing more options on drawing with C++ (and see 
>> Java/Canvas drawing as a last resort). Does this answer your question ?
>>
>> On Tuesday, August 21, 2012 1:58:45 PM UTC-7, bob wrote:
>>>
>>> If it is just 2d, why bother with OpenGL?
>>>
>>>
>>> In general, OpenGL does not play well with others.
>>>
>>>
>>>
>>> On Tuesday, August 21, 2012 3:19:51 PM UTC-5, aprogrammer wrote:
>>>>
>>>> Hi, I'd like to do some 2G OpenGL rendering inside a ScrollView. The 
>>>> rendering code is in C++ and the rest of the ScrollView UI is based on 
>>>> Android framework UI elements.
>>>>
>>>> It seems like OpenGL drawing should be done on a SurfaceView (which can 
>>>> be passed from Java to C++)
>>>> However, SurfaceView elements don't scroll with the rest of a 
>>>> ScrollView and so it seems like I won't be able to use the SurfaceView 
>>>> with 
>>>> a ScrollView
>>>>
>>>> My understanding is that the TextureView in ICS/4.0 permits OpenGL 
>>>> drawing and also supports scrolling inside a ScrollView. So this meets my 
>>>> needs for new devices.
>>>> However, I'd also like to support older devices (Gingerbread/2.3 and 
>>>> upwards).
>>>> I'm not sure if this can be done (for instance, I'm not sure if the 
>>>> OpenGL drawing can be rendered to a bitmap and then have the bitmap placed 
>>>> inside a ScrollView)
>>>>
>>>> 1. Does anyone know if and how it is possible to implement this for 
>>>> Android 2.3 ?
>>>> iow is it possible to place an OpenGL drawing inside a ScrollView - or 
>>>> is the Canvas approach my only option ?
>>>>
>>>> 2. A second (related) question - Can I place a Canvas object inside a 
>>>> ScrollView, pass the Canvas object to C++ code and then use Skia apis to 
>>>> draw on the Canvas object
>>>>
>>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to 
>> android-d...@googlegroups.com<javascript:>
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com <javascript:>
>> 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 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

Reply via email to