Big wxGL classes refactoring/cleanup:
1. Provide the same API, especially, but not limited to, wxGLCanvas and wxCLContext ctors (which were completely different in all ports) 2. Extracted common parts into wxGLCanvas/ContextBase classes 3. Deprecate the old API using implicitly created wxGLContext git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,84 +20,62 @@
|
||||
|
||||
class WXDLLIMPEXP_GL wxGLCanvas;
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
|
||||
//DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
|
||||
|
||||
// ========================================================================
|
||||
// wxGLContext
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_GL wxGLContext: public wxObject
|
||||
|
||||
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
|
||||
{
|
||||
public:
|
||||
wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette);
|
||||
|
||||
wxGLContext( bool isRGB, wxGLCanvas *win,
|
||||
const wxPalette& WXUNUSED(palette),
|
||||
const wxGLContext *other /* for sharing display lists */ );
|
||||
wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
|
||||
|
||||
virtual ~wxGLContext();
|
||||
|
||||
virtual void SetCurrent(const wxGLCanvas& win) const;
|
||||
|
||||
void SetCurrent();
|
||||
WX_NSOpenGLContext GetNSOpenGLContext() const
|
||||
{ return m_cocoaNSOpenGLContext; }
|
||||
|
||||
void SetColour(const wxChar *colour);
|
||||
|
||||
void SwapBuffers();
|
||||
|
||||
|
||||
inline wxWindow* GetWindow() const
|
||||
{ return m_window; }
|
||||
|
||||
inline WX_NSOpenGLContext GetNSOpenGLContext() const
|
||||
{ return m_cocoaNSOpenGLContext; }
|
||||
|
||||
public:
|
||||
private:
|
||||
WX_NSOpenGLContext m_cocoaNSOpenGLContext;
|
||||
wxWindow* m_window;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// wxGLCanvas
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow// , protected wxCocoaNSOpenGLView
|
||||
|
||||
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
||||
// , protected wxCocoaNSOpenGLView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGLCanvas)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxGLCanvas()
|
||||
: m_glContext(NULL)
|
||||
{ }
|
||||
wxGLCanvas(wxWindow *parent, wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxGLCanvasName,
|
||||
int *attribList = NULL, const wxPalette& palette = wxNullPalette);
|
||||
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLContext *shared = NULL,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxGLCanvasName,
|
||||
int *attribList = NULL, const wxPalette& palette = wxNullPalette);
|
||||
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)
|
||||
{
|
||||
Create(parent, id, pos, size, style, name, attribList, palette);
|
||||
}
|
||||
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
const wxGLCanvas *shared = NULL,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxGLCanvasName,
|
||||
int *attribList = NULL, const wxPalette& palette = wxNullPalette);
|
||||
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);
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxGLCanvasName);
|
||||
virtual ~wxGLCanvas();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -110,16 +88,11 @@ protected:
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
void SetCurrent();
|
||||
void SwapBuffers();
|
||||
virtual void SwapBuffers();
|
||||
|
||||
void OnSize(wxSizeEvent& event)
|
||||
{}
|
||||
inline wxGLContext* GetContext() const
|
||||
{ return m_glContext; }
|
||||
protected:
|
||||
wxGLContext *m_glContext;
|
||||
wxPalette m_palette;
|
||||
|
||||
NSOpenGLView *GetNSOpenGLView() const
|
||||
{ return (NSOpenGLView *)m_cocoaNSView; }
|
||||
};
|
||||
|
||||
#endif //ndef _WX_COCOA_GLCANVAS_H__
|
||||
|
Reference in New Issue
Block a user