I'm looking for an input library that gets touch input from ios and android. The OIS touch input from the samplebrowser doesn't always work very well. Are there other libs for android and ios that can do (multi-)touch input? Have you experience with sdl touch input and ogre?
Or do I have to use the native ios and android libs? That would be a bit more complicated than having a lib that can handle both systems...
Touch input on mobile devices
-
- Kobold
- Posts: 37
- Joined: Tue Aug 19, 2014 10:46 am
- x 5
Re: Touch input on mobile devices
The easy way is a interface and some Implementation.
such as.
I copy MyGui's Windows inputManager class to drive this interface.
at windows callback __static_WndProc
like this:
at android i drive this use java call jni to do this:
java:
need this class :
public class DishSurfaceView extends SurfaceView
and jni call the correct function:
I'm not impl the ios part.But It's just simple.
such as.
Code: Select all
class IEGLView
{
public:
virtual ~IEGLView(){}
public:
virtual void surfaceChanged(int _width,int _height) = 0;
public:
virtual void queueAccelerometer(float _x,float _y,float _z,float _t) = 0;
public:
virtual void keyPress(int _key, int _text) = 0;
virtual void keyRelease(int _key) = 0;
public:
virtual void mouseMove(int _absx, int _absy, int _absz) = 0;
virtual void mousePress(int _absx, int _absy, int _id) = 0;
virtual void mouseRelease(int _absx, int _absy, int _id) = 0;
public:
virtual void touchMoved( unsigned int num, int ids[], float xs[], float ys[] ) = 0;
virtual void touchPressed( unsigned int num, int ids[], float xs[], float ys[] ) = 0;
virtual void touchReleased( unsigned int num, int ids[], float xs[], float ys[] ) = 0;
virtual void touchCancelled( unsigned int num, int ids[], float xs[], float ys[] ) = 0;
};
at windows callback __static_WndProc
like this:
Code: Select all
case WM_MOUSEWHEEL:
old_z += GET_HIWORD(wParam);
msInputManager->mouseMove(old_x, old_y, old_z);
java:
need this class :
public class DishSurfaceView extends SurfaceView
Code: Select all
public boolean onTouchEvent(final MotionEvent pMotionEvent)
{
final int pointerNumber = pMotionEvent.getPointerCount();
final int[] ids = new int[pointerNumber];
final float[] xs = new float[pointerNumber];
final float[] ys = new float[pointerNumber];
for (int i = 0; i < pointerNumber; i++)
{
ids[i] = pMotionEvent.getPointerId(i);
xs[i] = pMotionEvent.getX(i);
ys[i] = pMotionEvent.getY(i);
}
switch (pMotionEvent.getAction() & MotionEvent.ACTION_MASK)
{
case MotionEvent.ACTION_POINTER_DOWN:
final int indexPointerDown = pMotionEvent.getAction() >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
final int idPointerDown = pMotionEvent.getPointerId(indexPointerDown);
final float xPointerDown = pMotionEvent.getX(indexPointerDown);
final float yPointerDown = pMotionEvent.getY(indexPointerDown);
Runnable _runnable1 = new Runnable()
{
@Override
public void run()
{
DishNative.handleActionDown(idPointerDown, xPointerDown, yPointerDown);
}
};
this.queueEvent(_runnable1);
break;
Code: Select all
public class DishNative
{
public native static void create(AssetManager mgr);
public native static void destroy();
public native static void initWindow(Surface surface);
public native static void termWindow();
public native static void renderOneFrame();
public native static void queueAccelerometer(float _x,float _y,float _z,float _time);
public native static void surfaceChanged(int width, int height);
public native static void handleActionDown(final int pID, final float pX, final float pY);
public native static void handleActionMove(final int[] pIDs, final float[] pXs, final float[] pYs);
public native static void handleActionUp(final int pID, final float pX, final float pY);
public native static void handleActionCancel(final int[] pIDs, final float[] pXs, final float[] pYs);
public native static void onKeyDown( int pKeyCode, int _text);
public native static void onKeyUp( int pKeyCode, int _text);
public native static void onPause();
public native static void onResume();
public native static String nativeGetContentText();
public native static void insertText(final String pText);
}
Code: Select all
extern "C"
{
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
dish_log_lazy_init();
dish_log("JNI_OnLoad.");
dish::JniHelper& _jniHelper = dish::JniHelperManager::Instance();
_jniHelper.setJavaVM(vm);
return JNI_VERSION_1_4;
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_create(JNIEnv* env, jobject obj, jobject assetManager)
{
dish_log("DishNative_create.");
AAssetManager* _AAssetManager = AAssetManager_fromJava(env, assetManager);
dish::UtilFile& _file = dish::UtilFileManager::Instance();
_file.initialize();
dish::OgreRender& _render = dish::OgreRenderManager::Instance();
static_cast<dish::UtilFileAndroid*>(&_file)->setAAssetManager(_AAssetManager);
static_cast<dish::OgreRenderAndroid*>(&_render)->setAAssetManager(_AAssetManager);
dish::UtilLua& _lua = dish::UtilLuaManager::Instance();
_lua.initialize();
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_initWindow(JNIEnv* env, jobject obj, jobject surface)
{
dish_log("DishNative_initWindow.");
dish::OgreRender& _render = dish::OgreRenderManager::Instance();
Ogre::RenderWindow* _renderWindow=_render.getRenderWindow();
ANativeWindow* _ANativeWindow = ANativeWindow_fromSurface(env, surface);
static_cast<dish::OgreRenderAndroid*>(&_render)->setANativeWindow(_ANativeWindow);
if (!_renderWindow)
{
if (surface)
{
try
{
// create the application instance
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.setHandler(env);
_app.initialize();
_app.create();
_app.run();
dish_log("dish::ImplApplication end.");
}
catch (std::exception& e)
{
dish_logF("A untreated exception occur:"<<e.what());
}
}
else
{
dish_logE("The android surface is invalid");
}
}
else
{
_render.createRenderWindow();
}
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_termWindow(JNIEnv* env, jobject obj)
{
dish::OgreRender& _render = dish::OgreRenderManager::Instance();
Ogre::RenderWindow* _renderWindow = _render.getRenderWindow();
static_cast<Ogre::AndroidEGLWindow*>(_renderWindow)->_destroyInternalResources();
dish_log("DishNative_termWindow");
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_destroy(JNIEnv* env, jobject obj)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.destroy();
dish_log("DishNative_destroy");
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_renderOneFrame(JNIEnv* env, jobject obj)
{
dish::JniHelper& _jniHelper = dish::JniHelperManager::Instance();
dish::OgreRender& _render = dish::OgreRenderManager::Instance();
JavaVM* _javaVM = _jniHelper.getJavaVM();
Ogre::RenderWindow* _renderWindow = _render.getRenderWindow();
if(_renderWindow != NULL && _renderWindow->isActive())
{
try
{
if(_javaVM->AttachCurrentThread(&env, NULL) < 0)
{
return;
}
_renderWindow->windowMovedOrResized();
_render.renderOneFrame();
//for test
//_javaVM->DetachCurrentThread();
}
catch(Ogre::RenderingAPIException ex)
{
dish_logF("A untreated exception occur:"<<ex.getFullDescription());
}
}
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_queueAccelerometer(JNIEnv* env, jobject obj,jfloat _x,jfloat _y,jfloat _z,jfloat _t)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.queueAccelerometer(_x,_y,_z,_t);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_surfaceChanged(JNIEnv* env, jobject obj,jint _width,jint _height)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.surfaceChanged(_width,_height);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_handleActionDown(JNIEnv* env, jobject obj,jint pID, jfloat pX, jfloat pY)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.mousePress(pX, pY, MyGUI::MouseButton::Left);
//
_app.touchPressed(1,&pID, &pX, &pY);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_handleActionMove(JNIEnv* env, jobject obj,jintArray pIDs, jfloatArray pXs, jfloatArray pYs)
{
int size = env->GetArrayLength(pIDs);
jint id[size];
jfloat x[size];
jfloat y[size];
env->GetIntArrayRegion(pIDs, 0, size, id);
env->GetFloatArrayRegion(pXs, 0, size, x);
env->GetFloatArrayRegion(pYs, 0, size, y);
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.mouseMove(x[0], y[0], 0);
//
_app.touchMoved(size,id, x, y);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_handleActionUp(JNIEnv* env, jobject obj,jint pID, jfloat pX, jfloat pY)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.mouseRelease(pX, pY, MyGUI::MouseButton::Left);
//
_app.touchReleased(1,&pID, &pX, &pY);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_handleActionCancel(JNIEnv* env, jobject obj,jintArray pIDs, jfloatArray pXs, jfloatArray pYs)
{
int size = env->GetArrayLength(pIDs);
jint id[size];
jfloat x[size];
jfloat y[size];
env->GetIntArrayRegion(pIDs, 0, size, id);
env->GetFloatArrayRegion(pXs, 0, size, x);
env->GetFloatArrayRegion(pYs, 0, size, y);
//
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.touchCancelled(size,id, x, y);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_onKeyDown(JNIEnv* env, jobject obj,jint pKeyCode, jint _text)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.keyPress(pKeyCode,_text);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_onKeyUp(JNIEnv* env, jobject obj,jint pKeyCode, jint _text)
{
dish::ImplApplication& _app = dish::ImplApplicationManager::Instance();
_app.keyRelease(pKeyCode);
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_onPause(JNIEnv* env, jobject obj)
{
dish::AppDelegate& _app = dish::AppDelegateManager::Instance();
_app.enterBackgroundImpl();
dish_log("DishNative_onPause");
}
JNIEXPORT void JNICALL Java_org_dish_ogre_DishNative_onResume(JNIEnv* env, jobject obj)
{
dish::AppDelegate& _app = dish::AppDelegateManager::Instance();
_app.enterForegroundImpl();
dish_log("DishNative_onResume");
}
JNIEXPORT jstring JNICALL Java_org_dish_ogre_DishNative_nativeGetContentText(JNIEnv* env, jobject obj)
{
MyGUI::InputManager& _input = MyGUI::InputManager::getInstance();
MyGUI::Widget* _widget = _input.getMouseFocusWidget();
dish_log("DishNative_nativeGetContentText");
if (_widget)
{
const std::string& _typeName = _widget->getTypeName();
if (_typeName == "EditBox")
{
MyGUI::EditBox* _editBox = static_cast<MyGUI::EditBox*>(_widget);
MyGUI::UString _utext = _editBox->getTextSelection();
const std::string& _text = _utext.asUTF8();
return env->NewStringUTF(_text.c_str());
}
else if(_typeName == "TextBox")
{
MyGUI::TextBox* _textBox = static_cast<MyGUI::TextBox*>(_widget);
MyGUI::UString _utext = _textBox->getCaption();
const std::string& _text = _utext.asUTF8();
return env->NewStringUTF(_text.c_str());
}
}
return 0;
}
JNIEXPORT jstring JNICALL Java_org_dish_ogre_DishNative_insertText(JNIEnv* env, jobject obj,jstring _text)
{
dish::JniHelper& _jh = dish::JniHelperManager::Instance();
std::string _textC = _jh.jstring2string(_text);
//
MyGUI::InputManager& _input = MyGUI::InputManager::getInstance();
MyGUI::Widget* _widget = _input.getMouseFocusWidget();
dish_log("DishNative_insertText");
if (_widget)
{
const std::string& _typeName = _widget->getTypeName();
if (_typeName == "EditBox")
{
MyGUI::EditBox* _editBox = static_cast<MyGUI::EditBox*>(_widget);
_editBox->setCaption(_textC);
}
else if(_typeName == "TextBox")
{
MyGUI::TextBox* _textBox = static_cast<MyGUI::TextBox*>(_widget);
_textBox->setCaption(_textC);
}
}
}
};
-
- Gnoblar
- Posts: 9
- Joined: Sun Jan 18, 2015 6:39 pm
Re: Touch input on mobile devices
Hi Longer,
It looks nice. Where can I download the dish class or API?
Thanks.
-Shawn
It looks nice. Where can I download the dish class or API?
Thanks.
-Shawn
-
- Kobold
- Posts: 37
- Joined: Tue Aug 19, 2014 10:46 am
- x 5
Re: Touch input on mobile devices
The repository at here.
https://bitbucket.org/typedef-typename/fight-flag
https://bitbucket.org/typedef-typename/dish
I'm not use cmake.But prepare two version windows and android.
dish is I collect and modify third party lib.
fight-flag is the impl project.
vs2012 to compile at win.
gcc, ant, eclipse to android.
If you need the dish sdk:
dish/build/build_and_make_sdk_all.bat.
Note: It's big.
fight-flag\script\bat\client_windows have some command to build in windows.
fight-flag\script\bat\client_android have some command to build in android.
fight-flag\src\client\Platform\Android\DishAPKFileSystemArchive.h
I use the zip file system to fix the ogre APKFileSystemArchive slow file open process.
MyGUI support bmfont,chinese word wrap.
It is good I think.
I deal with the network now,but don't have good idea.
The ReadMe have some chinese,sorry.
Tell me if have any suggest.
The input model at:
Interface:
fight-flag\src\shared\Interface\Activity
fight-flag\src\shared\Impl\Activity
windows impl:
c++ fight-flag\src\client\Platform\Windows
android impl:
c++ fight-flag\src\client\Platform\Android
java fight-flag\proj\android\src\org\dish\ogre
not ios,because of pool to buy a mac.
https://bitbucket.org/typedef-typename/fight-flag
https://bitbucket.org/typedef-typename/dish
I'm not use cmake.But prepare two version windows and android.
dish is I collect and modify third party lib.
fight-flag is the impl project.
vs2012 to compile at win.
gcc, ant, eclipse to android.
If you need the dish sdk:
dish/build/build_and_make_sdk_all.bat.
Note: It's big.
fight-flag\script\bat\client_windows have some command to build in windows.
fight-flag\script\bat\client_android have some command to build in android.
fight-flag\src\client\Platform\Android\DishAPKFileSystemArchive.h
I use the zip file system to fix the ogre APKFileSystemArchive slow file open process.
MyGUI support bmfont,chinese word wrap.
It is good I think.
I deal with the network now,but don't have good idea.
The ReadMe have some chinese,sorry.
Tell me if have any suggest.
The input model at:
Interface:
fight-flag\src\shared\Interface\Activity
fight-flag\src\shared\Impl\Activity
windows impl:
c++ fight-flag\src\client\Platform\Windows
android impl:
c++ fight-flag\src\client\Platform\Android
java fight-flag\proj\android\src\org\dish\ogre
not ios,because of pool to buy a mac.
-
- Gnoblar
- Posts: 9
- Joined: Sun Jan 18, 2015 6:39 pm
Re: Touch input on mobile devices
Hi Longer,
Thanks so much for sharing it.
How is the performance to use dish api with Ogre? I mean whether it's fast to switch from Ogre and the dish interface?
Is it possible to use it with CEGUI?
For the network implementation, I recommend socketcc that can work both in android and ios.
Thanks.
Shawn
Thanks so much for sharing it.
How is the performance to use dish api with Ogre? I mean whether it's fast to switch from Ogre and the dish interface?
Is it possible to use it with CEGUI?
For the network implementation, I recommend socketcc that can work both in android and ios.
Thanks.
Shawn
-
- Kobold
- Posts: 37
- Joined: Tue Aug 19, 2014 10:46 am
- x 5
Re: Touch input on mobile devices
My demo,chinese network disk,I don't know if it is can work:
http://yun.baidu.com/share/link?shareid ... 3124767259
I submit a cegui and it's dependent lib name prce to my project,at dish.
I compile it to windows and android.But not demo now.It is possible have some link error when use in project.
First,the mygui it is a good gui lib.
But need some change about font,especially chinese,i add the bmfont support to it.so i can only use the char which i need like cocos2d.It's works well.
Mygui need a better layout edit and batch image support like plist,The official tool work well,but i can not use it to package lot of image all in one.
Ogre and mygui work at my phone(GALAXY GT-S7568) very well.
At 2015.1.25~26 I code a birthday card to my best friend,use the lib and tools.Some Torchlight2 and Ogre official resource.
Launch the demo use 4 second.The performance come from my self android APKFileSystemArchive.The Ogre official so slow.
At my demo,I not use the mygui TTF font because it is slow to init chinese font.I use dish\src\MyGUI\MyGUIEngine\include\MyGUI_ResourceBMFont.h. and bmfont tools.
dish it is only my namespase,it is nothing.
The main job it is launch the ogre rendering and gui system.I think exchange to cegui it is easy.I spend one day night,and i have the cegui lib already.
cegui's layout edit it is better then mygui really.I will code a cegui demo later.
Network i use libevent in client to server.server to server use zmq in my plan.I need a server cluster.I'm eating book.
http://yun.baidu.com/share/link?shareid ... 3124767259
I submit a cegui and it's dependent lib name prce to my project,at dish.
I compile it to windows and android.But not demo now.It is possible have some link error when use in project.
First,the mygui it is a good gui lib.
But need some change about font,especially chinese,i add the bmfont support to it.so i can only use the char which i need like cocos2d.It's works well.
Mygui need a better layout edit and batch image support like plist,The official tool work well,but i can not use it to package lot of image all in one.
Ogre and mygui work at my phone(GALAXY GT-S7568) very well.
At 2015.1.25~26 I code a birthday card to my best friend,use the lib and tools.Some Torchlight2 and Ogre official resource.
Launch the demo use 4 second.The performance come from my self android APKFileSystemArchive.The Ogre official so slow.
At my demo,I not use the mygui TTF font because it is slow to init chinese font.I use dish\src\MyGUI\MyGUIEngine\include\MyGUI_ResourceBMFont.h. and bmfont tools.
dish it is only my namespase,it is nothing.
The main job it is launch the ogre rendering and gui system.I think exchange to cegui it is easy.I spend one day night,and i have the cegui lib already.
cegui's layout edit it is better then mygui really.I will code a cegui demo later.
Network i use libevent in client to server.server to server use zmq in my plan.I need a server cluster.I'm eating book.
-
- Gnoblar
- Posts: 9
- Joined: Sun Jan 18, 2015 6:39 pm
Re: Touch input on mobile devices
Hi Longer,
Your demo looks great with so many particles and nice touch control. The switch between Ogre and the IME is very fast. But you have not showed how to display the input back on the Ogre GUI screen. Maybe JNI can do it.
MyGUI is nice but not as mature as CEGUI. I am looking forward to seeing your demo in CEGUI.
It will be even better if you can share some codes
Really appreciated.
-Shawn
Your demo looks great with so many particles and nice touch control. The switch between Ogre and the IME is very fast. But you have not showed how to display the input back on the Ogre GUI screen. Maybe JNI can do it.
MyGUI is nice but not as mature as CEGUI. I am looking forward to seeing your demo in CEGUI.
It will be even better if you can share some codes

Really appreciated.
-Shawn
-
- Kobold
- Posts: 37
- Joined: Tue Aug 19, 2014 10:46 am
- x 5
Re: Touch input on mobile devices
The IME not callback carry string because it's a bug for touch event.
TextBox not need for open the IME.I fix it now.
only EditBox need get and set string
The cegui lib compile for android is finish I think.In my new dish lib repositories.
dish\build\cegui
To build it run :
dish\build\cegui\proj.android\build.bat
dish\build\cegui\proj.windows\build.bat
and run dish\build\cegui\make_sdk.bat to build the sdk to
dish\sdk\cegui
the same for all my lib.
I change some to make cegui to support android.
1.dish\src\cegui-0.8.4\cegui\src\Exceptions.cpp
android not have execinfo.h and the cpp file not need this actually.
2.glsles support.
I think the CEGUIOgreRenderer is rough to use.Today i only simpleness fix some code to support gles2.
The shader source code put it to resource file it's better than code in cpp file.I need some time to improve.
But now it's work well in gles2.
binding
TextBox not need for open the IME.I fix it now.
Code: Select all
void ApplicationAndroid::mousePress(int _absx, int _absy, int _id)
{
this->computeMouseMove();
this->injectMousePress(_absx, _absy, MyGUI::MouseButton::Enum(_id));
MyGUI::InputManager& _input = MyGUI::InputManager::getInstance();
MyGUI::Widget* _widget = _input.getMouseFocusWidget();
if (_widget)
{
const std::string& _typeName = _widget->getTypeName();
if ((_typeName == "EditBox"/*||_typeName == "TextBox"*/))
{
//dish_log("_widget->getTypeName():"<<_widget->getTypeName());
UtilJni::openIMEKeyboard();
}
}
}
Code: Select all
JNIEXPORT jstring JNICALL Java_org_dish_ogre_DishNative_nativeGetContentText(JNIEnv* env, jobject obj)
{
MyGUI::InputManager& _input = MyGUI::InputManager::getInstance();
MyGUI::Widget* _widget = _input.getMouseFocusWidget();
dish_log("DishNative_nativeGetContentText");
if (_widget)
{
const std::string& _typeName = _widget->getTypeName();
if (_typeName == "EditBox")
{
MyGUI::EditBox* _editBox = static_cast<MyGUI::EditBox*>(_widget);
MyGUI::UString _utext = _editBox->getTextSelection();
const std::string& _text = _utext.asUTF8();
return env->NewStringUTF(_text.c_str());
}
//else if(_typeName == "TextBox")
//{
// MyGUI::TextBox* _textBox = static_cast<MyGUI::TextBox*>(_widget);
// MyGUI::UString _utext = _textBox->getCaption();
// const std::string& _text = _utext.asUTF8();
// return env->NewStringUTF(_text.c_str());
//}
}
return 0;
}
JNIEXPORT jstring JNICALL Java_org_dish_ogre_DishNative_insertText(JNIEnv* env, jobject obj,jstring _text)
{
dish::JniHelper& _jh = dish::JniHelperManager::Instance();
std::string _textC = _jh.jstring2string(_text);
//
MyGUI::InputManager& _input = MyGUI::InputManager::getInstance();
MyGUI::Widget* _widget = _input.getMouseFocusWidget();
dish_log("DishNative_insertText");
if (_widget)
{
const std::string& _typeName = _widget->getTypeName();
if (_typeName == "EditBox")
{
MyGUI::EditBox* _editBox = static_cast<MyGUI::EditBox*>(_widget);
_editBox->setCaption(_textC);
}
//else if(_typeName == "TextBox")
//{
// MyGUI::TextBox* _textBox = static_cast<MyGUI::TextBox*>(_widget);
// _textBox->setCaption(_textC);
//}
}
}
dish\build\cegui
To build it run :
dish\build\cegui\proj.android\build.bat
dish\build\cegui\proj.windows\build.bat
and run dish\build\cegui\make_sdk.bat to build the sdk to
dish\sdk\cegui
the same for all my lib.
I change some to make cegui to support android.
1.dish\src\cegui-0.8.4\cegui\src\Exceptions.cpp
Code: Select all
#if defined(_MSC_VER)
#include <dbghelp.h>
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
#if defined(__ANDROID__)
//We no need execinfo.h file here.
#else
#include <execinfo.h>
#endif
#include <dlfcn.h>
#include <cxxabi.h>
#include <cstdlib>
#endif
2.glsles support.
I think the CEGUIOgreRenderer is rough to use.Today i only simpleness fix some code to support gles2.
The shader source code put it to resource file it's better than code in cpp file.I need some time to improve.
But now it's work well in gles2.
Code: Select all
S_glsles_compat_vs_source
#version 100
precision highp int;
precision highp float;
uniform mat4 modelViewPerspMatrix;
attribute vec4 vertex;
attribute vec4 uv0;
attribute vec4 colour;
varying vec4 outUV0;
varying vec4 outColor;
/*
Basic texturing vertex program for GLSL ES
*/
void main()
{
gl_Position = modelViewPerspMatrix * vertex;
outUV0 = uv0;
outColor = colour;
}
S_glsles_compat_ps_source
#version 100
precision highp int;
precision highp float;
uniform sampler2D texture0;
varying vec4 outUV0;
varying vec4 outColor;
/*
Basic texturing fragment program for GLSL ES
*/
void main()
{
vec4 cl = outColor;
vec4 tc = texture2D(texture0, outUV0.xy);
vec4 fc = outColor * tc;
gl_FragColor = fc;
}
Code: Select all
else if(d_pimpl->d_useGLSLES)
{
d_pimpl->d_vertexShaderParameters->
setNamedConstant("modelViewPerspMatrix", getWorldViewProjMatrix());
d_pimpl->d_renderSystem->
bindGpuProgramParameters(Ogre::GPT_VERTEX_PROGRAM,
d_pimpl->d_vertexShaderParameters,
Ogre::GPV_ALL);
}
-
- Gnoblar
- Posts: 9
- Joined: Sun Jan 18, 2015 6:39 pm
Re: Touch input on mobile devices
I am studying your code now. Looks quite complicated but it should be a nice one.
I will let you know if I meet any problem.
I will let you know if I meet any problem.