Using OGRE with Qt for Android
-
Hi everyone!
Has anyone used OGRE in an Android application? In OGRE webpage I found a tutorial to use OGRE in a QWindow and it works perfectly for Linux-x86 since I have dynamic link libraries but for Android many changes must be done.
Some of them are installing the plugins manually (not with plugin.cfg file) but I still don't know how to access to the resources from Assets for OGRE and what is missing because my app crashes after trying to create a render window.
Any help, example or whatever would be really appreciated :)
Thanks,
Fernando -
Here is my Qt project. Could someone give a hint if I'm doing something wrong?
You just need to set the path to plugins.cfg and resources.cfg for linux (in QTOgreWindow.cpp) and include and libraries path for Android in .pro.You also need OGRE libraries and sources for headers and materials, models, etc.
-
OKs.. I had to read a lot to find the cause of the problem.
I have to set parameters first with the right values. From OGRE webpage I have the two following lines but I found in this forum that winId() is useless for Android and I have to get ANativeWindow_fromSurface function but I don't know how to do that from my Qt application.
parameters["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)(this->winId())); parameters["parentWindowHandle"] = Ogre::StringConverter::toString((unsigned long)(this->winId()));
After getting the right external window handle, the following line should be ok and everything should work.
m_ogreWindow = m_ogreRoot->createRenderWindow("QT Window", this->width(), this->height(), false, ¶meters);
Could any Android developer explain me how to how to get this? I need to use QAndroidJniObject class but I'm really lost,
Thanks,
Fernando