Nothing Rendering to Screen (iPad and iPhone Simulator)

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
daedalic
Gnoblar
Posts: 24
Joined: Wed May 02, 2012 7:19 pm

Nothing Rendering to Screen (iPad and iPhone Simulator)

Post by daedalic »

I am in the process of porting over a pong game I made for Linux to iOS. I've got everything running smoothly except for the fact that nothing renders to the screen. All I see is black. Changing the background color to something besides black still results in a black screen as well.

I am using the GLES render system currently and will switch to GLES 2 as soon as I can get something displaying. I am also using the 1.8 Ogre SDK, built from source a few weeks ago.

This game was developed for Linux using the tutorial application as a starting point. Much of the code below is unchanged from the tutorial application. The code that was incompatible with iOS has been removed. For the iOS side of things I took the Ogre template app and merged my game code in with it.

Here is the sequence of code that is run from main to the frameRenderingQueued call.

Code: Select all

// main
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"AppDelegate");


// AppDelegate::go
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    mTimer = nil;

    try {
    
        //Ogre::Root::getSingleton().getRenderSystem()->_initRenderTargets(); // moved elsewhere
    
        app.go();
    
    } catch( Ogre::Exception& e ) {
        std::cerr << "An exception has occurred: " <<
        e.getFullDescription().c_str() << std::endl;
    }


// BaseApplication::go
    mResourcesCfg = Ogre::macBundlePath() + "/" + "resources.cfg";
    mPluginsCfg = "";
    if (!setup())
        return;
    

// BaseApplication::setup (and various calls)
    m_StaticPluginLoader.load();
    
    setupResources();

    mWindow = mRoot->initialise(true, "Game Render Window");
    
    // Get the SceneManager, in this case a generic one
    mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
        
    // Create the camera
    mCamera = mSceneMgr->createCamera("PlayerCam");
        
    // Position it at 500 in Z direction
    mCamera->setPosition(Ogre::Vector3(0,0,80));
    // Look back along -Z
    mCamera->lookAt(Ogre::Vector3(0,0,-300));
    mCamera->setNearClipDistance(5);
        
    mCameraMan = new OgreBites::SdkCameraMan(mCamera);   // create a default camera controller
        
    // Create one viewport, entire window
    Ogre::Viewport* vp = mWindow->addViewport(mCamera);
    vp->setBackgroundColour(Ogre::ColourValue(0,0,0)); // the screen is black no matter what color is set here
        
    // Alter the camera aspect ratio to match the viewport
    mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
    
    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    
    // Create any resource listeners (for loading screens)
    //createResourceListener(); // there is no code run in this call
        
    // Load resources
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    
    // Create the scene
    createScene(); // -> calls GameApp::createScene() which successfully loads some models into the game and sets up the physics simulation
    
    createFrameListener();
        
    return true;
        

// BaseApplication::createFrameListener
    Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
    OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;
        
    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
        
    mInputManager = OIS::InputManager::createInputSystem( pl );
        
    mMouse = static_cast<OIS::MultiTouch*>(mInputManager->createInputObject( OIS::OISMultiTouch, true ));
    mMouse->setEventCallback(this);
        
    //Register as a Window listener
    Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
        
    mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mMouse, this);
        
    mTrayMgr->hideCursor();
        
    mRoot->addFrameListener(this);    
    
    
// BaseApplication::go    
    Ogre::Root::getSingleton().getRenderSystem()->_initRenderTargets();
    
    mRoot->startRendering(); // calls GameApp::frameRenderingQueued which updates game-specific data and calls BaseApplication::frameRenderingQueued at the end
    

// BaseApplication::frameRenderingQueued
    if(mWindow->isClosed())
        return false;
        
    if(mShutDown)
        return false;
        
    //Need to capture/update each device
    mMouse->capture();
        
    mTrayMgr->frameRenderingQueued(evt);

    return true;
I have stepped through all this code and the result is that frameRenderingQueued is repeatedly called and nothing is displayed to the screen.

I can supply additional info if needed. Any help would be much appreciated, thanks!