iOS - First time load shadows

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

iOS - First time load shadows

Post by Carlyone » Thu Jan 31, 2013 4:37 pm

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
0 x

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

Re: iOS - First time load shadows

Post by masterfalcon » Thu Jan 31, 2013 11:16 pm

Try using GLSL shaders rather than Cg.
0 x

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

Re: iOS - First time load shadows

Post by Carlyone » Fri Feb 01, 2013 10:09 am

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
0 x

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

Re: iOS - First time load shadows

Post by Carlyone » Fri Feb 01, 2013 4:32 pm

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
0 x

Post Reply