#ifndef CANVAS_HPP #define CANVAS_HPP #include // For compilers that support precompilation, includes "wx/wx.h". #include #ifndef WX_PRECOMP #include #endif #include #include #include "GLScene.hpp" namespace Slic3r { namespace GL { class Canvas: public wxGLCanvas, public Slic3r::GL::Display { std::unique_ptr m_context; public: void set_active(long w, long h) override { SetCurrent(*m_context); Slic3r::GL::Display::set_active(w, h); } void swap_buffers() override { SwapBuffers(); } template Canvas(Args &&...args): wxGLCanvas(std::forward(args)...) { auto ctx = new wxGLContext(this); if (!ctx || !ctx->IsOK()) { wxMessageBox("Could not create OpenGL context.", "Error", wxOK | wxICON_ERROR); return; } m_context.reset(ctx); } }; }} // namespace Slic3r::GL #endif // CANVAS_HPP