Android Window Handle

Sorry I accidentally hit send before I was done on the last message…

I am attempting to get the Ogre3d library to render in the window created by SDL so that I can use the SDL event handler. This works fine on linux and Windows. However, it crashes on Android if I use the recently added function to return the window handle. I am running the 2.0.3-8984 mercurial snapshot from a few days ago. Prior to using the built-in function for getting the window handle I used some JNI hackery to get it. I have done some tests and found that the 2 methods return different handles.

Here’s the code for what I have been doing:

JNIEnv* env = (JNIEnv*)SDL_AndroidGetJNIEnv();

jclass class_sdl_activity   = env->FindClass("org/libsdl/app/SDLActivity");
jmethodID method_get_native_surface = env->GetStaticMethodID(class_sdl_activity, "getNativeSurface", "()Landroid/view/Surface;");
jobject raw_surface = env->CallStaticObjectMethod(class_sdl_activity, method_get_native_surface);
ANativeWindow* native_window = ANativeWindow_fromSurface(env, raw_surface);

winHandle = Ogre::StringConverter::toString((int)native_window);

Here’s what I am doing now:

std:string winHandle2 = Ogre::StringConverter::toString((unsigned long);–
Sent from my Android device with K-9 Mail. Please excuse my brevity.