Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
mchiasson
Posts: 12 Joined: Wed Feb 01, 2012 12:29 pm
Location: Ottawa, Ontario, Canada
Post
by mchiasson » Sun Jan 20, 2013 5:33 am
My very first contribution to irrlicht! ^_^
Code: Select all
Index: source/Irrlicht/CIrrDeviceAndroid.cpp
===================================================================
--- source/Irrlicht/CIrrDeviceAndroid.cpp (revision 4446)
+++ source/Irrlicht/CIrrDeviceAndroid.cpp (working copy)
@@ -90,15 +90,17 @@
// Create cursor control
CursorControl = new CCursorControl(this);
+ // This step needs to be done before creating the driver for Android in order to be able to load the GLES2 shaders from the media folder
+ io::CAndroidAssetFileArchive *assets = io::createAndroidAssetFileArchive(false, false);
+ assets->addDirectory("media");
+ FileSystem->addFileArchive(assets);
+
// Create the driver.
createDriver();
if (VideoDriver)
createGUIAndScene();
- io::CAndroidAssetFileArchive *assets = io::createAndroidAssetFileArchive(false, false);
- assets->addDirectory("media");
- FileSystem->addFileArchive(assets);
// TODO
//
// if engine->app->savedState is not NULL then use postEventFromUser()
Index: source/Irrlicht/COGLES2Driver.cpp
===================================================================
--- source/Irrlicht/COGLES2Driver.cpp (revision 4446)
+++ source/Irrlicht/COGLES2Driver.cpp (working copy)
@@ -26,6 +26,9 @@
#else
#include <EGL/egl.h>
#include <GLES2/gl2.h>
+#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
+#include "android_native_app_glue.h"
+#endif
#endif
namespace irr
@@ -68,6 +71,9 @@
EglDisplay = eglGetDisplay((NativeDisplayType)ExposedData.OpenGLLinux.X11Display);
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
Device = device;
+#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
+ EglWindow = ((struct android_app *)(params.PrivateData))->window;
+ EglDisplay = EGL_NO_DISPLAY;
#endif
#ifdef EGL_VERSION_1_0
if (EglDisplay == EGL_NO_DISPLAY)
Index: include/IrrCompileConfig.h
===================================================================
--- include/IrrCompileConfig.h (revision 4446)
+++ include/IrrCompileConfig.h (working copy)
@@ -206,6 +206,8 @@
#ifndef IRR_OGLES2_SHADER_PATH
#ifdef _IRR_COMPILE_WITH_IPHONE_DEVICE_
#define IRR_OGLES2_SHADER_PATH ""
+#elif defined(_IRR_ANDROID_PLATFORM_)
+#define IRR_OGLES2_SHADER_PATH "media/Shaders/"
#else
#define IRR_OGLES2_SHADER_PATH "../../media/Shaders/"
#endif
this is for
https://irrlicht.svn.sourceforge.net/sv ... es/ogl-es/
Last edited by
mchiasson on Sun Jan 20, 2013 6:38 pm, edited 2 times in total.
Nadro
Posts: 1648 Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland
Post
by Nadro » Sun Jan 20, 2013 12:07 pm
Thanks for this patch. I'll test them today or tomorrow and next apply them to core
mchiasson
Posts: 12 Joined: Wed Feb 01, 2012 12:29 pm
Location: Ottawa, Ontario, Canada
Post
by mchiasson » Sun Jan 20, 2013 6:27 pm
No problem Nadro.
I actually made one last modification to IrrCompileConfig.h
Code: Select all
Index: include/IrrCompileConfig.h
===================================================================
--- include/IrrCompileConfig.h (revision 4446)
+++ include/IrrCompileConfig.h (working copy)
@@ -206,6 +206,8 @@
#ifndef IRR_OGLES2_SHADER_PATH
#ifdef _IRR_COMPILE_WITH_IPHONE_DEVICE_
#define IRR_OGLES2_SHADER_PATH ""
+#elif defined(_IRR_ANDROID_PLATFORM_)
+#define IRR_OGLES2_SHADER_PATH "media/Shaders/"
#else
#define IRR_OGLES2_SHADER_PATH "../../media/Shaders/"
#endif
I realized too late that I was breaking Linux Desktop OpenGL-ES2 support. This way, both platform will work.
mchiasson
Posts: 12 Joined: Wed Feb 01, 2012 12:29 pm
Location: Ottawa, Ontario, Canada
Post
by mchiasson » Sun Jan 20, 2013 6:36 pm
Same with COGLES2Driver.cpp. Should only include android_native_app_glue.h when we're on Android. This way, I'm not breaking Linux Desktop GLES2 support.
Code: Select all
Index: source/Irrlicht/COGLES2Driver.cpp
===================================================================
--- source/Irrlicht/COGLES2Driver.cpp (revision 4446)
+++ source/Irrlicht/COGLES2Driver.cpp (working copy)
@@ -26,6 +26,9 @@
#else
#include <EGL/egl.h>
#include <GLES2/gl2.h>
+#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
+#include "android_native_app_glue.h"
+#endif
#endif
namespace irr
@@ -68,6 +71,9 @@
EglDisplay = eglGetDisplay((NativeDisplayType)ExposedData.OpenGLLinux.X11Display);
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
Device = device;
+#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
+ EglWindow = ((struct android_app *)(params.PrivateData))->window;
+ EglDisplay = EGL_NO_DISPLAY;
#endif
#ifdef EGL_VERSION_1_0
if (EglDisplay == EGL_NO_DISPLAY)
mchiasson
Posts: 12 Joined: Wed Feb 01, 2012 12:29 pm
Location: Ottawa, Ontario, Canada
Post
by mchiasson » Sun Jan 20, 2013 6:42 pm
I updated my first patch in my first post accordingly.
To test this on Android, I used the example #08, dropped the entire media folder in the assets folder, used Android SDK r21 and Android NDK android-ndk-r8d. I did not submit my modified Android.mk into this patch because I do not know which NDK you guys are using.
Nadro
Posts: 1648 Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland
Post
by Nadro » Mon Jan 21, 2013 6:59 pm
Thanks for update. I'll test it on the latest NDK + SDK.
Nadro
Posts: 1648 Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland
Post
by Nadro » Thu Apr 18, 2013 5:12 am
Patch applied to ogl-es.