-
- q158772500
- Posts: 6
- Joined:
Issues Integrating NoesisGUI into C++ OpenGL Project - Black Screen After Initialization
Hi ,I’m currently working on integrating NoesisGUI into my existing C++ OpenGL 1.x project. However, I’ve encountered an issue.
After calling the init() function of the NoesisGUI view, my project turns into a black screen. I’m not sure why this is happening or where the problem lies. Has anyone faced a similar issue or could provide some insight on potential causes?
Thanks in advance for your help.
Best regards.
After calling the init() function of the NoesisGUI view, my project turns into a black screen. I’m not sure why this is happening or where the problem lies. Has anyone faced a similar issue or could provide some insight on potential causes?
Code: Select all
void NoesisGUILoadLibrary()
{
HMODULE shCore = LoadLibraryA("Shcore.dll");
if (shCore != 0)
{
typedef HRESULT(WINAPI* PFN_SETPROCESSDPIAWARENESS)(_In_ PROCESS_DPI_AWARENESS value);
PFN_SETPROCESSDPIAWARENESS SetProcessDpiAwareness_ = (PFN_SETPROCESSDPIAWARENESS)
GetProcAddress(shCore, "SetProcessDpiAwareness");
if (SetProcessDpiAwareness_ != 0)
{
SetProcessDpiAwareness_(PROCESS_PER_MONITOR_DPI_AWARE);
}
}
FreeLibrary(shCore);
}
void NoesisGUIInit()
{
typedef BOOL(WINAPI* PFNWGLSWAPINTERVALEXTPROC)(int);
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = 0;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if (wglSwapIntervalEXT != 0)
{
wglSwapIntervalEXT(1);
}
glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)wglGetProcAddress("glBindFramebuffer");
assert(glBindFramebuffer != 0);
// A logging handler is installed here. You can also install a custom error handler and memory
// allocator. By default errors are redirected to the logging handler
GUI::SetLogHandler([](const char*, uint32_t, uint32_t level, const char*, const char* msg)
{
// [TRACE] [DEBUG] [INFO] [WARNING] [ERROR]
const char* prefixes[] = { "T", "D", "I", "W", "E" };
printf("[NOESIS/%s] %s\n", prefixes[level], msg);
});
// https://www.noesisengine.com/docs/Gui.Core.Licensing.html
GUI::SetLicense(NS_LICENSE_NAME, NS_LICENSE_KEY);
// Noesis initialization. This must be the first step before using any NoesisGUI functionality
GUI::Init();
SetThemeProviders();
// Load the Dark Blue theme
GUI::LoadApplicationResources(NoesisApp::Theme::DarkBlue());
GUI::SetXamlProvider(MakePtr<LocalXamlProvider>("Data\\UI"));
GUI::SetFontProvider(MakePtr<LocalFontProvider>("Data\\UI"));
GUI::SetTextureProvider(MakePtr<LocalTextureProvider>("Data\\UI"));
Ptr<FrameworkElement> xaml = GUI::LoadXaml<FrameworkElement>("Test.xaml");
const char* fonts[] = { "Fonts/#PT Root UI", "Arial", "Segoe UI Emoji" };
GUI::SetFontFallbacks(fonts, 3);
GUI::SetFontDefaultProperties(15.0f, FontWeight_Normal, FontStretch_Normal, FontStyle_Normal);
view = GUI::CreateView(xaml);
view->SetSize(300, 100);
view->SetFlags(RenderFlags_PPAA | RenderFlags_LCD);
Ptr<RenderDevice> device = GLFactory::CreateDevice(false);
view->GetRenderer()->Init(device); ---------------------->my project turns into a black screen
}Best regards.
Re: Issues Integrating NoesisGUI into C++ OpenGL Project - Black Screen After Initialization
The initialization of the renderer is chaging the GL state. You have the source code to see what changes are happening.view->GetRenderer()->Init(device); ---------------------->my project turns into a black screen
RenderDoc is your friend here.
-
- q158772500
- Posts: 6
- Joined:
Re: Issues Integrating NoesisGUI into C++ OpenGL Project - Black Screen After Initialization
I successfully integrated NoesisGUI with the older version of OpenGL, and your suggestion was really helpful.
Although there were a few issues, like RenderDoc not supporting OpenGL versions below 3.2, I found an alternative tool—apitrace.
It helps me track changes before and after “view->GetRenderer()->Init(device); ”, such as the use of code like glActiveTexture(GL_TEXTURE4);.
I just need to use my original glActiveTexture(GL_TEXTURE0); after the NoesisGUI rendering function.
Thanks again!
Although there were a few issues, like RenderDoc not supporting OpenGL versions below 3.2, I found an alternative tool—apitrace.
It helps me track changes before and after “view->GetRenderer()->Init(device); ”, such as the use of code like glActiveTexture(GL_TEXTURE4);.
I just need to use my original glActiveTexture(GL_TEXTURE0); after the NoesisGUI rendering function.
Thanks again!
Re: Issues Integrating NoesisGUI into C++ OpenGL Project - Black Screen After Initialization
Thanks for the feedback!
Who is online
Users browsing this forum: No registered users and 3 guests