Getting a ANativeWindowBuffer from ANativeWindow_Buffer

156 views
Skip to first unread message

Adi Shavit

unread,
Dec 18, 2014, 2:37:18 AM12/18/14
to andro...@googlegroups.com

Hi!

  To get fast OpenGL ES 2.0 texture pixel access on Android NDK, I want to use the eglCreateImageKHR()extension.

According to the EGL_NATIVE_BUFFER_ANDROID docs:

This extension enables using an Android window buffer (struct ANativeWindowBuffer) as an EGLImage source.

ANativeWindowBuffer is an internal struct used by the native framework classes like GraphicBuffer. Unfortunately, since I am on NDK I do not have direct access to these classes.

The NDK native_window interface allows me to pass a Java Surface object through to the NDK. I can then use ANativeWindow_fromSurface() to get an opaque ANativeWindow* handle. With this pointer I can call ANativeWindow_lock() to fill a struct of type ANativeWindow_Buffer (Note the _).

If I try to use this &ANativeWindow_Buffer object with eglCreateImageKHR() it fails with EGL_BAD_NATIVE_WINDOW.

My question is: How can I use ANativeWindow_Buffer with eglCreateImageKHR() or alternatively how to get an ANativeWindowBuffer from ANativeWindow_Buffer or from ANativeWindow*.

I appreciate any help as this is really baffling me!

Thanks!

(Also here)


Reply all
Reply to author
Forward
0 new messages