2018-05-09 08:47:04 +00:00
|
|
|
#ifndef slic3r_GLCanvas3DManager_hpp_
|
|
|
|
#define slic3r_GLCanvas3DManager_hpp_
|
|
|
|
|
2018-12-06 11:52:28 +00:00
|
|
|
#include "libslic3r/BoundingBox.hpp"
|
2018-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
#include <map>
|
2018-06-11 13:13:13 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2018-10-01 14:48:08 +00:00
|
|
|
class wxWindow;
|
2018-06-11 13:13:13 +00:00
|
|
|
class wxGLCanvas;
|
|
|
|
class wxGLContext;
|
2018-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
2018-06-11 13:13:13 +00:00
|
|
|
|
2018-11-22 14:29:59 +00:00
|
|
|
class BackgroundSlicingProcess;
|
2018-06-11 13:13:13 +00:00
|
|
|
class DynamicPrintConfig;
|
|
|
|
class Model;
|
|
|
|
class ExPolygon;
|
|
|
|
typedef std::vector<ExPolygon> ExPolygons;
|
|
|
|
class ModelObject;
|
|
|
|
class PrintObject;
|
2018-10-03 09:34:39 +00:00
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
2018-06-11 13:13:13 +00:00
|
|
|
class GLCanvas3D;
|
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
class GLCanvas3DManager
|
|
|
|
{
|
2018-06-04 08:14:09 +00:00
|
|
|
struct GLInfo
|
2018-05-09 08:47:04 +00:00
|
|
|
{
|
2018-06-04 08:14:09 +00:00
|
|
|
std::string version;
|
|
|
|
std::string glsl_version;
|
|
|
|
std::string vendor;
|
|
|
|
std::string renderer;
|
|
|
|
|
|
|
|
GLInfo();
|
2018-05-09 08:47:04 +00:00
|
|
|
|
2018-06-20 12:34:20 +00:00
|
|
|
void detect();
|
2018-06-04 08:14:09 +00:00
|
|
|
bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
2018-05-09 08:47:04 +00:00
|
|
|
|
2018-06-04 08:14:09 +00:00
|
|
|
std::string to_string(bool format_as_html, bool extensions) const;
|
2018-05-09 08:47:04 +00:00
|
|
|
};
|
|
|
|
|
2018-10-02 12:01:22 +00:00
|
|
|
enum EMultisampleState : unsigned char
|
|
|
|
{
|
|
|
|
MS_Unknown,
|
|
|
|
MS_Enabled,
|
|
|
|
MS_Disabled
|
|
|
|
};
|
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
typedef std::map<wxGLCanvas*, GLCanvas3D*> CanvasesMap;
|
|
|
|
|
|
|
|
CanvasesMap m_canvases;
|
2018-10-04 08:41:11 +00:00
|
|
|
#if ENABLE_USE_UNIQUE_GLCONTEXT
|
|
|
|
wxGLContext* m_context;
|
|
|
|
#endif // ENABLE_USE_UNIQUE_GLCONTEXT
|
2018-06-04 08:14:09 +00:00
|
|
|
GLInfo m_gl_info;
|
2018-05-09 08:47:04 +00:00
|
|
|
bool m_gl_initialized;
|
|
|
|
bool m_use_legacy_opengl;
|
|
|
|
bool m_use_VBOs;
|
2018-10-02 12:01:22 +00:00
|
|
|
static EMultisampleState s_multisample;
|
2018-05-09 08:47:04 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
GLCanvas3DManager();
|
2018-10-04 08:41:11 +00:00
|
|
|
#if ENABLE_USE_UNIQUE_GLCONTEXT
|
|
|
|
~GLCanvas3DManager();
|
|
|
|
#endif // ENABLE_USE_UNIQUE_GLCONTEXT
|
2018-05-09 08:47:04 +00:00
|
|
|
|
2018-06-11 13:49:04 +00:00
|
|
|
bool add(wxGLCanvas* canvas);
|
2018-05-09 08:47:04 +00:00
|
|
|
bool remove(wxGLCanvas* canvas);
|
|
|
|
void remove_all();
|
|
|
|
|
|
|
|
unsigned int count() const;
|
|
|
|
|
|
|
|
void init_gl();
|
2018-06-04 08:14:09 +00:00
|
|
|
std::string get_gl_info(bool format_as_html, bool extensions) const;
|
2018-05-09 08:47:04 +00:00
|
|
|
|
2018-06-04 11:15:28 +00:00
|
|
|
bool init(wxGLCanvas* canvas);
|
2018-05-23 07:57:44 +00:00
|
|
|
|
2018-10-11 08:24:19 +00:00
|
|
|
GLCanvas3D* get_canvas(wxGLCanvas* canvas);
|
2018-05-18 12:08:59 +00:00
|
|
|
|
2018-10-02 12:01:22 +00:00
|
|
|
static bool can_multisample() { return s_multisample == MS_Enabled; }
|
2018-10-01 14:48:08 +00:00
|
|
|
static wxGLCanvas* create_wxglcanvas(wxWindow *parent);
|
2018-10-02 12:01:22 +00:00
|
|
|
|
2018-05-09 08:47:04 +00:00
|
|
|
private:
|
|
|
|
CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas);
|
|
|
|
CanvasesMap::const_iterator _get_canvas(wxGLCanvas* canvas) const;
|
2018-06-04 11:15:28 +00:00
|
|
|
|
|
|
|
bool _init(GLCanvas3D& canvas);
|
2018-10-02 12:01:22 +00:00
|
|
|
static void _detect_multisample(int* attribList);
|
2018-05-09 08:47:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
#endif // slic3r_GLCanvas3DManager_hpp_
|