irrlicht android on opengl es 2.0 driver
Asked Answered
K

1

8

I'm learning to use Irrlicht on Android. Last month I have been working on the driver based on openGL es 1.0, which worked well (I use 1.0 because when I tried to run the example based on driver es 2.0 the result turned out to be very strange). Loading mesh is all right, but what confuses me is that the texture cannot be shown correctly. Render code is as below:

smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();

stringc myDir = gSdCardPath;
myDir += "/Irrlicht";
device->getFileSystem()->changeWorkingDirectoryTo(myDir.c_str());

stringc sydneyFilename = "/Irrlicht/sydney.md2";
mesh=smgr->getMesh("/sdcard/Irrlicht/sydney.md2");
if (!mesh) {
    device->drop();
    __android_log_print(ANDROID_LOG_INFO, "Irrlicht", "cannot getMesh");
    return;
}
nodeSydney = smgr->addAnimatedMeshSceneNode(mesh);

if (nodeSydney) {
    nodeSydney->setMaterialFlag(EMF_LIGHTING, false);
    nodeSydney->setMD2Animation(scene::EMAT_STAND);
    stringc sydneyTextureFilename = "/Irrlicht/sydney.bmp";
    texture=driver->getTexture("/sdcard/Irrlicht/sydney.bmp");
    if (!texture)
        LOGI("sydney.bmp load failed");
    else{
        nodeSydney->setMaterialTexture(0,texture);
        LOGI("sydney.bmp load successfully");
    }
    nodeSydney->setPosition(core::vector3df(0.0f,0.0f,0.0f));
}
smgr->addCameraSceneNode(0, vector3df(0, 10, -50), vector3df(0, 5, 0));

receiver = new AndroidEventReceiver(context);
device->setEventReceiver(receiver);

Everything is the same as the original code except the removed comments and the position of the nodes and I'm also sure that files needed in the code are on the correct directory.

So can anyone who have the experience using Irrlicht on Android please help me?

Krall answered 23/4, 2013 at 8:26 Comment(1)
Well, it would probably be better to describe what "not correctly" means in your context. They do not display at all, they are upside down, eerie colors? A picture would probably be also handy.Inertia
S
1

We faced the same issue.The length of the uniform names is the only problem. Uniform names will be stored in SBuiltinShaderUniformNames[] array in COGLES2FixedpipelineShader,COGLES2NormalMapShader etc. classes. Shorten the uniform names to the length of below 10 characters.

Edit: Shortening uniform names will resolve this issue.

Scent answered 19/11, 2014 at 6:14 Comment(3)
Thank you for answering. Up vote your answer to let more people who face the same issue know why and how to do :)Krall
If your issue has been resolved by shortening uniform names, mark this as Correct answer to make people clear.Scent
Sorry but I don't know whether that's right, I abandoned Irrlicht on Android and used libgdx instead. If anyone who uses your method and finds it works, I will mark this as correct answer.Krall

© 2022 - 2024 — McMap. All rights reserved.