[Android-development] render qml scene to the custom android opengl context( android.view)

Ivan Balashov ivan.d.balashov at gmail.com
Sat Dec 17 16:57:39 CET 2016


Hi, my goal is to make a crossplatform gui using qt/qml, but on android i
need to use custom opengl surface(because it's ime keyboard surface)
I've figured out, that i can write custom qml item, that will be placed as
root for the qml scene, and it will be rendered to the custom opengl
texture.
But i can't understand how to make it technically rendered where i want in
android interface.

I thought that it should call native method from java, that will return
surfaceTexture with the content, and in java this surfaceTexture put into
TextureView
I think i can handle qt side, but i definitely need some advice on android.
Hope someone describe right solution(or may be an alternative, because i'm
not bound to the qt)

public class KeyboardServiceIME extends InputMethodService implements
> TextureView.SurfaceTextureListener{
>
>     private TextureView mTextureView;
>
>     @Override
>     public View onCreateInputView() {
>
>         startQML()
>         mTextureView = new TextureView(this);
>         mTextureView.setSurfaceTextureListener(this);
>         return mTextureView;
>     }
>
>     @Override
>     public void onSurfaceTextureAvailable(SurfaceTexture surface, int
> width, int height) {
>
>         frameAvailable(0, surface);
>     }
>
>     @Override
>     public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int
> width, int height) {
>
>     }
>
>     @Override
>     public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
>         return false;
>     }
>
>     @Override
>     public void onSurfaceTextureUpdated(SurfaceTexture surface) {
>
>     }
>     public native void frameAvailable(long nativeHandle, SurfaceTexture
> surfaceTexture);
>     public native int startQML();
> }
>

Thanks, anyway, and sorry if it's not the right maillist, i thought about
writing to the "Interest" too, but choosed this one. I think, it would be
good feature for qt-android(possibility to create android.view with qt)

--
Best regards,
Ivan Balashov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20161217/c99f98bf/attachment.html>


More information about the Android-development mailing list