2014-08-23 21:50:11 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: include/wx/qt/glcanvas.cpp
|
|
|
|
// Author: Sean D'Epagnier
|
|
|
|
// Copyright: (c) Sean D'Epagnier 2014
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GLCANVAS_H_
|
|
|
|
#define _WX_GLCANVAS_H_
|
|
|
|
|
2016-08-25 11:56:00 -04:00
|
|
|
#include <GL/gl.h>
|
|
|
|
|
|
|
|
class QGLWidget;
|
|
|
|
class QGLContext;
|
|
|
|
class QGLFormat;
|
2014-08-23 21:50:11 -04:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
|
|
|
|
{
|
|
|
|
public:
|
2018-09-26 13:57:42 -04:00
|
|
|
wxGLContext(wxGLCanvas *win,
|
|
|
|
const wxGLContext *other = NULL,
|
|
|
|
const wxGLContextAttrs *ctxAttrs = NULL);
|
2014-08-23 21:50:11 -04:00
|
|
|
/// virtual ~wxGLContext();
|
|
|
|
|
|
|
|
virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QGLContext *m_glContext;
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_CLASS(wxGLContext);
|
2014-08-23 21:50:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxGLCanvas: OpenGL output window
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
|
|
|
{
|
|
|
|
public:
|
2016-08-30 04:44:32 -04:00
|
|
|
explicit // avoid implicitly converting a wxWindow* to wxGLCanvas
|
2018-09-26 13:57:42 -04:00
|
|
|
wxGLCanvas(wxWindow *parent,
|
|
|
|
const wxGLAttributes& dispAttrs,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxGLCanvasName,
|
|
|
|
const wxPalette& palette = wxNullPalette);
|
|
|
|
|
|
|
|
explicit
|
2014-08-23 21:50:11 -04:00
|
|
|
wxGLCanvas(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const int *attribList = NULL,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxGLCanvasName,
|
|
|
|
const wxPalette& palette = wxNullPalette);
|
|
|
|
|
2018-09-26 13:57:42 -04:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
const wxGLAttributes& dispAttrs,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxGLCanvasName,
|
|
|
|
const wxPalette& palette = wxNullPalette);
|
|
|
|
|
2014-08-23 21:50:11 -04:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxGLCanvasName,
|
|
|
|
const int *attribList = NULL,
|
|
|
|
const wxPalette& palette = wxNullPalette);
|
|
|
|
|
2019-04-05 14:08:53 -04:00
|
|
|
virtual bool SwapBuffers() wxOVERRIDE;
|
2014-08-23 21:50:11 -04:00
|
|
|
|
|
|
|
static bool ConvertWXAttrsToQtGL(const int *wxattrs, QGLFormat &format);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
// wxDECLARE_EVENT_TABLE();
|
|
|
|
wxDECLARE_CLASS(wxGLCanvas);
|
2014-08-23 21:50:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GLCANVAS_H_
|