Page 26 of 26

Re: Android Port

Posted: Sun Dec 28, 2014 8:39 pm
by ent1ty
Does anyone have any advice on integrating Java code within an Irrlicht app? Specifically, I'd like to, for example, hide the navigation bar *before* starting Irrlicht, so that I get the whole screen for rendering. Perhaps I could inherit from the android.app.NativeActivity class and override the needed methods (but always remember to call the original implementation) - would this not break the callbacks the Irrlicht Android device has in place?

Re: Android Port

Posted: Sun Dec 28, 2014 10:29 pm
by Nadro
You can do that without problems, callbacks will work properly eg:

Code: Select all

package com.yourcompany.yourapp;
 
import android.app.Activity;
import android.app.NativeActivity;
import android.os.Bundle;
import android.view.WindowManager;
 
public class YourApp extends NativeActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
 
    static
    {
        try
        {
            System.loadLibrary("YourAppLib");
            // other libs
        }
        catch (UnsatisfiedLinkError err)
        {
            System.err.println("Library failed to load.\n" + err);
        }
    }
}
You can hide a status bar via AndroidManifest.xml.

Re: Android Port

Posted: Mon Dec 29, 2014 8:56 am
by ent1ty
Neat, thanks for the sample code :)

Edit: it looks like the static block for loading libs is unnecessary if you're only loading 1 lib, as the android.app.NativeAcitivy's onCreate method will take care of this for you - just don't forget to specify

Code: Select all

<meta-data android:name="android.app.lib_name" android:value="YourAppLib" />
in AndroidManifest.xml, otherwise the onCreate method tries to load a lib called "main" which fails, unless that's what you called your "YourAppLib".

Re: Android Port

Posted: Sat Feb 07, 2015 1:28 am
by stefany
Hi when i run the hello world example in my phone or in the emulator i get a lot of:

In API LEVEL 10:

Code: Select all

325-333/com.irrlicht.example E/libEGL﹕ call to OpenGL ES API with no current context
In API LEVEL 19:

Code: Select all

1566-1579/com.irrlicht.example E/libEGL﹕ eglSwapBuffers:1051 error 300d (EGL_BAD_SURFACE)
And nothing more than a completly black screen is displayed in both cases.

Re: Android Port

Posted: Wed Feb 11, 2015 12:40 pm
by Nadro
@feelthat
Please use separate threads for report bugs, proposals etc, this thread is related only to pure Android stuff in Irrlicht. I already moved your posts to dedicated topics.

Re: Android Port

Posted: Wed Feb 11, 2015 7:31 pm
by feelthat
sure ok

but where is dedicated topics board

could u paste it for me
Nadro wrote:@feelthat
Please use separate threads for report bugs, proposals etc, this thread is related only to pure Android stuff in Irrlicht. I already moved your posts to dedicated topics.

Re: Android Port

Posted: Wed Feb 11, 2015 8:10 pm
by CuteAlien

Re: Android Port

Posted: Sun Apr 12, 2015 11:00 am
by sunqian
I am developing an AR project with Vuforia on Android, and want to use irrlicht together. But I do not want to use native activity like the irrlicht android example, Cloud I call irrlicht function (written on android native side using c++) from a normal activity via JNI, and how?

Re: Android Port

Posted: Sun Apr 12, 2015 2:59 pm
by Nadro
If you don't want to use native activity you have to rewrite Irrlicht to use GLViewSurface (GLViewSurface will handle all events), however maybe can you use native activity and handle Vuforia via JNI? Second solution is more friendly from Irrlicht perspective, however I'm not sure if Vuforia will allow you to choose this solution (OpenGL stuff built-in Vuforia).