27 #include "hugin_config.h"
28 #if defined HAVE_EPOXY && HAVE_EPOXY
31 #include <epoxy/wgl.h>
37 #include <wx/settings.h>
38 #include <wx/dcclient.h>
49 #if !defined HAVE_EPOXY || !HAVE_EPOXY
55 BEGIN_EVENT_TABLE(
GLViewer, wxGLCanvas)
62 EVT_ENTER_WINDOW(
GLViewer::MouseEnter)
63 EVT_LEAVE_WINDOW(
GLViewer::MouseLeave)
66 EVT_MOUSE_EVENTS(
GLViewer::MouseButtons)
75 HuginBase::Panorama &pano,
78 wxGLContext * shared_context
80 wxGLCanvas(parent, wxID_ANY, args, wxDefaultPosition, wxDefaultSize,
81 0, wxT("GLPreviewCanvas"), wxNullPalette)
84 m_glContext =
new wxGLContext(
this, shared_context);
87 m_visualization_state = 0;
93 m_background_color = frame->GetPreviewBackgroundColor();
95 started_creation =
false;
97 m_toolsInitialized =
false;
133 #if defined HAVE_EPOXY && HAVE_EPOXY
135 if (!(epoxy_gl_version() > 11 && epoxy_has_gl_extension(
"GL_ARB_multitexture")))
138 wxConfigBase::Get()->Write(wxT(
"DisableOpenGL"), 1l);
139 wxConfigBase::Get()->Flush();
140 DEBUG_ERROR(
"Sorry, OpenGL 1.1 + GL_ARB_multitexture extension required.");
142 wxMessageBox(_(
"Sorry, the fast preview window requires a system which supports OpenGL version 1.1 with the GL_ARB_multitexture extension.\nThe fast preview cannot be opened.\n\nHugin has been configured to start without fast preview.\nPlease restart Hugin."), _(
"Error"), wxOK | wxICON_ERROR);
149 GLenum error_state = glewInit();
151 if (error_state != GLEW_OK)
156 << glewGetErrorString(error_state) <<
".");
158 wxMessageBox(_(
"Error initializing GLEW\nFast preview window can not be opened."),_(
"Error"), wxOK | wxICON_ERROR);
163 if (!(GLEW_VERSION_1_1 && GLEW_ARB_multitexture))
166 wxConfigBase::Get()->Write(wxT(
"DisableOpenGL"), 1l);
167 wxConfigBase::Get()->Flush();
168 DEBUG_ERROR(
"Sorry, OpenGL 1.1 + GL_ARB_multitexture extension required.");
170 wxMessageBox(_(
"Sorry, the fast preview window requires a system which supports OpenGL version 1.1 with the GL_ARB_multitexture extension.\nThe fast preview cannot be opened.\n\nHugin has been configured to start without fast preview.\nPlease restart Hugin."),_(
"Error"), wxOK | wxICON_ERROR);
200 GLint countMultiTexture;
201 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,&countMultiTexture);
246 GLint countMultiTexture;
247 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,&countMultiTexture);
329 if(!IsShown())
return;
366 if(!IsShown())
return;
372 wxSize clientSize = GetClientSize();
373 #if defined __WXGTK3__ || defined __WXOSX__
374 m_scale = GetContentScaleFactor();
394 #if defined __WXMAC__ && wxCHECK_VERSION(3,1,0)
395 wxColour col(128,128,128);
397 wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
403 wxSize clientSize = GetClientSize();
404 #if defined __WXGTK3__ || defined __WXOSX__
405 m_scale = GetContentScaleFactor();
static size_t m_view_state_observer
void MouseButtons(wxMouseEvent &e)
void MouseLeave(wxMouseEvent &e)
The OpenGL preview frame.
void KeyDown(wxKeyEvent &e)
PanosphereOverviewVisualizationState * panosphere_m_visualization_state
virtual void SetLayoutScale(double scale)
virtual vigra::Diff2D Resize(int width, int height)=0
Resize the viewport because the window's dimensions have changed.
void SetPhotometricCorrect(bool state)
PlaneOverviewToolHelper * plane_m_tool_helper
subclass for the preview canvas
void setInsideView(bool insideView)
void Resized(wxSizeEvent &e)
HuginBase::Panorama * m_pano
void SetLayoutScale(double scale)
void MouseMotion(wxMouseEvent &e)
include file for the hugin project
wxGLContext * m_glContext
void KeyUp(wxKeyEvent &e)
static void RefreshWrapper(void *obj)
GLPlaneOverviewRenderer * plane_m_renderer
static bool initialised_glew
void OnEraseBackground(wxEraseEvent &e)
void SetPhotometricCorrect(bool state)
void SetMode(OverviewMode mode)
PlaneOverviewVisualizationState * plane_m_visualization_state
void MakePreviewTools(PreviewToolHelper *helper)
MeshManager * GetMeshManager()
subclass for the plane overview mode
void MouseEnter(wxMouseEvent &e)
EVT_ERASE_BACKGROUND(wxTreeListHeaderWindow::OnEraseBackground) void wxTreeListHeaderWindow
TextureManager * GetTextureManager()
const bool hasPendingChanges() const
return if the panorama class has pending changes normally all controls listen to panoramaChanges noti...
virtual void SetLayoutMode(bool state)
void MakePanosphereOverviewTools(PanosphereOverviewToolHelper *helper)
VisualizationState * m_visualization_state
bool RequireRecalculateViewport()
void MakePlaneOverviewTools(PlaneOverviewToolHelper *helper)
PanosphereOverviewToolHelper * panosphere_m_tool_helper
subclass for the panosphere overview mode
virtual void SetLayoutScale(double scale)
include file for the hugin project
virtual void SetLayoutMode(bool state)
void SetBackground(unsigned char red, unsigned char green, unsigned char blue)
static const double scale_diff
scale factor to be used for the layout mode TODO: test this for more scenarios
GLOverview * getOverview()
void SetViewerBackground(wxColour col)
GLPanosphereOverviewRenderer * panosphere_m_renderer
void SetPreviewBackgroundColor(const wxColour c)
sets the preview background color
ToolHelper * m_tool_helper
void SetLayoutMode(bool state)
Turn layout mode on or off.
static ViewState * m_view_state
void RedrawE(wxPaintEvent &e)
wxColour m_background_color
void MouseWheel(wxMouseEvent &e)
A wxWidget to display the fast preview.