Android Port

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post 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?
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post 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.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Post 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".
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
stefany
Posts: 58
Joined: Wed Dec 07, 2011 10:50 am

Re: Android Port

Post 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.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post 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.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: Android Port

Post 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.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Android Port

Post by CuteAlien »

IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
sunqian
Posts: 2
Joined: Wed Apr 08, 2015 11:42 am

Re: Android Port

Post 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?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Android Port

Post 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).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply