diff --git a/common/lc_application.cpp b/common/lc_application.cpp index 4f6b790d..2a4f7a07 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -11,6 +11,7 @@ #include "lc_view.h" #include "camera.h" #include "lc_previewwidget.h" +#include "lc_colors.h" #ifdef Q_OS_WIN #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) diff --git a/common/lc_bricklink.cpp b/common/lc_bricklink.cpp index 059ec7bc..c85fbb21 100644 --- a/common/lc_bricklink.cpp +++ b/common/lc_bricklink.cpp @@ -4,6 +4,7 @@ #include "lc_mainwindow.h" #include "lc_string.h" #include "pieceinf.h" +#include "lc_colors.h" static QJsonDocument lcLoadBrickLinkMapping() { diff --git a/common/lc_context.h b/common/lc_context.h index 602a6f01..05ce730b 100644 --- a/common/lc_context.h +++ b/common/lc_context.h @@ -1,7 +1,6 @@ #pragma once #include "lc_math.h" -#include "lc_colors.h" #include "lc_mesh.h" class lcVertexBuffer @@ -105,7 +104,7 @@ struct lcVertexAttribState GLuint VertexBufferObject = 0; }; -class lcContext : protected QOpenGLFunctions +class lcContext : public QOpenGLFunctions { public: lcContext(); diff --git a/common/lc_partselectionwidget.cpp b/common/lc_partselectionwidget.cpp index 67a1227f..125157ae 100644 --- a/common/lc_partselectionwidget.cpp +++ b/common/lc_partselectionwidget.cpp @@ -12,6 +12,7 @@ #include "lc_category.h" #include "lc_traintrack.h" #include "lc_filter.h" +#include "lc_colors.h" Q_DECLARE_METATYPE(QList) diff --git a/common/lc_scene.cpp b/common/lc_scene.cpp index d8c1129c..72dcb164 100644 --- a/common/lc_scene.cpp +++ b/common/lc_scene.cpp @@ -6,6 +6,7 @@ #include "lc_library.h" #include "lc_application.h" #include "object.h" +#include "lc_colors.h" lcScene::lcScene() { diff --git a/common/lc_view.cpp b/common/lc_view.cpp index 3fd998e1..d649c1e2 100644 --- a/common/lc_view.cpp +++ b/common/lc_view.cpp @@ -806,9 +806,10 @@ void lcView::SaveStepImages(const QString& BaseName, bool AddStepSuffix, lcStep bool lcView::BeginRenderToImage(int Width, int Height) { + lcContext* Context = lcContext::GetGlobalOffscreenContext(); GLint MaxTexture; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxTexture); - + + Context->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxTexture); MaxTexture = qMin(MaxTexture, 2048); const int Samples = QSurfaceFormat::defaultFormat().samples(); diff --git a/common/project.cpp b/common/project.cpp index 44545a42..3d168caf 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -18,6 +18,7 @@ #include "lc_modellistdialog.h" #include "lc_bricklink.h" #include "lc_string.h" +#include "lc_colors.h" lcHTMLExportOptions::lcHTMLExportOptions(const Project* Project) { diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp index bc8e3eac..0813b6ff 100644 --- a/qt/lc_qpreferencesdialog.cpp +++ b/qt/lc_qpreferencesdialog.cpp @@ -10,6 +10,9 @@ #include "pieceinf.h" #include "lc_edgecolordialog.h" #include "lc_blenderpreferences.h" +#include "lc_mainwindow.h" +#include "lc_viewwidget.h" +#include "lc_view.h" static const char* gLanguageLocales[] = { @@ -98,17 +101,21 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO ui->ConditionalLinesCheckBox->setChecked(false); ui->ConditionalLinesCheckBox->setEnabled(false); } + + lcViewWidget* Widget = gMainWindow->GetActiveView()->GetWidget(); + QOpenGLContext* Context = Widget->context(); + QOpenGLFunctions* Functions = Context->functions(); #ifndef LC_OPENGLES if (QSurfaceFormat::defaultFormat().samples() > 1) { - glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, mLineWidthRange); - glGetFloatv(GL_SMOOTH_LINE_WIDTH_GRANULARITY, &mLineWidthGranularity); + Functions->glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, mLineWidthRange); + Functions->glGetFloatv(GL_SMOOTH_LINE_WIDTH_GRANULARITY, &mLineWidthGranularity); } else #endif { - glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, mLineWidthRange); + Functions->glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, mLineWidthRange); mLineWidthGranularity = 1.0f; }