iOS - First time load shadows

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Carlyone
Kobold
Posts: 38
Joined: Thu Jul 05, 2012 3:51 pm
x 4

iOS - First time load shadows

Post by Carlyone »

Hello,
I've been having an issue where the screen is black in ogre and nothing is shown, but no errors are thrown, and only the first time after install.

The error only occurs on the first load and once the application has been stopped completely and started up again it's fine, not allowed to deploy with this problem though.

I narrowed the issue down to shadows but I can't see why they cause a problem, I'll paste in my shadow setup below.

Code: Select all

void OgreFramework::setupShadows(){
    m_pSceneMgr->setShadowTexturePixelFormat(Ogre::PF_X8R8G8B8);
    m_pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
    m_pSceneMgr->setShadowColour(Ogre::ColourValue(0.2,0.2,0.2));
    m_pSceneMgr->setShadowTextureSettings(1024, 2);
    m_pSceneMgr->setShadowCameraSetup(ShadowCameraSetupPtr(new DefaultShadowCameraSetup()));
    m_pSceneMgr->setShadowFarDistance(1000);
    
    m_pSceneMgr->setShadowTextureSelfShadow(false);
    m_pSceneMgr->setShadowTextureReceiverMaterial("ShadowReceiver");
    m_pSceneMgr->setShadowTextureCasterMaterial("ShadowCaster");
}
Materials

Code: Select all

material ShadowReceiver
{
    technique default
    {
        pass lighting
        {
            texture_unit shadowMap
            {
                tex_address_mode clamp
                filtering none
            }
        }
    }
}

vertex_program ShadowCasterVP cg
{
    source v-shadow-caster.cg
    entry_point main
    profiles arbvp1
 
    default_params
    {
        param_named_auto p_ModelViewProjection worldviewproj_matrix
        param_named_auto p_AmbientLight ambient_light_colour
    }
}
 
fragment_program ShadowCasterFP cg
{
    source f-shadow-caster.cg
    entry_point main
    profiles arbfp1
    // Store normalized (usefull to avoid overflowin) or non-normalized depth ?
    //compile_arguments -DSTORE_NORMALIZED_DEPTH
 
    default_params
    {
        // Only used when storing normalized depth values
        //param_named_auto p_Near near_clip_distance
        //param_named_auto p_Far far_clip_distance
        param_named p_DepthOffset float 0.01
    }
}
 
material ShadowCaster
{
    technique default
    {
        // Z-write only pass
        pass Z-write
        {
            vertex_program_ref ShadowCasterVP
            {
            }
            fragment_program_ref ShadowCasterFP
            {
            }
        }
    }
}
With or without the casters or any of the extra shadow settings the issue seems to stay.

Shadows are still new to me, so if I've missed something basic then great.

Hope someone can help

Carl
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: iOS - First time load shadows

Post by masterfalcon »

Try using GLSL shaders rather than Cg.
Carlyone
Kobold
Posts: 38
Joined: Thu Jul 05, 2012 3:51 pm
x 4

Re: iOS - First time load shadows

Post by Carlyone »

Heh, don't believe I didn't spot that, I will amend it, as a guess would just changing cg to glsl satisfy it?

I'll test that and see if it sorts it.

Carl
Carlyone
Kobold
Posts: 38
Joined: Thu Jul 05, 2012 3:51 pm
x 4

Re: iOS - First time load shadows

Post by Carlyone »

Well that worked.

Don't believe that cg marker has been staring me in the face and I missed it.

Thanks for the assistance

Carl