Android Port

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Re: Android Port

Postby ent1ty » Sun Dec 28, 2014 8:39 pm

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!
User avatar
ent1ty
Competition winner
 
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Postby Nadro » Sun Dec 28, 2014 10:29 pm

You can do that without problems, callbacks will work properly eg:

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

Re: Android Port

Postby ent1ty » Mon Dec 29, 2014 8:56 am

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
cpp 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!
User avatar
ent1ty
Competition winner
 
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Android Port

Postby hernanex3 » Sat Feb 07, 2015 1:28 am

Hi when i run the hello world example in my phone or in the emulator i get a lot of:

In API LEVEL 10:
cpp Code: Select all
325-333/com.irrlicht.example E/libEGL﹕ call to OpenGL ES API with no current context


In API LEVEL 19:
cpp 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.
Be happy happy!
hernanex3
 
Posts: 58
Joined: Wed Dec 07, 2011 10:50 am

Re: Android Port

Postby Nadro » Wed Feb 11, 2015 12:40 pm

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

Re: Android Port

Postby feelthat » Wed Feb 11, 2015 7:31 pm

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.
feelthat
 
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: Android Port

Postby CuteAlien » Wed Feb 11, 2015 8:10 pm

@feelthat: It's here: viewtopic.php?f=2&t=50586
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8291
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Android Port

Postby sunqian » Sun Apr 12, 2015 11:00 am

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?
sunqian
 
Posts: 2
Joined: Wed Apr 08, 2015 11:42 am

Re: Android Port

Postby Nadro » Sun Apr 12, 2015 2:59 pm

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

Previous

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest