* use GL shim window instead of offscreen surface

* disable vsync by default (we'll take care of it later)
This commit is contained in:
Arisotura
2020-05-27 21:29:47 +02:00
parent 256360aebb
commit ef2802ae31
2 changed files with 29 additions and 3 deletions

View File

@ -268,7 +268,7 @@ void EmuThread::initOpenGL()
QOpenGLContext* windowctx = mainWindow->getOGLContext();
QSurfaceFormat format = windowctx->format();
oglSurface = new QOffscreenSurface();
/*oglSurface = new QOffscreenSurface();
oglSurface->setFormat(format);
oglSurface->create();
if (!oglSurface->isValid())
@ -277,7 +277,8 @@ void EmuThread::initOpenGL()
printf("oglSurface shat itself :(\n");
delete oglSurface;
return;
}
}*/
oglSurface = new GLShim(format);
oglContext = new QOpenGLContext();//oglSurface);
oglContext->setFormat(oglSurface->format());
@ -957,6 +958,19 @@ void ScreenPanelGL::onScreenLayoutChanged()
}
GLShim::GLShim(QSurfaceFormat& format) : QWindow()
{
setSurfaceType(QSurface::OpenGLSurface);
setFormat(format);
create();
hide();
}
GLShim::~GLShim()
{
}
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
{
setWindowTitle("melonDS " MELONDS_VERSION);
@ -1835,6 +1849,7 @@ int main(int argc, char** argv)
format.setStencilBufferSize(8);
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);
audioSync = SDL_CreateCond();