Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:58:49+00:00 2026-05-25T11:58:49+00:00

I’ve compiled an Android port of Irrlicht from http://gitorious.org/irrlichtandroid/ and made an application to

  • 0

I’ve compiled an Android port of Irrlicht from http://gitorious.org/irrlichtandroid/ and made an application to just load a lo res SkyBox. However, I get unpredictable frame rates. On emulator, fps never goes beyond 5. On my DELL XCD35 with eclair, it usually doesn’t go beyond 10 fps, BUT, in about 1 out of 10 launches, the application runs nice at 60 fps.
Activity is configured for fullscreen landscape mode.

Following is the code, I’ve omitted class header files to keep the post short.

BlueStoneActivity.java

public class BlueStoneActivity extends Activity {
    static {
        System.loadLibrary("irrlicht");
        System.loadLibrary("bluestone");
    }

    GLSurfaceView glView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        glView=new GLSurfaceView(this);
        glView.setRenderer(new IrrlichtRenderer(this));
        setContentView(glView);
        Debug.startMethodTracing("bstone");
        nativeOnCreate();
    }

    @Override
    protected void onDestroy() {
        nativeOnDestroy();
        super.onDestroy();
        Debug.stopMethodTracing();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    public native void nativeOnCreate();
    public native void nativeOnDestroy();
    public native void nativeOnPause();
    public native void nativeOnResume();
    public native void nativeOnResize(int w, int h);
    public native void nativeDrawIteration();
}

IrrlichtRender.java

 public class IrrlichtRenderer implements Renderer {
        BlueStoneActivity activity;

        IrrlichtRenderer(BlueStoneActivity activity){
            this.activity=activity;
        }

        @Override
        public void onDrawFrame(GL10 arg0) {
            activity.nativeDrawIteration();
        }

        @Override
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            activity.nativeOnResize(width, height);
        }

        @Override
        public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) {
        }
    }

JNI wrapper

    #include <jni.h>
#include <android/log.h>
#include "EngineManager.h"
#include "InputManager.h"

game::EngineManager *engine;

int importGLInit();
void importGLDeinit();

#ifndef _Included_com_devin_BlueStoneActivity
#define _Included_com_devin_BlueStoneActivity
#ifdef __cplusplus
extern "C" {
#endif

JNIEXPORT void JNICALL Java_com_devin_BlueStoneActivity_nativeOnCreate
  (JNIEnv *, jobject){
    engine=new game::EngineManager();
}


JNIEXPORT void JNICALL Java_com_devin_BlueStoneActivity_nativeOnDestroy
  (JNIEnv *, jobject){
    engine->device->drop();
    importGLDeinit();
}

JNIEXPORT void JNICALL Java_com_devin_BlueStoneActivity_nativeOnResize
  (JNIEnv *env, jobject thiz, jint width, jint height){
    __android_log_print(ANDROID_LOG_INFO, "NDK", "ONRESIZE - [%d %d]", width, height);
    engine->mWidth=width;
    engine->mHeight=height;
    importGLInit();
    engine->glInit();
}


JNIEXPORT void JNICALL Java_com_devin_BlueStoneActivity_nativeDrawIteration
  (JNIEnv *, jobject){
    engine->drawIteration();
}


JNIEXPORT void JNICALL Java_com_devin_BlueStoneActivity_nativeOnPause
  (JNIEnv *, jobject){
}


JNIEXPORT void JNICALL Java_com_devin_BlueStoneActivity_nativeOnResume
  (JNIEnv *, jobject){

}


#ifdef __cplusplus
}
#endif
#endif

EngineManager.cpp

#include <irrlicht.h>
#include "EngineManager.h"

namespace game {

EngineManager::EngineManager() {
    input=new game::InputManager();
    app=new game::ApplicationManager(input);
}

EngineManager::~EngineManager() {
}

void EngineManager::glInit(){
    device=createDevice( video::EDT_OGLES1, core::dimension2d<u32>(mWidth, mHeight), 16, false, false, false, 0);
    driver=device->getVideoDriver();
    scenegraph=device->getSceneManager();
    guienv=device->getGUIEnvironment();

    app->initApp(device);
}

void EngineManager::drawIteration(){
    device->run();
    driver->beginScene(true, true, app->clearColor);

    app->drawIteration();

    scenegraph->drawAll();
    guienv->drawAll();
    driver->endScene();
}

} /* namespace game */

ApplicationManager.cpp

#include "ApplicationManager.h"
#include "InputManager.h"

namespace game {

ApplicationManager::ApplicationManager(InputManager *in) {
    this->input=in;
}

ApplicationManager::~ApplicationManager() {
}

void ApplicationManager::initApp(IrrlichtDevice *device){
    this->device=device;
    this->driver=device->getVideoDriver();
    this->scenegraph=device->getSceneManager();
    this->guienv=device->getGUIEnvironment();

    // Camera setup
    camera=scenegraph->addCameraSceneNode();
    camera->setPosition(core::vector3df(20.0f, 15.0f, 15.0f));
    camera->setTarget(core::vector3df(0.0f, 0.0f, 0.0f));

    // Sample objects
    bool sceneLoaded=scenegraph->loadScene("/sdcard/BlueStone/redsky.irr");
    if(sceneLoaded)
        __android_log_print(ANDROID_LOG_INFO, "NDK", "SceneLoaded");
    else
        __android_log_print(ANDROID_LOG_INFO, "NDK", "SceneLoaded false");

    clearColor=video::SColor(255, 20, 40, 40);
    statsText=L"START";
    text=guienv->addStaticText(statsText.c_str(), core::recti(50,50,50+100,50+60), true, true, 0, 18, false);
    text->setOverrideColor(video::SColor(255, 64, 20, 20));
}

void ApplicationManager::drawIteration(){
    statsText=L"FPS: ";
    statsText+=driver->getFPS();
    text->setText(statsText.c_str());
}

} /* namespace game */

Please help !!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:58:50+00:00Added an answer on May 25, 2026 at 11:58 am

    Got it finally!!

    It seems Android SDK has a bug. When you try to set screen orientation to landscape from AndroidManifest.xml using ‘android:screenOrientation=”landscape”‘, you get low frame rates on GLSurfaceView.
    Using

    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE );
    

    in code solved all problems. My code now runs at consistent 60fps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.