iOS - OGRE V1.9 Mipmaps black

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
deepchand
Gnoblar
Posts: 6
Joined: Sat May 04, 2013 12:41 pm

iOS - OGRE V1.9 Mipmaps black

Post by deepchand »

I have been using OGRE V1.9 for iOS & Enabling mipmaps renders the textures s black. However our code was working with OGRE v1.8

I am enabling mipmaps by using Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(3);

The texture appears only when the camera is near the mesh & the pixels become black on moving the camera away.
If i set the Texture Filtering to TFO_NONE, it works again, i believe this is not the right solution as it discards mipmaps.

I create texture by the following code

Ogre::TextureManager* ogre_texture_manager;
ogre_texture_manager = Ogre::TextureManager::getSingletonPtr();
Ogre::ResourceManager::ResourceCreateOrRetrieveResult status;
status = ogre_texture_manager->createOrRetrieve(filepath,
resource_group_name_,
false);
rettextureptr = status.first.staticCast<Ogre::Texture>();

Ogre::DataStreamPtr strm(OGRE_NEW Ogre::FileStreamDataStream(
resourcefilepath.data(), &imgstream, false));
image.load(strm, ext);
imgstream.close();
rettextureptr->loadImage(image);

Can somebody help me out?
deepchand
Gnoblar
Posts: 6
Joined: Sat May 04, 2013 12:41 pm

Re: iOS - OGRE V1.9 Mipmaps black

Post by deepchand »

Ok, I think i have fixed the problem..

I found that glGenerateMipmaps were not being called.. The only place this was called is in loadImpl() but that piece of code executes only while manually loading a Reosurce through ResourceLoader() i believe..

However the way i was creating the texture in immediate mode, this piece of code never executed. Then i compared the V1.9 branch with the working V1.8 branch of OGRE
& found out that the following piece of code is not present in GLES2TexturelBuffer::upload() function - at last before the ending brace..

if ((mUsage & TU_AUTOMIPMAP) && !mSoftwareMipmap && (mLevel == 0))
{
LogManager::getSingleton().logMessage("GL generate mipmap");

OGRE_CHECK_GL_ERROR(glGenerateMipmap(mFaceTarget));
}