Re: Android Port
Posted: Tue Feb 18, 2014 7:32 pm
Depending on your target hw, you may want to use other terrain options such as: http://irrlicht.sourceforge.net/forum/v ... hp?t=48680
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
param.WindowSize = dimension2d<u32>(0,0); // using 0,0 it will automatically set it to the maximal size
Code: Select all
param.WindowSize = dimension2d<u32>(200,300);
Code: Select all
ANativeWindow* nativeWindow = static_cast<ANativeWindow*>(driver->getExposedVideoData().OGLESAndroid.Window);
int32_t windowWidth = ANativeWindow_getWidth(app->window);
int32_t windowHeight = ANativeWindow_getHeight(app->window);
E:\CPP\irrlicht-ogl-es\examples\27.HelloWorld_Android\bin>call adb logcat Irrlicht:V *:S
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
I/Irrlicht( 1287): Irrlicht Engine version 1.9.0
I/Irrlicht( 1287): Waiting for Android activity window to be created.
I/Irrlicht( 1287): Android command APP_CMD_RESUME
I/Irrlicht( 1287): Android command APP_CMD_INIT_WINDOW
I/Irrlicht( 1287): EGL version: 1.400000
I/Irrlicht( 1287): Using renderer: OpenGL ES 2.0 1566933
I/Irrlicht( 1287): Qualcomm
I/Irrlicht( 1287): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_A
MD_program_binary_Z400 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_B
GRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RG
B8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image
_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_pre
cision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_rgb8_rg
ba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_te
xture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_ver
tex_half_float GL_OES_vertex_type_10_10_10_2 GL_QCOM_binning_control GL_QCOM_dri
ver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_ge
t2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_QCOM_memory_monitor GL
_AMD_compressed_3DC_texture
I/Irrlicht( 1287): Android command APP_CMD_GAINED_FOCUS
I/Irrlicht( 1287): Window size:(240/320)
I/Irrlicht( 1287): Display size:(240/320)
I/Irrlicht( 1287): PNG warning: iCCP: known incorrect sRGB profile
I/Irrlicht( 1287): PNG warning: iCCP: known incorrect sRGB profile
I/Irrlicht( 1287): Loaded texture: media/irrlichtlogo3.png
I/Irrlicht( 1287): Loaded mesh: media/sydney.md2
I/Irrlicht( 1287): Loaded texture: media/img.png
I/Irrlicht( 1287): Android command APP_CMD_PAUSE
I/Irrlicht( 1287): Android command APP_CMD_LOST_FOCUS
I/Irrlicht( 1287): Android command APP_CMD_TERM_WINDOW
I/Irrlicht( 1287): Android command APP_CMD_STOP
I/Irrlicht( 1287): Android command APP_CMD_DESTROY
Code: Select all
if (device->CreationParams.WindowSize.Width == 0 || device->CreationParams.WindowSize.Height == 0)
{
device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
char txt[1000];
sprintf(txt, "##> %d %d\n",device->CreationParams.WindowSize.Width , device->CreationParams.WindowSize.Height );
os::Printer::log(txt, ELL_DEBUG);
}
I/Irrlicht( 2033): Android command APP_CMD_INIT_WINDOW
I/Irrlicht( 2033): ##> 1 1
I/Irrlicht( 2033):
I/Irrlicht( 2033): EGL version: 1.400000
I/Irrlicht( 2033): Using renderer: OpenGL ES 2.0 1566933
I/Irrlicht( 2033): Qualcomm
Code: Select all
Index: CIrrDeviceAndroid.cpp
===================================================================
--- CIrrDeviceAndroid.cpp (revision 4694)
+++ CIrrDeviceAndroid.cpp (working copy)
@@ -211,6 +211,8 @@
{
device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
+ if ( device->CreationParams.WindowSize.Width == 1 && device->CreationParams.WindowSize.Height == 1 )
+ break;
}
device->getContextManager()->initialize(device->CreationParams, device->ExposedVideoData);
@@ -232,6 +234,29 @@
}
device->Initialized = true;
break;
+ case APP_CMD_WINDOW_RESIZED:
+ if (!device->Initialized)
+ {
+ device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
+ device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
+ device->getContextManager()->initialize(device->CreationParams, device->ExposedVideoData);
+ device->getContextManager()->generateSurface();
+ device->getContextManager()->generateContext();
+ device->getContextManager()->activateContext(device->getContextManager()->getContext());
+
+ io::CAndroidAssetFileArchive* assets = new io::CAndroidAssetFileArchive( device->Android->activity->assetManager, false, false);
+ assets->addDirectoryToFileList("");
+ device->FileSystem->addFileArchive(assets);
+ assets->drop();
+
+ device->createDriver();
+
+ if (device->VideoDriver)
+ device->createGUIAndScene();
+
+ device->Initialized = true;
+ }
+ break;
case APP_CMD_TERM_WINDOW:
os::Printer::log("Android command APP_CMD_TERM_WINDOW", ELL_DEBUG);
device->getContextManager()->destroySurface();
Tried but there comes no resize.CuteAlien wrote: You could try if a patch like the following would work:
It just stops (with black screen).I/Irrlicht( 2370): Irrlicht Engine version 1.9.0
I/Irrlicht( 2370): Waiting for Android activity window to be created.
I/Irrlicht( 2370): Android command APP_CMD_RESUME
I/Irrlicht( 2370): Android command APP_CMD_INIT_WINDOW
I/Irrlicht( 2370): Android command APP_CMD_GAINED_FOCUS
Well they were still 1,1 because it didnt go to RESIZE and setted them.If I understand that right you get the correct values for ANativeWindow_getWidth/ANativeWindow_getHeight later on even in the black screen case?
Index: CIrrDeviceAndroid.cpp
===================================================================
--- CIrrDeviceAndroid.cpp (revision 4695)
+++ CIrrDeviceAndroid.cpp (working copy)
@@ -211,6 +211,16 @@
{
device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
+ if ( device->CreationParams.WindowSize.Width == 1 && device->CreationParams.WindowSize.Height == 1 )
+ {
+ device->getContextManager()->initialize(device->CreationParams, device->ExposedVideoData);
+ device->getContextManager()->generateSurface();
+ device->getContextManager()->generateContext();
+ device->getContextManager()->activateContext(device->getContextManager()->getContext());
+ device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
+ device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
+ device->getContextManager()->destroySurface();
+ }
}
device->getContextManager()->initialize(device->CreationParams, device->ExposedVideoData);
Code: Select all
{
if (device->CreationParams.WindowSize.Width == 0 || device->CreationParams.WindowSize.Height == 0)
{
device->sleep(1000, false); // sleeps one second
device->CreationParams.WindowSize.Width = ANativeWindow_getWidth(app->window);
device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);