About integerate NoesisGUI with OGRE 2.1
Posted: 25 Sep 2016, 07:09
Hi guys,
I have some problem with integerate NoesisGUI with Ogre 2.1.
1. As we use OGRE 2.1 we use directX 11, I found an OgreBindings project at github but it's use directX 9. I chaned some code and use the D3D11 Render from 1.3 sdk to support directX11. Because I never use Dirext api before, the Tutorial05 in the sdk said that "Restore state. This must be done per frame because NoesisGUI modifies the GPU state" and the code shown as below
g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
g_pImmediateContext->IASetInputLayout(g_pVertexLayout);
UINT stride = sizeof(SimpleVertex);
UINT offset = 0;
g_pImmediateContext->IASetVertexBuffers(0, 1, &g_pVertexBuffer, &stride, &offset);
g_pImmediateContext->IASetIndexBuffer(g_pIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
g_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
g_pImmediateContext->OMSetDepthStencilState(0, 0);
g_pImmediateContext->RSSetState(0);
g_pImmediateContext->OMSetBlendState(0, 0, 0xffffffff);
D3D11_VIEWPORT vp = { 0.0f, 0.0f, (FLOAT)g_Width, (FLOAT)g_Height, 0.0f, 1.0f};
g_pImmediateContext->RSSetViewports(1, &vp);
I'm wonder which code are store the GPU state and which are restore the GPU state. I'm sorry to ask you so basic issus.
In my project I call renderer->RenderOffscreen() when Ogre framestarted and call renderer->Render() when Ogre frameRenderingQueued as the OgreBindings sample at github.
2. In our project we support some keyboard shutcuts such as W-A-S-D to control walk. When showing a gui view with an input in the 3D scence, I want the input box to lost focus when the mouse clicked out of the gui view. I found a method UIElement::Focus but there no method called such as ReleaseFocus, how can I implement this function. I want when I press 'W' the word will not show in the input box after I clicked the mouse out of the view but walking.
3. How do I determine if an event(keyboard event, mouse event or touch event) has been handled by NoesisGUI or not? Just now I found UIElement::IsMouseOver method, is that correct?
Thanks.
I have some problem with integerate NoesisGUI with Ogre 2.1.
1. As we use OGRE 2.1 we use directX 11, I found an OgreBindings project at github but it's use directX 9. I chaned some code and use the D3D11 Render from 1.3 sdk to support directX11. Because I never use Dirext api before, the Tutorial05 in the sdk said that "Restore state. This must be done per frame because NoesisGUI modifies the GPU state" and the code shown as below
g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
g_pImmediateContext->IASetInputLayout(g_pVertexLayout);
UINT stride = sizeof(SimpleVertex);
UINT offset = 0;
g_pImmediateContext->IASetVertexBuffers(0, 1, &g_pVertexBuffer, &stride, &offset);
g_pImmediateContext->IASetIndexBuffer(g_pIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
g_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
g_pImmediateContext->OMSetDepthStencilState(0, 0);
g_pImmediateContext->RSSetState(0);
g_pImmediateContext->OMSetBlendState(0, 0, 0xffffffff);
D3D11_VIEWPORT vp = { 0.0f, 0.0f, (FLOAT)g_Width, (FLOAT)g_Height, 0.0f, 1.0f};
g_pImmediateContext->RSSetViewports(1, &vp);
I'm wonder which code are store the GPU state and which are restore the GPU state. I'm sorry to ask you so basic issus.
In my project I call renderer->RenderOffscreen() when Ogre framestarted and call renderer->Render() when Ogre frameRenderingQueued as the OgreBindings sample at github.
2. In our project we support some keyboard shutcuts such as W-A-S-D to control walk. When showing a gui view with an input in the 3D scence, I want the input box to lost focus when the mouse clicked out of the gui view. I found a method UIElement::Focus but there no method called such as ReleaseFocus, how can I implement this function. I want when I press 'W' the word will not show in the input box after I clicked the mouse out of the view but walking.
3. How do I determine if an event(keyboard event, mouse event or touch event) has been handled by NoesisGUI or not? Just now I found UIElement::IsMouseOver method, is that correct?
Thanks.