[SOLVED] CEGUI 0.7, Ogre 1.6.4 Exception

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

[SOLVED] CEGUI 0.7, Ogre 1.6.4 Exception

Postby Van » Tue Oct 27, 2009 08:59

CEGUI 0.7.x SVN
Ogre: 1.6.4 SVN
MSVS 9

CEGUI.Log wrote:27/10/2009 07:16:04 (Std) ********************************************************************************
27/10/2009 07:16:04 (Std) * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
27/10/2009 07:16:04 (Std) ********************************************************************************
27/10/2009 07:16:04 (Std) ---- Version 0.7.9999 (Build: Oct 27 2009 Microsoft Windows MSVC++ 9.0 32 bit) ----
27/10/2009 07:16:04 (Std) ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
27/10/2009 07:16:04 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
27/10/2009 07:16:04 (Std) ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
27/10/2009 07:16:04 (Std) ---- Scripting module is: None ----
27/10/2009 07:16:04 (Std) ********************************************************************************
27/10/2009 07:16:04 (Std) * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
27/10/2009 07:16:04 (Std) ********************************************************************************



I was able to get the Ogre provided Demo_GUI working with CEGUI 0.7. However, when I ported the same CEGUI initialization to our application I keep getting an exception thrown (NULL pointer) when we execute Ogre::Root::startRendering().

Code: Select all

Unhandled exception at 0x02cbfeda (RenderSystem_Direct3D9_d.dll) in Client.exe: 0xC0000005: Access violation reading location 0x00000000.


The exception is occurring in OgreD3D9RenderSystem.cpp at line 2285 in Ogre::D3D9RenderSystem::_setCullingMode( CullingMode mode ):

Code: Select all

      bool flip = ((mActiveRenderTarget->requiresTextureFlipping() && !mInvertVertexWinding) ||
         (!mActiveRenderTarget->requiresTextureFlipping() && mInvertVertexWinding));


mActiveRenderTarget is NULL when traced in debug

That function is being called from line 301 in OgreRenderer::beginRendering():

Code: Select all

    d_renderSystem->_setCullingMode(CULL_NONE);


I thought maybe it was because we didn't specify a an Ogre::RenderTarget in the CEGUI::OgreRenderer::bootstrapSystem() call but that didn't seem to help either.

Does someone have an idea of what might be happening? I'm sure it's something I'm doing wrong as the Ogre Demo_GUI works just fine. We are doing the exact same initialization so we are at a loss of what might be going wrong:

Code: Select all

   // Initialize the CEGUI system
   Ogre::RenderTarget &mRenderTarget = *mGlobalResource->OgreDefaultViewPort->getTarget();
   mGlobalResource->CEGUIRenderer = &CEGUI::OgreRenderer::bootstrapSystem( mRenderTarget );
Last edited by Van on Wed Oct 28, 2009 00:57, edited 1 time in total.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: CEGUI 0.7, Ogre 1.6.4 Exception

Postby Van » Tue Oct 27, 2009 22:07

So, out of desperation, I commented out line 301 in CEGUI::OgreRenderer::beginRendering()

Code: Select all

    //d_renderSystem->_setCullingMode(CULL_NONE);


and recompiled the CEGUI OgreRenderer and attempted to run the new DLL with our application. We received this error from Ogre:

Ogre.log wrote:OGRE EXCEPTION(7:InternalErrorException): Cannot begin frame - no viewport selected. in D3D9RenderSystem::_beginFrame at ogred3d9rendersystem.cpp (line 2681)

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: CEGUI 0.7, Ogre 1.6.4 Exception

Postby Van » Tue Oct 27, 2009 23:03

We think we solved it.

We had to add the Ogre::Viewport::update() statement right after we created the viewport. I don't know why we need this but it appears to have worked. The Ogre GUI demo doesn't perform this statement however it seems to work fine.

Code: Select all

   // Create the viewport
   mGlobalResource->OgreDefaultViewPort = mGlobalResource->OgreDefaultRenderWindow->addViewport( mGlobalResource->OgreDefaultCamera );
   mGlobalResource->OgreDefaultViewPort->setBackgroundColour( Ogre::ColourValue( 0, 0, 0 ) );
   mGlobalResource->OgreDefaultCamera->setAspectRatio( Ogre::Real( mGlobalResource->OgreDefaultViewPort->getActualWidth() ) / Ogre::Real( mGlobalResource->OgreDefaultViewPort->getActualHeight() ) );
   mGlobalResource->OgreDefaultViewPort->update();

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: CEGUI 0.7, Ogre 1.6.4 Exception

Postby Jamarr » Tue Oct 27, 2009 23:39

Hi. Sorry I could not be of any help, I am not familiar with anything related to OGRE. That being said, thank you for posting the updates, it may help someone else with the same issue.

One thing I did notice was that you specified the CEGUI version as 0.7 SVN - but there are multiple versions in SVN. Since your log shows 0.7.9999 I am *guessing* that the source you downloaded was taken from trunk?

If that is the case, you may want to try branches/v0-7 as this contains the most recent commit (now 0.7.1). There have been *several* bug fixes made since 0.7.0, some of which are related to the OGRERenderer (though I cannot say if they address this particular issue).
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: CEGUI 0.7, Ogre 1.6.4 Exception

Postby Van » Tue Oct 27, 2009 23:45

Jamarr wrote:One thing I did notice was that you specified the CEGUI version as 0.7 SVN - but there are multiple versions in SVN. Since your log shows 0.7.9999 I am *guessing* that the source you downloaded was taken from trunk?


yes it is.

Jamarr wrote:If that is the case, you may want to try branches/v0-7 as this contains the most recent commit (now 0.7.1). There have been *several* bug fixes made since 0.7.0, some of which are related to the OGRERenderer (though I cannot say if they address this particular issue).


Ok. Will do. Thank you for the heads up!

eugen
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Tue Jun 03, 2008 03:29
Contact:

Re: [SOLVED] CEGUI 0.7, Ogre 1.6.4 Exception

Postby eugen » Mon Nov 02, 2009 04:34

I Have the same problem, however i only get it when the rendering window is not focused on screen. In my system the render target might get to initialize before CEGUI sets the culling level but only if the window is focused onscreen
i think what happens is that the current mActiveViewport in ogre renderer is not set when we want to set the culling mode method _setCullingMode is supposed to be used with precautions (internal method specified by the _ ) and they didnt took care of whether or not the current renderer target was or wasnt set because they ONLY called it after they initialize the render target. The update method on the viewport makes the renderer initialize the render target properly, thats why the fix works. However i cannot point to a simpler solution for now


Return to “Help”

Who is online

Users browsing this forum: No registered users and 15 guests