mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 05:25:59 +08:00
Added tech ENABLE_OPENGL_ES_2_0:
ENABLE_OPENGL_ES -> Use the default version of OpenGL ES given by the driver ENABLE_OPENGL_ES_2_0-> Select OpenGL ES 2.0 as minimum version
This commit is contained in:
parent
dd86650c5e
commit
0260c81c9e
@ -57,6 +57,8 @@
|
||||
#define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable OpenGL ES
|
||||
#define ENABLE_OPENGL_ES (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||
// Enable OpenGL ES forcing ES 2.0 as min version
|
||||
#define ENABLE_OPENGL_ES_2_0 (0 && ENABLE_OPENGL_ES)
|
||||
// Enable OpenGL core profile context (tested against Mesa 20.1.8 on Windows)
|
||||
#define ENABLE_GL_CORE_PROFILE (1 && ENABLE_LEGACY_OPENGL_REMOVAL && !ENABLE_OPENGL_ES)
|
||||
// Shows an imgui dialog with GLModel statistics data
|
||||
|
@ -151,29 +151,12 @@ namespace GUI {
|
||||
m_rectangle.reset();
|
||||
|
||||
GLModel::Geometry init_data;
|
||||
#if ENABLE_OPENGL_ES
|
||||
if (wxGetApp().is_gl_version_greater_or_equal_to(3, 1)) {
|
||||
#if ENABLE_GL_CORE_PROFILE || ENABLE_OPENGL_ES
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P4 };
|
||||
init_data.reserve_vertices(8);
|
||||
init_data.reserve_indices(8);
|
||||
}
|
||||
else {
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::LineLoop, GLModel::Geometry::EVertexLayout::P2 };
|
||||
init_data.reserve_vertices(4);
|
||||
init_data.reserve_indices(4);
|
||||
}
|
||||
#elif ENABLE_GL_CORE_PROFILE
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P4 };
|
||||
init_data.reserve_vertices(8);
|
||||
init_data.reserve_indices(8);
|
||||
#else
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::LineLoop, GLModel::Geometry::EVertexLayout::P2 };
|
||||
init_data.reserve_vertices(4);
|
||||
init_data.reserve_indices(4);
|
||||
#endif // ENABLE_OPENGL_ES
|
||||
|
||||
// vertices
|
||||
#if ENABLE_GL_CORE_PROFILE || ENABLE_OPENGL_ES
|
||||
const float width = right - left;
|
||||
const float height = top - bottom;
|
||||
float perimeter = 0.0f;
|
||||
@ -200,6 +183,11 @@ namespace GUI {
|
||||
init_data.add_line(4, 5);
|
||||
init_data.add_line(6, 7);
|
||||
#else
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::LineLoop, GLModel::Geometry::EVertexLayout::P2 };
|
||||
init_data.reserve_vertices(4);
|
||||
init_data.reserve_indices(4);
|
||||
|
||||
// vertices
|
||||
init_data.add_vertex(Vec2f(left, bottom));
|
||||
init_data.add_vertex(Vec2f(right, bottom));
|
||||
init_data.add_vertex(Vec2f(right, top));
|
||||
|
@ -316,7 +316,11 @@ bool OpenGLManager::init_gl()
|
||||
s_framebuffers_type = EFramebufferType::Unknown;
|
||||
|
||||
#if ENABLE_OPENGL_ES
|
||||
#if ENABLE_OPENGL_ES_2_0
|
||||
bool valid_version = s_gl_info.is_version_greater_or_equal_to(2, 0);
|
||||
#else
|
||||
bool valid_version = true;
|
||||
#endif // ENABLE_OPENGL_ES_2_0
|
||||
#elif ENABLE_GL_CORE_PROFILE
|
||||
bool valid_version = s_gl_info.is_core_profile() ? s_gl_info.is_version_greater_or_equal_to(3, 3) : s_gl_info.is_version_greater_or_equal_to(2, 0);
|
||||
#else
|
||||
@ -363,7 +367,11 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas)
|
||||
if (m_context == nullptr) {
|
||||
#if ENABLE_OPENGL_ES
|
||||
wxGLContextAttrs attrs;
|
||||
#if ENABLE_OPENGL_ES_2_0
|
||||
attrs.ES2().MajorVersion(2).EndList();
|
||||
#else
|
||||
attrs.ES2().EndList();
|
||||
#endif // ENABLE_OPENGL_ES_2_0
|
||||
m_context = new wxGLContext(&canvas, nullptr, &attrs);
|
||||
#elif ENABLE_GL_CORE_PROFILE
|
||||
wxGLContextAttrs attrs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user