OpenGL 2 on Android: native window
Posted
by
ThreaderSlash
on Game Development
See other posts from Game Development
or by ThreaderSlash
Published on 2012-04-08T16:33:03Z
Indexed on
2012/04/08
17:47 UTC
Read the original article
Hit count: 780
According to OGLES specification, we have the following definition:
EGLSurface eglCreateWindowSurface(EGLDisplay display,
EGLConfig config,
NativeWindowType native_window,
EGLint const * attrib_list)
More details, here: http://www.khronos.org/opengles/documentation/opengles1_0/html/eglCreateWindowSurface.html
And also by definition:
int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
int32_t height, int32_t format);
More details, here: http://mobilepearls.com/labs/native-android-api
I am running Android Native App on OGLES 2 and debugging it in a Samsung Nexus device. For setting up the 3D scene graph environment, the following variables are defined:
struct android_app {
...
ANativeWindow* window;
};
android_app* mApplication;
...
mApplication=&pApplication;
And to initialize the App, we run the commands in the code:
ANativeWindow_setBuffersGeometry(mApplication->window, 0, 0, lFormat);
mSurface = eglCreateWindowSurface(mDisplay, lConfig,
mApplication->window, NULL);
Funny to say is that, the command ANativeWindow_setBuffersGeometry behaves as expected and works fine according to its definition, accepting all the parameters sent to it. But the eglCreateWindowSurface does no accept the parameter mApplication->window, as it should accept according to its definition. Instead, it looks for the following input:
EGLNativeWindowType hWnd;
mSurface = eglCreateWindowSurface(mDisplay,lConfig,hWnd,NULL);
As an alternative, I considered to use instead:
NativeWindowType hWnd=android_createDisplaySurface();
But debugger says:
Function 'android_createDisplaySurface' could not be resolved
Can someone tell if there is a way to convert mApplication->window? In a way that the data from the android_app get accepted to the window surface?
© Game Development or respective owner