sdk: Ogre 1.7.1, cegui 0.7.1
Run Sample_Demox_d.exe, select ogrerenderer, choose dx9 render, full-screen no. when sample started, then move window to another display, you'll got:
OGRE EXCEPTION(7:InternalErrorException): Cannot begin frame - no viewport selected. in D3D9RenderSystem::_beginFrame at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem.cpp (line 2818)
look like because ogre main render in vewport update event, so it's OK, but ceguiogrerenderer render in frameRenderingQueued.
0.7.1 ogrerenderer dx9 crash when lost device
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: 0.7.1 ogrerenderer dx9 crash when lost device
Thanks for the report, though we do already have a ticket open for this issue: http://www.cegui.org.uk/mantis/view.php?id=367 Hopefully it will get fixed in a couple of weeks or so 
CE.

CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: 0.7.1 ogrerenderer dx9 crash when lost device
Thank you, but there is another lost device bug
crash when lost device:
OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9Re
nderSystem::_render at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem
.cpp (line 3115)
Direct3D9: (ERROR) :Need to call BeginScene before rendering.
Direct3D9: (ERROR)
rawPrimitive failed.
D3D9 Helper: IDirect3DDevice9::DrawPrimitive failed: D3DERR_INVALIDCALL
Analyse:
beginRendering will call getActiveD3D9Device()->BeginScene(), but next line d_renderer->getDefaultRenderingRoot().draw() will change ActiveD3D9Device when lost device.
here is code where ActiveD3D9Device changed:
d_renderer->getDefaultRenderingRoot().draw() call OgreRenderTarget::activate():
and _setViewport will check device, if lost, update D3D9DeviceManager::mActiveRenderWindowDevice.
crash when lost device:
OGRE EXCEPTION(3:RenderingAPIException): Failed to DrawPrimitive : Invalid call in D3D9Re
nderSystem::_render at ..\..\..\RenderSystems\Direct3D9\src\OgreD3D9RenderSystem
.cpp (line 3115)
Direct3D9: (ERROR) :Need to call BeginScene before rendering.
Direct3D9: (ERROR)

D3D9 Helper: IDirect3DDevice9::DrawPrimitive failed: D3DERR_INVALIDCALL
Analyse:
Code: Select all
void System::renderGUI(void)
{
d_renderer->beginRendering();
...
d_renderer->getDefaultRenderingRoot().draw();
...
}
beginRendering will call getActiveD3D9Device()->BeginScene(), but next line d_renderer->getDefaultRenderingRoot().draw() will change ActiveD3D9Device when lost device.
here is code where ActiveD3D9Device changed:
d_renderer->getDefaultRenderingRoot().draw() call OgreRenderTarget::activate():
Code: Select all
void OgreRenderTarget::activate()
{
...
d_renderSystem._setViewport(d_viewport);
...
}
and _setViewport will check device, if lost, update D3D9DeviceManager::mActiveRenderWindowDevice.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: 0.7.1 ogrerenderer dx9 crash when lost device
First I have to say that the previous issue is not fixed yet either - as evidenced by the fact the mantis ticket is not marked as resolved 
As for D3D specific information when using Ogre, within CEGUI I believe we have no access to any of that information. While these issues stem from our use of really low level Ogre APIs, I don't think there is a means within the Ogre API for us to know whether a D3D device is lost (or not), so how should we proceed in such cases when we do not have that information?
It may be that the Ogre renderer for CEGUI will be rewritten to use the regular, higher-level, APIs in Ogre. If - or when - that happens, all of these issues should go away.
CE

As for D3D specific information when using Ogre, within CEGUI I believe we have no access to any of that information. While these issues stem from our use of really low level Ogre APIs, I don't think there is a means within the Ogre API for us to know whether a D3D device is lost (or not), so how should we proceed in such cases when we do not have that information?
It may be that the Ogre renderer for CEGUI will be rewritten to use the regular, higher-level, APIs in Ogre. If - or when - that happens, all of these issues should go away.

CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “Bug Reports, Suggestions, Feature Requests”
Who is online
Users browsing this forum: No registered users and 5 guests