Issues Integrating NoesisGUI into C++ OpenGL Project - Black Screen After Initialization
Posted: 01 Mar 2025, 10:52
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.