Unigine integration
Hi,
A few weeks back I was implemented NoesisGUI 2.1.0 RC3 into Unigine 2.6.1.1 engine (viewtopic.php?f=3&t=1170&p=7700&hilit=unigine#p7700).
In the middle of time I updated NoesisGUI into final 2.1 release. I created a base library project to integrate NoesisGUI 2.1 with Unigine 2.6.1.1 (it works from Starter version).
I would like to share it with you. But I hope that Noesis team will check and improve it. I give all rights for Noesis Team to use, modify and share it (just take it and make it better and share for everyone).
After update to 2.1 release version and migrate implementation from main app file to AppSystemLogic in Unigine (to work GUI in Editor2 as I described later in this topic) there is a problem that each rendered frame of NoesisGUI contains last frame too, I think soo. The problem is that transparency object of NoesisGUI is transparent just for a few first frames and then stay more opaque and full opaque at last. Also when I hide Noesis gui object it is still displayed in the GUI (as set Visibility as Collapsed for Grid object). So I need a help to resolve it as well. You will see it when you will add simple xaml file with transparent object in it.
I attach this project. Because of license agreement I do not include D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp files which you can add from NoesisGUI download pack (such files are not modified).
To use it just add this project to your solution in C++ of Unigine project. You have 2 option to use it:
1. in main.cpp file (but it will not work in Editor2):
2. or in AppSystemLogic file:
Example of us this library to load a new gui and implement button action:
A few weeks back I was implemented NoesisGUI 2.1.0 RC3 into Unigine 2.6.1.1 engine (viewtopic.php?f=3&t=1170&p=7700&hilit=unigine#p7700).
In the middle of time I updated NoesisGUI into final 2.1 release. I created a base library project to integrate NoesisGUI 2.1 with Unigine 2.6.1.1 (it works from Starter version).
I would like to share it with you. But I hope that Noesis team will check and improve it. I give all rights for Noesis Team to use, modify and share it (just take it and make it better and share for everyone).
After update to 2.1 release version and migrate implementation from main app file to AppSystemLogic in Unigine (to work GUI in Editor2 as I described later in this topic) there is a problem that each rendered frame of NoesisGUI contains last frame too, I think soo. The problem is that transparency object of NoesisGUI is transparent just for a few first frames and then stay more opaque and full opaque at last. Also when I hide Noesis gui object it is still displayed in the GUI (as set Visibility as Collapsed for Grid object). So I need a help to resolve it as well. You will see it when you will add simple xaml file with transparent object in it.
I attach this project. Because of license agreement I do not include D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp files which you can add from NoesisGUI download pack (such files are not modified).
To use it just add this project to your solution in C++ of Unigine project. You have 2 option to use it:
1. in main.cpp file (but it will not work in Editor2):
Code: Select all
#include "NoesisGUI.h"
#ifdef _WIN32
int wmain(int argc, wchar_t *argv[]) {
#else
int main(int argc, char *argv[]) {
#endif
Unigine::Engine* pEngine = Unigine::Engine::init(UNIGINE_VERSION, argc, argv);
...
NoesisGUI* noesisGUI = &NoesisGUI::getInstance();
noesisGUI->Initialize();
while (!pEngine->isDone())
{
noesisGUI->Update();
pEngine->update();
pEngine->render();
noesisGUI->Render();
pEngine->swap();
//noesisGUI->Clear();
pEngine->swap();
}
noesisGUI->Shutdown();
...
return 0;
}
2. or in AppSystemLogic file:
Code: Select all
#include "NoesisGUI.h"
NoesisGUI* noesisGUI;
int AppSystemLogic::init() {
{
noesisGUI = &NoesisGUI::getInstance();
noesisGUI->Initialize();
}
int AppSystemLogic::update() {
noesisGUI->Update();
return 1;
}
int AppSystemLogic::render() {
noesisGUI->Render();
return 1;
}
Code: Select all
NoesisGUI* noesisGUI = &NoesisGUI::getInstance();
noesisGUI->LoadUI("my_file.xaml");
// garaz
Noesis::Button* button1 = noesisGUI->xaml->FindName<Noesis::Button>("button_quit");
button1->Click() += [](BaseComponent* sender, const RoutedEventArgs& args)
{
App::get()->exit();
};
...
- Attachments
-
- NoesisIntegration.zip
- (5 KiB) Downloaded 89 times
Re: Unigine integration
Thanks for sharing this with the community! Before going on, could you please create a GitHub repository for it?
Re: Unigine integration
Do I can/should create Public repository for it ? Do I can include Shaders.h, D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp Noesis files with the project ?Thanks for sharing this with the community! Before going on, could you please create a GitHub repository for it?
Re: Unigine integration
Yes, you can include them. Please do not include the binaries (Noesis.dll)Do I can/should create Public repository for it ? Do I can include Shaders.h, D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp Noesis files with the project ?
Re: Unigine integration
I already created Git repository at: https://github.com/researchdeveloping/N ... I-Unigine/Yes, you can include them. Please do not include the binaries (Noesis.dll)Do I can/should create Public repository for it ? Do I can include Shaders.h, D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp Noesis files with the project ?

Re: Unigine integration
Thank you!
Did you follow the integration guide? Because, this is the recommended way to implement the rendering (code taken from the GLUT integration sample)
You are instead doing:
That's not correct. You need to render the offscreen phase before setting the main render target and rendering the 3D scene.
Did you follow the integration guide? Because, this is the recommended way to implement the rendering (code taken from the GLUT integration sample)
Code: Select all
// Offscreen rendering phase populates textures needed by the on-screen rendering
_view->GetRenderer()->UpdateRenderTree();
_view->GetRenderer()->RenderOffscreen();
// If you are going to render here with your own engine you need to restore the GPU state
// because noesis changes it. The framebuffer and viewport are restored here
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
glClearColor(0.0f, 0.0f, 0.25f, 0.0f);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// Rendering is done in the active framebuffer
_view->GetRenderer()->Render();
Code: Select all
ID3D11RenderTargetView* pTexNoesisRTV = static_cast<ID3D11RenderTargetView*>(my_texture->getD3D11RenderTargetView());
pContext->OMSetRenderTargets(1, &pTexNoesisRTV, nullptr);
view->GetRenderer()->UpdateRenderTree();
view->GetRenderer()->RenderOffscreen();
view->GetRenderer()->Render();
Re: Unigine integration
I follow integration guide but for mistake I do it in a wrong way. As you write this fix the issue with transparency. This fix set to render NoesisGUI on top of Unigine (so it will be necessary to hide NoesisGUI to see Unigine console, to add Unigine cursor, etc.). I push this fix to GitHub.
By the way. Please correct me if I should choose other license than GPL 3 at GitHub ? Also I added notice there that D3D11RenderDevice.h, D3D11RenderDevice.cpp, Render.D3D11RenderDevice.cpp, Shaders.h filkes are licensed by Noesis with all rights and point everybody to Noesis website to check license.
Thanks!
Edit:
With the fix provided integration works well only within main.cpp. To work in AppSystemLogic you have to move pContext->OMSetRenderTargets line from render() at the top of the render() function. Then it will works in Editor2 as well but it will be broken transparency, etc. Also then NoesisGUI will be below Unigine GUI layer.
This may be related to different work main loop in the Unigine engine. I ask Unigine about it: https://developer.unigine.com/forum/top ... ui-sample/
By the way. Please correct me if I should choose other license than GPL 3 at GitHub ? Also I added notice there that D3D11RenderDevice.h, D3D11RenderDevice.cpp, Render.D3D11RenderDevice.cpp, Shaders.h filkes are licensed by Noesis with all rights and point everybody to Noesis website to check license.
Thanks!
Edit:
With the fix provided integration works well only within main.cpp. To work in AppSystemLogic you have to move pContext->OMSetRenderTargets line from render() at the top of the render() function. Then it will works in Editor2 as well but it will be broken transparency, etc. Also then NoesisGUI will be below Unigine GUI layer.
This may be related to different work main loop in the Unigine engine. I ask Unigine about it: https://developer.unigine.com/forum/top ... ui-sample/
Re: Unigine integration
That license is correct. Thanks for taking care!By the way. Please correct me if I should choose other license than GPL 3 at GitHub ? Also I added notice there that D3D11RenderDevice.h, D3D11RenderDevice.cpp, Render.D3D11RenderDevice.cpp, Shaders.h filkes are licensed by Noesis with all rights and point everybody to Noesis website to check license.
Who is online
Users browsing this forum: No registered users and 0 guests