当前位置: 动力学知识库 > 问答 > 编程问答 >

graphics - irrlicht android on opengl es 2.0 driver

问题描述:

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?

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: