Graphics Preferences: Anti-aliasing + FPS (#13538)
* Expose Antialiasing velues Expose Antialiasing multipliers. Default to 4 as current implementation but enables the user to disable it to improve performante or increase sampling to improve quality. * FXAA * Improve descriptions * Require restart when MSAA setting changes Detect changes to the OpenGL MSAA (multisample anti-aliasing) preference when opening Preferences and prompt the user to restart the application to apply the change. Adds a constant key for the MSAA setting, stores the previous value, checks for changes (similar to the existing FXAA handling), and shows a warning dialog explaining the restart will close the current project without saving. If the user accepts, recreate_GUI is invoked to apply the MSAA change immediately. * Revert "Require restart when MSAA setting changes" This reverts commit dde134d346c3849598c91d025d2faed1b51c8a22. * Menu and FPS options * Fix FPS limiter and remove VSYNC * Grouped FPS settings and mode up rigth fps counter --------- Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "I18N.hpp"
|
||||
#include "3DScene.hpp"
|
||||
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
#include "libslic3r/Platform.hpp"
|
||||
|
||||
#include <glad/gl.h>
|
||||
@@ -408,6 +409,13 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas, const std::pair<i
|
||||
|
||||
wxGLCanvas* OpenGLManager::create_wxglcanvas(wxWindow& parent)
|
||||
{
|
||||
int antialiasing_samples = 4;
|
||||
if (const AppConfig* app_config = get_app_config(); app_config != nullptr) {
|
||||
const std::string value = app_config->get(SETTING_OPENGL_AA_SAMPLES);
|
||||
if (value == "0" || value == "2" || value == "4" || value == "8" || value == "16")
|
||||
antialiasing_samples = ::atoi(value.c_str());
|
||||
}
|
||||
|
||||
int attribList[] = {
|
||||
WX_GL_RGBA,
|
||||
WX_GL_DOUBLEBUFFER,
|
||||
@@ -421,19 +429,26 @@ wxGLCanvas* OpenGLManager::create_wxglcanvas(wxWindow& parent)
|
||||
WX_GL_DEPTH_SIZE, 24,
|
||||
//BBS: turn on stencil buffer for outline
|
||||
WX_GL_STENCIL_SIZE, 8,
|
||||
WX_GL_SAMPLE_BUFFERS, GL_TRUE,
|
||||
WX_GL_SAMPLES, 4,
|
||||
WX_GL_SAMPLE_BUFFERS, antialiasing_samples > 0 ? GL_TRUE : GL_FALSE,
|
||||
WX_GL_SAMPLES, antialiasing_samples,
|
||||
0
|
||||
};
|
||||
|
||||
if (s_multisample == EMultisampleState::Unknown) {
|
||||
constexpr int sample_buffers_value_idx = 15;
|
||||
constexpr int samples_value_idx = 17;
|
||||
|
||||
if (antialiasing_samples <= 0)
|
||||
s_multisample = EMultisampleState::Disabled;
|
||||
else if (s_multisample == EMultisampleState::Unknown) {
|
||||
detect_multisample(attribList);
|
||||
// // debug output
|
||||
// std::cout << "Multisample " << (can_multisample() ? "enabled" : "disabled") << std::endl;
|
||||
}
|
||||
|
||||
if (! can_multisample())
|
||||
attribList[12] = 0;
|
||||
if (! can_multisample()) {
|
||||
attribList[sample_buffers_value_idx] = GL_FALSE;
|
||||
attribList[samples_value_idx] = 0;
|
||||
}
|
||||
|
||||
wxGLCanvas* canvas = new wxGLCanvas(&parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
||||
// The GL canvas paints its entire surface, so background erasing is unnecessary.
|
||||
|
||||
Reference in New Issue
Block a user