fix bugs, clean up some of the shit

This commit is contained in:
Arisotura 2020-05-28 17:00:25 +02:00
parent d1d572210f
commit 2912a07b8b
3 changed files with 16 additions and 8 deletions

View File

@ -339,10 +339,10 @@ void SetRenderSettings(int renderer, RenderSettings& settings)
int fbsize; int fbsize;
if (accel) fbsize = (256*3 + 1) * 192; if (accel) fbsize = (256*3 + 1) * 192;
else fbsize = 256 * 192; else fbsize = 256 * 192;
if (Framebuffer[0][0]) delete[] Framebuffer[0][0]; if (Framebuffer[0][0]) { delete[] Framebuffer[0][0]; Framebuffer[0][0] = nullptr; }
if (Framebuffer[1][0]) delete[] Framebuffer[1][0]; if (Framebuffer[1][0]) { delete[] Framebuffer[1][0]; Framebuffer[1][0] = nullptr; }
if (Framebuffer[0][1]) delete[] Framebuffer[0][1]; if (Framebuffer[0][1]) { delete[] Framebuffer[0][1]; Framebuffer[0][1] = nullptr; }
if (Framebuffer[1][1]) delete[] Framebuffer[1][1]; if (Framebuffer[1][1]) { delete[] Framebuffer[1][1]; Framebuffer[1][1] = nullptr; }
Framebuffer[0][0] = new u32[fbsize]; Framebuffer[0][0] = new u32[fbsize];
Framebuffer[1][0] = new u32[fbsize]; Framebuffer[1][0] = new u32[fbsize];

View File

@ -59,7 +59,7 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
for (int i = 1; i <= 16; i++) for (int i = 1; i <= 16; i++)
ui->cbxGLResolution->addItem(QString("%1x native (%2x%3)").arg(i).arg(256*i).arg(192*i)); ui->cbxGLResolution->addItem(QString("%1x native (%2x%3)").arg(i).arg(256*i).arg(192*i));
ui->cbxGLResolution->setCurrentIndex(Config::GL_ScaleFactor-1); ui->cbxGLResolution->setCurrentIndex(Config::GL_ScaleFactor-1);
printf("GL scale = %d\n", Config::GL_ScaleFactor);
if (Config::_3DRenderer == 0) if (Config::_3DRenderer == 0)
{ {
ui->cbGLDisplay->setEnabled(true); ui->cbGLDisplay->setEnabled(true);

View File

@ -282,7 +282,7 @@ void EmuThread::initOpenGL()
return; return;
} }
oglContext = new QOpenGLContext();//oglSurface); oglContext = new QOpenGLContext();
oglContext->setFormat(oglSurface->format()); oglContext->setFormat(oglSurface->format());
oglContext->setShareContext(windowctx); oglContext->setShareContext(windowctx);
if (!oglContext->create()) if (!oglContext->create())
@ -797,9 +797,16 @@ ScreenPanelGL::ScreenPanelGL(QWidget* parent) : QOpenGLWidget(parent)
ScreenPanelGL::~ScreenPanelGL() ScreenPanelGL::~ScreenPanelGL()
{ {
// CHECKME!!!! makeCurrent();
// ALSO TODO: CLEANUP
glDeleteTextures(1, &screenTexture);
glDeleteVertexArrays(1, &screenVertexArray);
glDeleteBuffers(1, &screenVertexBuffer);
delete screenShader; delete screenShader;
doneCurrent();
} }
void ScreenPanelGL::setupScreenLayout() void ScreenPanelGL::setupScreenLayout()
@ -1793,6 +1800,7 @@ void MainWindow::onUpdateVideoSettings(bool glchange)
delete panel; delete panel;
createScreenPanel(); createScreenPanel();
connect(emuThread, SIGNAL(windowUpdate()), panel, SLOT(update())); connect(emuThread, SIGNAL(windowUpdate()), panel, SLOT(update()));
if (hasOGL) emuThread->initOpenGL();
} }
videoSettingsDirty = true; videoSettingsDirty = true;