mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
start work on multiple window support
This commit is contained in:
@ -681,9 +681,23 @@ ScreenPanelGL::ScreenPanelGL(QWidget* parent) : ScreenPanel(parent)
|
||||
ScreenPanelGL::~ScreenPanelGL()
|
||||
{}
|
||||
|
||||
GL::Context* hax = nullptr;
|
||||
|
||||
bool ScreenPanelGL::createContext()
|
||||
{
|
||||
std::optional<WindowInfo> windowInfo = getWindowInfo();
|
||||
|
||||
if (hax)
|
||||
{
|
||||
if (windowInfo.has_value())
|
||||
{
|
||||
glContext = hax->CreateSharedContext(*getWindowInfo());
|
||||
glContext->DoneCurrent();
|
||||
}
|
||||
|
||||
return glContext != nullptr;
|
||||
}
|
||||
|
||||
std::array<GL::Context::Version, 2> versionsToTry = {
|
||||
GL::Context::Version{GL::Context::Profile::Core, 4, 3},
|
||||
GL::Context::Version{GL::Context::Profile::Core, 3, 2}};
|
||||
@ -691,6 +705,7 @@ bool ScreenPanelGL::createContext()
|
||||
{
|
||||
glContext = GL::Context::Create(*getWindowInfo(), versionsToTry);
|
||||
glContext->DoneCurrent();
|
||||
hax = glContext.get();
|
||||
}
|
||||
|
||||
return glContext != nullptr;
|
||||
@ -838,6 +853,13 @@ void ScreenPanelGL::deinitOpenGL()
|
||||
lastScreenWidth = lastScreenHeight = -1;
|
||||
}
|
||||
|
||||
void ScreenPanelGL::makeCurrentGL()
|
||||
{
|
||||
if (!glContext) return;
|
||||
|
||||
glContext->MakeCurrent();
|
||||
}
|
||||
|
||||
void ScreenPanelGL::osdRenderItem(OSDItem* item)
|
||||
{
|
||||
ScreenPanel::osdRenderItem(item);
|
||||
@ -871,6 +893,8 @@ void ScreenPanelGL::drawScreenGL()
|
||||
if (!glContext) return;
|
||||
if (!emuThread->NDS) return;
|
||||
|
||||
glContext->MakeCurrent();
|
||||
|
||||
int w = windowInfo.surface_width;
|
||||
int h = windowInfo.surface_height;
|
||||
float factor = windowInfo.surface_scale;
|
||||
|
Reference in New Issue
Block a user