From dbeea5dd0e2b0cc596c7b6c5961aae3e21a6149f Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 8 Mar 2024 14:47:57 +0100 Subject: [PATCH] libvgcode - Precompiler definition of ENABLE_OPENGL_ES moved into CMakeLists.txt --- src/libvgcode/CMakeLists.txt | 7 +- src/libvgcode/include/GCodeInputData.hpp | 1 - src/libvgcode/include/Types.hpp | 2 - src/libvgcode/src/CogMarker.cpp | 2 + src/libvgcode/src/CogMarker.hpp | 2 - src/libvgcode/src/OpenGLUtils.cpp | 21 +++-- src/libvgcode/src/OpenGLUtils.hpp | 12 +-- src/libvgcode/src/SegmentTemplate.cpp | 5 +- src/libvgcode/src/ViewerImpl.cpp | 76 +++++++++---------- src/libvgcode/src/ViewerImpl.hpp | 4 +- src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp | 14 ++-- 11 files changed, 72 insertions(+), 74 deletions(-) diff --git a/src/libvgcode/CMakeLists.txt b/src/libvgcode/CMakeLists.txt index 59611fffac..fe907897f7 100644 --- a/src/libvgcode/CMakeLists.txt +++ b/src/libvgcode/CMakeLists.txt @@ -4,12 +4,9 @@ project(libvgcode) # glad library if (EMSCRIPTEN) set(GLAD_SOURCES -# glad/include/glad/egl.h glad/include/glad/gles2.h -# glad/include/EGL/eglplatform.h glad/include/KHR/khrplatform.h glad/src/gles2.c -# glad/src/egl.c ) else () set(GLAD_SOURCES @@ -67,6 +64,10 @@ set(LIBVGCODE_SOURCES add_library(libvgcode STATIC ${LIBVGCODE_SOURCES}) +if (EMSCRIPTEN) + add_compile_definitions(ENABLE_OPENGL_ES) +endif() + if (WIN32) foreach(_source IN ITEMS ${LIBVGCODE_SOURCES}) get_filename_component(_source_path "${_source}" PATH) diff --git a/src/libvgcode/include/GCodeInputData.hpp b/src/libvgcode/include/GCodeInputData.hpp index 576f93e26a..5085322e37 100644 --- a/src/libvgcode/include/GCodeInputData.hpp +++ b/src/libvgcode/include/GCodeInputData.hpp @@ -5,7 +5,6 @@ #ifndef VGCODE_GCODEINPUTDATA_HPP #define VGCODE_GCODEINPUTDATA_HPP -#include "Types.hpp" #include "PathVertex.hpp" namespace libvgcode { diff --git a/src/libvgcode/include/Types.hpp b/src/libvgcode/include/Types.hpp index 736bf76de8..c1e33b4426 100644 --- a/src/libvgcode/include/Types.hpp +++ b/src/libvgcode/include/Types.hpp @@ -5,8 +5,6 @@ #ifndef VGCODE_TYPES_HPP #define VGCODE_TYPES_HPP -#define VGCODE_ENABLE_OPENGL_ES 0 - #define VGCODE_ENABLE_COG_AND_TOOL_MARKERS 0 #include diff --git a/src/libvgcode/src/CogMarker.cpp b/src/libvgcode/src/CogMarker.cpp index fbf3ef9fcf..dd8ea53644 100644 --- a/src/libvgcode/src/CogMarker.cpp +++ b/src/libvgcode/src/CogMarker.cpp @@ -2,6 +2,8 @@ ///|/ ///|/ libvgcode is released under the terms of the AGPLv3 or higher ///|/ +// needed for tech VGCODE_ENABLE_COG_AND_TOOL_MARKERS +#include "../include/Types.hpp" #include "CogMarker.hpp" #include "OpenGLUtils.hpp" #include "Utils.hpp" diff --git a/src/libvgcode/src/CogMarker.hpp b/src/libvgcode/src/CogMarker.hpp index fd06e3e9d1..df0c683aca 100644 --- a/src/libvgcode/src/CogMarker.hpp +++ b/src/libvgcode/src/CogMarker.hpp @@ -5,8 +5,6 @@ #ifndef VGCODE_COGMARKER_HPP #define VGCODE_COGMARKER_HPP -#include "../include/Types.hpp" - #if VGCODE_ENABLE_COG_AND_TOOL_MARKERS namespace libvgcode { diff --git a/src/libvgcode/src/OpenGLUtils.cpp b/src/libvgcode/src/OpenGLUtils.cpp index dbec1a04c8..bc39b29a4d 100644 --- a/src/libvgcode/src/OpenGLUtils.cpp +++ b/src/libvgcode/src/OpenGLUtils.cpp @@ -3,7 +3,6 @@ ///|/ libvgcode is released under the terms of the AGPLv3 or higher ///|/ -#include "../include/Types.hpp" #include "OpenGLUtils.hpp" #include @@ -28,10 +27,10 @@ void glAssertRecentCallImpl(const char* file_name, unsigned int line, const char case GL_INVALID_OPERATION: { sErr = "Invalid Operation"; break; } case GL_OUT_OF_MEMORY: { sErr = "Out Of Memory"; break; } case GL_INVALID_FRAMEBUFFER_OPERATION: { sErr = "Invalid framebuffer operation"; break; } -#if !VGCODE_ENABLE_OPENGL_ES +#if !defined(ENABLE_OPENGL_ES) case GL_STACK_OVERFLOW: { sErr = "Stack Overflow"; break; } case GL_STACK_UNDERFLOW: { sErr = "Stack Underflow"; break; } -#endif // !VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES default: { sErr = "Unknown"; break; } } std::cout << "OpenGL error in " << file_name << ":" << line << ", function " << function_name << "() : " << (int)err << " - " << sErr << "\n"; @@ -42,9 +41,9 @@ void glAssertRecentCallImpl(const char* file_name, unsigned int line, const char static const char* OPENGL_ES_PREFIXES[] = { "OpenGL ES-CM ", "OpenGL ES-CL ", "OpenGL ES ", nullptr }; bool OpenGLWrapper::s_valid_context = false; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES int OpenGLWrapper::s_max_texture_size = 0; -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES bool OpenGLWrapper::load_opengl(const std::string& context_version) { @@ -69,31 +68,31 @@ bool OpenGLWrapper::load_opengl(const std::string& context_version) if (res != 2) return false; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES s_valid_context = major > 3 || (major == 3 && minor >= 0); const int glad_res = gladLoaderLoadGLES2(); #else s_valid_context = major > 3 || (major == 3 && minor >= 2); const int glad_res = gladLoaderLoadGL(); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES if (glad_res == 0) return false; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES glsafe(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s_max_texture_size)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES return s_valid_context; } void OpenGLWrapper::unload_opengl() { -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES gladLoaderUnloadGLES2(); #else gladLoaderUnloadGL(); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES } } // namespace libvgcode diff --git a/src/libvgcode/src/OpenGLUtils.hpp b/src/libvgcode/src/OpenGLUtils.hpp index 849ffb8230..ad7b370aa2 100644 --- a/src/libvgcode/src/OpenGLUtils.hpp +++ b/src/libvgcode/src/OpenGLUtils.hpp @@ -6,11 +6,11 @@ #define VGCODE_OPENGLUTILS_HPP // OpenGL loader -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES #include "../glad/include/glad/gles2.h" #else #include "../glad/include/glad/gl.h" -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES #include @@ -36,15 +36,15 @@ public: static bool load_opengl(const std::string& context_version); static void unload_opengl(); static bool is_valid_context() { return s_valid_context; } -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES static size_t max_texture_size() { return static_cast(s_max_texture_size); } -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES private: static bool s_valid_context; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES static int s_max_texture_size; -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES }; } // namespace libvgcode diff --git a/src/libvgcode/src/SegmentTemplate.cpp b/src/libvgcode/src/SegmentTemplate.cpp index 134826b187..4e692d5b10 100644 --- a/src/libvgcode/src/SegmentTemplate.cpp +++ b/src/libvgcode/src/SegmentTemplate.cpp @@ -2,7 +2,6 @@ ///|/ ///|/ libvgcode is released under the terms of the AGPLv3 or higher ///|/ -#include "../include/Types.hpp" #include "SegmentTemplate.hpp" #include "OpenGLUtils.hpp" @@ -46,11 +45,11 @@ void SegmentTemplate::init() glsafe(glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id)); glsafe(glBufferData(GL_ARRAY_BUFFER, VERTEX_DATA.size() * sizeof(uint8_t), VERTEX_DATA.data(), GL_STATIC_DRAW)); glsafe(glEnableVertexAttribArray(0)); -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES glsafe(glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 0, (const void*)0)); #else glsafe(glVertexAttribIPointer(0, 1, GL_UNSIGNED_BYTE, 0, (const void*)0)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES glsafe(glBindBuffer(GL_ARRAY_BUFFER, curr_array_buffer)); glsafe(glBindVertexArray(curr_vertex_array)); diff --git a/src/libvgcode/src/ViewerImpl.cpp b/src/libvgcode/src/ViewerImpl.cpp index ebfc6bda7c..80d7451874 100644 --- a/src/libvgcode/src/ViewerImpl.cpp +++ b/src/libvgcode/src/ViewerImpl.cpp @@ -310,7 +310,7 @@ static const std::map DEFAULT_OPTIONS_COLORS{ { { EOptionType::CustomGCodes, { 226, 210, 67 } } } }; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES static std::pair width_height(size_t count) { std::pair ret; @@ -718,7 +718,7 @@ size_t ViewerImpl::TextureData::get_used_gpu_memory() const ret += m_enabled_options_size; return ret; } -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES ViewerImpl::ViewerImpl() { @@ -735,20 +735,20 @@ void ViewerImpl::init(const std::string& opengl_context_version) if (OpenGLWrapper::is_valid_context()) throw std::runtime_error("LibVGCode was unable to initialize the GLAD library.\n"); else { -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES throw std::runtime_error("LibVGCode requires an OpenGL ES context based on OpenGL ES 3.0 or higher.\n"); #else throw std::runtime_error("LibVGCode requires an OpenGL context based on OpenGL 3.2 or higher.\n"); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES } } // segments shader -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_segments_shader_id = init_shader("segments", Segments_Vertex_Shader_ES, Segments_Fragment_Shader_ES); #else m_segments_shader_id = init_shader("segments", Segments_Vertex_Shader, Segments_Fragment_Shader); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES m_uni_segments_view_matrix_id = glGetUniformLocation(m_segments_shader_id, "view_matrix"); m_uni_segments_projection_matrix_id = glGetUniformLocation(m_segments_shader_id, "projection_matrix"); @@ -769,11 +769,11 @@ void ViewerImpl::init(const std::string& opengl_context_version) m_segment_template.init(); // options shader -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_options_shader_id = init_shader("options", Options_Vertex_Shader_ES, Options_Fragment_Shader_ES); #else m_options_shader_id = init_shader("options", Options_Vertex_Shader, Options_Fragment_Shader); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES m_uni_options_view_matrix_id = glGetUniformLocation(m_options_shader_id, "view_matrix"); m_uni_options_projection_matrix_id = glGetUniformLocation(m_options_shader_id, "projection_matrix"); @@ -793,11 +793,11 @@ void ViewerImpl::init(const std::string& opengl_context_version) #if VGCODE_ENABLE_COG_AND_TOOL_MARKERS // cog marker shader -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_cog_marker_shader_id = init_shader("cog_marker", Cog_Marker_Vertex_Shader_ES, Cog_Marker_Fragment_Shader_ES); #else m_cog_marker_shader_id = init_shader("cog_marker", Cog_Marker_Vertex_Shader, Cog_Marker_Fragment_Shader); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES m_uni_cog_marker_world_center_position = glGetUniformLocation(m_cog_marker_shader_id, "world_center_position"); m_uni_cog_marker_scale_factor = glGetUniformLocation(m_cog_marker_shader_id, "scale_factor"); @@ -812,11 +812,11 @@ void ViewerImpl::init(const std::string& opengl_context_version) m_cog_marker.init(32, 1.0f); // tool marker shader -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_tool_marker_shader_id = init_shader("tool_marker", Tool_Marker_Vertex_Shader_ES, Tool_Marker_Fragment_Shader_ES); #else m_tool_marker_shader_id = init_shader("tool_marker", Tool_Marker_Vertex_Shader, Tool_Marker_Fragment_Shader); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES m_uni_tool_marker_world_origin = glGetUniformLocation(m_tool_marker_shader_id, "world_origin"); m_uni_tool_marker_scale_factor = glGetUniformLocation(m_tool_marker_shader_id, "scale_factor"); @@ -873,7 +873,7 @@ void ViewerImpl::reset() m_cog_marker.reset(); #endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_texture_data.reset(); #else m_enabled_segments_count = 0; @@ -889,7 +889,7 @@ void ViewerImpl::reset() delete_buffers(m_heights_widths_angles_buf_id); delete_textures(m_positions_tex_id); delete_buffers(m_positions_buf_id); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES } static void extract_pos_and_or_hwa(const std::vector& vertices, float travels_radius, float wipes_radius, BitSet<>& valid_lines_bitset, @@ -1038,7 +1038,7 @@ void ViewerImpl::load(GCodeInputData&& gcode_data) extract_pos_and_or_hwa(m_vertices, m_travels_radius, m_wipes_radius, m_valid_lines_bitset, &positions, &heights_widths_angles, true); if (!positions.empty()) { -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_texture_data.init(positions.size()); // create and fill position textures m_texture_data.set_positions(positions); @@ -1085,7 +1085,7 @@ void ViewerImpl::load(GCodeInputData&& gcode_data) glsafe(glBindBuffer(GL_TEXTURE_BUFFER, 0)); glsafe(glBindTexture(GL_TEXTURE_BUFFER, old_bound_texture)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES } update_view_full_range(); @@ -1152,7 +1152,7 @@ void ViewerImpl::update_enabled_entities() enabled_segments.push_back(static_cast(i)); } -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES m_texture_data.set_enabled_segments(enabled_segments); m_texture_data.set_enabled_options(enabled_options); #else @@ -1179,7 +1179,7 @@ void ViewerImpl::update_enabled_entities() glsafe(glBufferData(GL_TEXTURE_BUFFER, 0, nullptr, GL_STATIC_DRAW)); glsafe(glBindBuffer(GL_TEXTURE_BUFFER, 0)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES m_settings.update_enabled_entities = false; } @@ -1194,10 +1194,10 @@ static float encode_color(const Color& color) { void ViewerImpl::update_colors() { -#if !VGCODE_ENABLE_OPENGL_ES +#if !defined(ENABLE_OPENGL_ES) if (m_colors_buf_id == 0) return; -#endif // !VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES if (!m_used_extruders.empty()) { // ensure that the number of defined tool colors matches the max id of the used extruders @@ -1221,7 +1221,7 @@ void ViewerImpl::update_colors() encode_color(DUMMY_COLOR) : encode_color(get_vertex_color(m_vertices[i])); } -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES if (!colors.empty()) // update gpu buffer for colors m_texture_data.set_colors(colors); @@ -1232,7 +1232,7 @@ void ViewerImpl::update_colors() glsafe(glBindBuffer(GL_TEXTURE_BUFFER, m_colors_buf_id)); glsafe(glBufferData(GL_TEXTURE_BUFFER, colors.size() * sizeof(float), colors.data(), GL_STATIC_DRAW)); glsafe(glBindBuffer(GL_TEXTURE_BUFFER, 0)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES m_settings.update_colors = false; } @@ -1628,7 +1628,7 @@ size_t ViewerImpl::get_used_gpu_memory() const ret += m_tool_marker.size_in_bytes_gpu(); ret += m_cog_marker.size_in_bytes_gpu(); #endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES ret += m_texture_data.get_used_gpu_memory(); #else ret += m_positions_tex_size; @@ -1636,7 +1636,7 @@ size_t ViewerImpl::get_used_gpu_memory() const ret += m_colors_tex_size; ret += m_enabled_segments_tex_size; ret += m_enabled_options_tex_size; -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES return ret; } @@ -1787,7 +1787,7 @@ void ViewerImpl::update_color_ranges() void ViewerImpl::update_heights_widths() { -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES std::vector heights_widths_angles; heights_widths_angles.reserve(m_vertices.size()); extract_pos_and_or_hwa(m_vertices, m_travels_radius, m_wipes_radius, m_valid_lines_bitset, nullptr, &heights_widths_angles); @@ -1815,7 +1815,7 @@ void ViewerImpl::update_heights_widths() glsafe(glUnmapBuffer(GL_TEXTURE_BUFFER)); glsafe(glBindBuffer(GL_TEXTURE_BUFFER, 0)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES } void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projection_matrix, const Vec3& camera_position) @@ -1823,11 +1823,11 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec if (m_segments_shader_id == 0) return; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES if (m_texture_data.get_enabled_segments_count() == 0) #else if (m_enabled_segments_count == 0) -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES return; int curr_active_texture = 0; @@ -1849,7 +1849,7 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec glsafe(glDisable(GL_CULL_FACE)); -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES int curr_bound_texture = 0; glsafe(glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_bound_texture)); @@ -1885,17 +1885,17 @@ void ViewerImpl::render_segments(const Mat4x4& view_matrix, const Mat4x4& projec glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, m_enabled_segments_buf_id)); m_segment_template.render(m_enabled_segments_count); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES if (curr_cull_face) glsafe(glEnable(GL_CULL_FACE)); glsafe(glUseProgram(curr_shader)); -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES glsafe(glBindTexture(GL_TEXTURE_2D, curr_bound_texture)); #else glsafe(glBindTexture(GL_TEXTURE_BUFFER, curr_bound_texture)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES glsafe(glActiveTexture(curr_active_texture)); } @@ -1904,11 +1904,11 @@ void ViewerImpl::render_options(const Mat4x4& view_matrix, const Mat4x4& project if (m_options_shader_id == 0) return; -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES if (m_texture_data.get_enabled_options_count() == 0) #else if (m_enabled_options_count == 0) -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES return; int curr_active_texture = 0; @@ -1929,7 +1929,7 @@ void ViewerImpl::render_options(const Mat4x4& view_matrix, const Mat4x4& project glsafe(glEnable(GL_CULL_FACE)); -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES int curr_bound_texture = 0; glsafe(glGetIntegerv(GL_TEXTURE_BINDING_2D, &curr_bound_texture)); @@ -1965,17 +1965,17 @@ void ViewerImpl::render_options(const Mat4x4& view_matrix, const Mat4x4& project glsafe(glTexBuffer(GL_TEXTURE_BUFFER, GL_R32UI, m_enabled_options_buf_id)); m_option_template.render(m_enabled_options_count); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES if (!curr_cull_face) glsafe(glDisable(GL_CULL_FACE)); glsafe(glUseProgram(curr_shader)); -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES glsafe(glBindTexture(GL_TEXTURE_2D, curr_bound_texture)); #else glsafe(glBindTexture(GL_TEXTURE_BUFFER, curr_bound_texture)); -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES glsafe(glActiveTexture(curr_active_texture)); } diff --git a/src/libvgcode/src/ViewerImpl.hpp b/src/libvgcode/src/ViewerImpl.hpp index c5e6d8d196..665de8fc93 100644 --- a/src/libvgcode/src/ViewerImpl.hpp +++ b/src/libvgcode/src/ViewerImpl.hpp @@ -332,7 +332,7 @@ private: int m_uni_tool_marker_color_base{ -1 }; #endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS -#if VGCODE_ENABLE_OPENGL_ES +#ifdef ENABLE_OPENGL_ES class TextureData { public: @@ -442,7 +442,7 @@ private: size_t m_colors_tex_size{ 0 }; size_t m_enabled_segments_tex_size{ 0 }; size_t m_enabled_options_tex_size{ 0 }; -#endif // VGCODE_ENABLE_OPENGL_ES +#endif // ENABLE_OPENGL_ES void update_view_full_range(); void update_color_ranges(); diff --git a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp index 2b11420357..c2de3d265a 100644 --- a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp +++ b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp @@ -14,12 +14,14 @@ #include #include -static_assert(VGCODE_ENABLE_OPENGL_ES == ENABLE_OPENGL_ES, -#if ENABLE_OPENGL_ES - "VGCODE_ENABLE_OPENGL_ES must be set to 1"); -#else - "VGCODE_ENABLE_OPENGL_ES must be set to 0"); -#endif // ENABLE_OPENGL_ES +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +//static_assert(VGCODE_ENABLE_OPENGL_ES == ENABLE_OPENGL_ES, +//#if ENABLE_OPENGL_ES +// "VGCODE_ENABLE_OPENGL_ES must be set to 1"); +//#else +// "VGCODE_ENABLE_OPENGL_ES must be set to 0"); +//#endif // ENABLE_OPENGL_ES +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ namespace Slic3r { class Print;