mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
* use GL shim window instead of offscreen surface
* disable vsync by default (we'll take care of it later)
This commit is contained in:
parent
256360aebb
commit
ef2802ae31
@ -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();
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <QThread>
|
||||
#include <QWidget>
|
||||
#include <QWindow>
|
||||
#include <QMainWindow>
|
||||
#include <QImage>
|
||||
#include <QActionGroup>
|
||||
@ -74,7 +75,7 @@ private:
|
||||
int PrevEmuStatus;
|
||||
int EmuRunning;
|
||||
|
||||
QOffscreenSurface* oglSurface;
|
||||
QSurface* oglSurface;
|
||||
QOpenGLContext* oglContext;
|
||||
};
|
||||
|
||||
@ -162,6 +163,16 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class GLShim : public QWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GLShim(QSurfaceFormat& format);
|
||||
~GLShim();
|
||||
};
|
||||
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Loading…
Reference in New Issue
Block a user