D3DError on resetting device after adding GUIWindow (Solved)
Posted: Mon Feb 04, 2013 18:57
Hi, just started adding CEGUI into my DirectX engine yesterday, so I've been working through the tutorials and have come across a couple problems. First of all, when resizing the window or switching to fullscreen the image now becomes stretched rather than switching to the correct resolution/aspect ratio when I call Reset on the device with the new presentation parameters. Not really a massive problem as I don't expect the user to be doing that very often, but I suspect there's probably something I'm not doing that will fix this anyway.
But more importantly, after adding a Window to the GUI I can't resize/fullscreen at all because I get a D3D error when resetting the device. I'm guessing that either CEGUI already does some kind of reset which is messing with my own, or that there's something I should be doing to CEGUI before I reset the device? The actual error is:
Error Code: D3DERR_INVALIDCALL (0x8876086c)
Calling: mp_d3dDevice->Reset(&m_d3dPP);
Here's the top bit of my CEGUI.log file, but it doesn't actually give any errors or anything since the error is a D3D error, so I assume the rest isn't relevant
And lastly my little test function that adds a window (Could be something I'm doing wrong here as well to be honest, but it seems to work fine until I resize the application window)
Gah, just tried some different search terms and found another topic on the forum which had what I needed. Looks like you have to call Direct3D9Renderer->preD3DReset() and postD3DReset() before and after resetting the device, and that solved both problems... Knew it would be something incredibly simple :3
But more importantly, after adding a Window to the GUI I can't resize/fullscreen at all because I get a D3D error when resetting the device. I'm guessing that either CEGUI already does some kind of reset which is messing with my own, or that there's something I should be doing to CEGUI before I reset the device? The actual error is:
Error Code: D3DERR_INVALIDCALL (0x8876086c)
Calling: mp_d3dDevice->Reset(&m_d3dPP);
Here's the top bit of my CEGUI.log file, but it doesn't actually give any errors or anything since the error is a D3D error, so I assume the rest isn't relevant
Code: Select all
04/02/2013 18:32:50 (Std) ********************************************************************************
04/02/2013 18:32:50 (Std) * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
04/02/2013 18:32:50 (Std) ********************************************************************************
04/02/2013 18:32:50 (Std) ---- Version 0.7.9 (Build: Feb 3 2013 Debug Microsoft Windows MSVC++ 10.0 32 bit) ----
04/02/2013 18:32:50 (Std) ---- Renderer module is: CEGUI::Direct3D9Renderer - Official Direct3D 9 based 2nd generation renderer module. ----
04/02/2013 18:32:50 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
04/02/2013 18:32:50 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
04/02/2013 18:32:50 (Std) ---- Scripting module is: None ----
04/02/2013 18:32:50 (Std) ********************************************************************************
04/02/2013 18:32:50 (Std) * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
04/02/2013 18:32:50 (Std) ********************************************************************************
And lastly my little test function that adds a window (Could be something I'm doing wrong here as well to be honest, but it seems to work fine until I resize the application window)
Code: Select all
void CGameState::CreateGUI()
{
using namespace CEGUI;
CEGUI::SchemeManager::getSingleton().create("WindowsLook.scheme", "schemes");
WindowManager& manager = WindowManager::getSingleton();
Window* rootWindow = manager.createWindow("DefaultWindow", "root");
System::getSingleton().setGUISheet(rootWindow);
Window* testWindow = manager.createWindow("WindowsLook/FrameWindow", "testWindow");
testWindow->setText("Hello World!");
rootWindow->addChildWindow(testWindow);
// Position a quarter of the way in from the top-left of parent
testWindow->setPosition(UVector2(UDim(0.1f, 0.0f), UDim(0.1f, 0.0f)));
// set size to be half the size of the parent
testWindow->setSize(UVector2(UDim(0.2f, 0), UDim(0.2f, 0)));
}
Gah, just tried some different search terms and found another topic on the forum which had what I needed. Looks like you have to call Direct3D9Renderer->preD3DReset() and postD3DReset() before and after resetting the device, and that solved both problems... Knew it would be something incredibly simple :3