Skip to content

Commit

Permalink
add "Use OpenGL" checkbox in prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaller committed Aug 26, 2024
1 parent 178e595 commit f3c49bf
Show file tree
Hide file tree
Showing 22 changed files with 4,034 additions and 2,079 deletions.
17 changes: 17 additions & 0 deletions QtSLiM/QtSLiM.pro
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ QMAKE_CFLAGS += $$(CFLAGS)
DEFINES += EIDOS_GUI
DEFINES += SLIMGUI=1


# Uncomment this define to disable the use of OpenGL in SLiMgui completely. This, plus removing the
# link dependency on openglwidgets, should allow you to build SLiMgui without linking OpenGL at all.
# I don't expect end users to need to do this; it is for testing purposes, to ensure than the code
# path used when OpenGL is disabled in Preferences does not inadvertently make any OpenGL calls.
#DEFINES += SLIM_NO_OPENGL


greaterThan(QT_MAJOR_VERSION, 5) {
# For Qt6 we require C++17 (because Qt6 requires it), but don't use it ourselves
CONFIG += c++17
Expand Down Expand Up @@ -160,6 +168,8 @@ else:unix: PRE_TARGETDEPS += $$OUT_PWD/../eidos_zlib/libeidos_zlib.a

SOURCES += \
../cmake/GitSHA1_qmake.cpp \
QtSLiMChromosomeWidget_GL.cpp \
QtSLiMChromosomeWidget_QT.cpp \
QtSLiMDebugOutputWindow.cpp \
QtSLiMGraphView_1DPopulationSFS.cpp \
QtSLiMGraphView_1DSampleSFS.cpp \
Expand All @@ -172,6 +182,11 @@ SOURCES += \
QtSLiMGraphView_PopFitnessDist.cpp \
QtSLiMGraphView_PopSizeOverTime.cpp \
QtSLiMGraphView_SubpopFitnessDists.cpp \
QtSLiMHaplotypeManager_GL.cpp \
QtSLiMHaplotypeManager_QT.cpp \
QtSLiMIndividualsWidget_GL.cpp \
QtSLiMIndividualsWidget_QT.cpp \
QtSLiMOpenGL.cpp \
QtSLiM_Plot.cpp \
main.cpp \
QtSLiMWindow.cpp \
Expand Down Expand Up @@ -218,6 +233,8 @@ HEADERS += \
QtSLiMGraphView_PopFitnessDist.h \
QtSLiMGraphView_PopSizeOverTime.h \
QtSLiMGraphView_SubpopFitnessDists.h \
QtSLiMOpenGL.h \
QtSLiMOpenGL_Emulation.h \
QtSLiMWindow.h \
QtSLiMAppDelegate.h \
QtSLiMChromosomeWidget.h \
Expand Down
10 changes: 10 additions & 0 deletions QtSLiM/QtSLiMAppDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "QtSLiMTablesDrawer.h"
#include "QtSLiMDebugOutputWindow.h"
#include "QtSLiMConsoleTextEdit.h"
#include "QtSLiMOpenGL.h"
#include "QtSLiMExtras.h"

#include <QApplication>
Expand Down Expand Up @@ -196,6 +197,9 @@ QtSLiMAppDelegate::QtSLiMAppDelegate(QObject *p_parent) : QObject(p_parent)

// Remember our current working directory, to return to whenever we are not inside SLiM/Eidos
app_cwd_ = Eidos_CurrentDirectory();

// Initialize our OpenGL wrapper state
QtSLiM_AllocateGLBuffers();

// Set up the format for OpenGL buffers globally, so that it applies to all windows and contexts
// This defaults to OpenGL 2.0, which is what we want, so right now we don't customize
Expand Down Expand Up @@ -258,6 +262,12 @@ QtSLiMAppDelegate::QtSLiMAppDelegate(QObject *p_parent) : QObject(p_parent)

QtSLiMAppDelegate::~QtSLiMAppDelegate(void)
{
//qDebug() << "QtSLiMAppDelegate::~QtSLiMAppDelegate";

#if SLIM_LEAK_CHECKING
QtSLiM_FreeGLBuffers();
#endif

qtSLiMAppDelegate = nullptr; // kill the global shared instance, for safety
}

Expand Down
Loading

0 comments on commit f3c49bf

Please sign in to comment.