mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 00:45:55 +08:00
Tech ENABLE_GL_CORE_PROFILE - Fix in generate_system_info_json()
Fixed conflicts during rebase with master
This commit is contained in:
parent
9dda2b0ed5
commit
172929259a
@ -123,14 +123,10 @@ void GLCanvas3D::LayersEditing::init()
|
||||
{
|
||||
glsafe(::glGenTextures(1, (GLuint*)&m_z_texture_id));
|
||||
glsafe(::glBindTexture(GL_TEXTURE_2D, m_z_texture_id));
|
||||
#if _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
if (!OpenGLManager::get_gl_info().is_core_profile() || !OpenGLManager::get_gl_info().is_mesa()) {
|
||||
#endif // _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP));
|
||||
#if _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
}
|
||||
#endif // _WIN32 && ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1));
|
||||
@ -5325,14 +5321,18 @@ void GLCanvas3D::_picking_pass()
|
||||
|
||||
glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||
|
||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
m_camera_clipping_plane = m_gizmos.get_clipping_plane();
|
||||
if (m_camera_clipping_plane.is_active()) {
|
||||
::glClipPlane(GL_CLIP_PLANE0, (GLdouble*)m_camera_clipping_plane.get_data());
|
||||
::glClipPlane(GL_CLIP_PLANE0, (GLdouble*)m_camera_clipping_plane.get_data().data());
|
||||
::glEnable(GL_CLIP_PLANE0);
|
||||
}
|
||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
_render_volumes_for_picking();
|
||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
if (m_camera_clipping_plane.is_active())
|
||||
::glDisable(GL_CLIP_PLANE0);
|
||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
|
@ -66,19 +66,15 @@ const std::string& OpenGLManager::GLInfo::get_renderer() const
|
||||
return m_renderer;
|
||||
}
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
bool OpenGLManager::GLInfo::is_core_profile() const
|
||||
{
|
||||
return !GLEW_ARB_compatibility;
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
bool OpenGLManager::GLInfo::is_mesa() const
|
||||
{
|
||||
return boost::icontains(m_version, "mesa");
|
||||
}
|
||||
#endif // _WIN32
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
int OpenGLManager::GLInfo::get_max_tex_size() const
|
||||
{
|
||||
@ -198,25 +194,11 @@ std::string OpenGLManager::GLInfo::to_string(bool for_github) const
|
||||
out << b_start << "GLSL version: " << b_end << m_glsl_version << line_end;
|
||||
|
||||
{
|
||||
std::vector<std::string> extensions_list;
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::string extensions_str;
|
||||
if (is_core_profile()) {
|
||||
GLint n = 0;
|
||||
glsafe(::glGetIntegerv(GL_NUM_EXTENSIONS, &n));
|
||||
for (GLint i = 0; i < n; ++i) {
|
||||
const char* extension = (const char*)::glGetStringi(GL_EXTENSIONS, i);
|
||||
glcheck();
|
||||
if (extension != nullptr)
|
||||
extensions_list.emplace_back(extension);
|
||||
}
|
||||
}
|
||||
else {
|
||||
extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
}
|
||||
std::vector<std::string> extensions_list = get_extensions_list();
|
||||
#else
|
||||
const std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
std::vector<std::string> extensions_list;
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
@ -239,6 +221,31 @@ std::string OpenGLManager::GLInfo::to_string(bool for_github) const
|
||||
return out.str();
|
||||
}
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::vector<std::string> OpenGLManager::GLInfo::get_extensions_list() const
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
|
||||
if (is_core_profile()) {
|
||||
GLint n = 0;
|
||||
glsafe(::glGetIntegerv(GL_NUM_EXTENSIONS, &n));
|
||||
ret.reserve(n);
|
||||
for (GLint i = 0; i < n; ++i) {
|
||||
const char* extension = (const char*)::glGetStringi(GL_EXTENSIONS, i);
|
||||
glcheck();
|
||||
if (extension != nullptr)
|
||||
ret.emplace_back(extension);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
boost::split(ret, extensions_str, boost::is_any_of(" "), boost::token_compress_on);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
OpenGLManager::GLInfo OpenGLManager::s_gl_info;
|
||||
bool OpenGLManager::s_compressed_textures_supported = false;
|
||||
OpenGLManager::EMultisampleState OpenGLManager::s_multisample = OpenGLManager::EMultisampleState::Unknown;
|
||||
|
@ -43,12 +43,8 @@ public:
|
||||
const std::string& get_vendor() const;
|
||||
const std::string& get_renderer() const;
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
bool is_core_profile() const;
|
||||
#if _WIN32
|
||||
bool is_mesa() const;
|
||||
#endif // _WIN32
|
||||
#endif // ENABLE_OPENGL_ES
|
||||
|
||||
int get_max_tex_size() const;
|
||||
float get_max_anisotropy() const;
|
||||
@ -60,6 +56,10 @@ public:
|
||||
// Otherwise HTML formatted for the system info dialog.
|
||||
std::string to_string(bool for_github) const;
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::vector<std::string> get_extensions_list() const;
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
private:
|
||||
void detect() const;
|
||||
};
|
||||
|
@ -55,8 +55,10 @@ static const std::string SEND_SYSTEM_INFO_DOMAIN = "prusa3d.com";
|
||||
static const std::string SEND_SYSTEM_INFO_URL = "https://files." + SEND_SYSTEM_INFO_DOMAIN + "/wp-json/v1/ps";
|
||||
|
||||
|
||||
#if !ENABLE_GL_CORE_PROFILE
|
||||
// Declaration of a free function defined in OpenGLManager.cpp:
|
||||
std::string gl_get_string_safe(GLenum param, const std::string& default_value);
|
||||
#endif // !ENABLE_GL_CORE_PROFILE
|
||||
|
||||
|
||||
// A dialog with the information text and buttons send/dont send/ask later.
|
||||
@ -507,9 +509,13 @@ static std::string generate_system_info_json()
|
||||
opengl_node.put("Vendor", OpenGLManager::get_gl_info().get_vendor());
|
||||
opengl_node.put("Renderer", OpenGLManager::get_gl_info().get_renderer());
|
||||
// Generate list of OpenGL extensions:
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
std::vector<std::string> extensions_list = OpenGLManager::get_gl_info().get_extensions_list();
|
||||
#else
|
||||
std::string extensions_str = gl_get_string_safe(GL_EXTENSIONS, "");
|
||||
std::vector<std::string> extensions_list;
|
||||
boost::split(extensions_list, extensions_str, boost::is_any_of(" "), boost::token_compress_off);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
std::sort(extensions_list.begin(), extensions_list.end());
|
||||
pt::ptree extensions_node;
|
||||
for (const std::string& s : extensions_list) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user