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:
Vadim Zeitlin
2007-04-10 17:38:55 +00:00
parent 1f602af615
commit dc3065a56f
25 changed files with 1860 additions and 1996 deletions

View File

@@ -23,42 +23,31 @@
#import <AppKit/NSOpenGL.h>
#import <AppKit/NSOpenGLView.h>
IMPLEMENT_DYNAMIC_CLASS(wxGLCanvas, wxWindow)
BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
END_EVENT_TABLE()
wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other)
{
// TODO
}
wxGLContext::~wxGLContext()
{
}
void wxGLContext::SetCurrent(const wxGLCanvas& win) const
{
[[win.GetNSOpenGLView() openGLContext] makeCurrentContext];
}
IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
// WX_IMPLEMENT_COCOA_OWNER(wxGLCanvas,NSOpenGLView,NSView,NSView)
wxGLCanvas::wxGLCanvas(wxWindow *parent,
wxWindowID winid, const wxPoint& pos, const wxSize& size,
long style, const wxString& name,
int *attribList, const wxPalette& palette)
{
Create(parent,winid,pos,size,style,name);
}
wxGLCanvas::wxGLCanvas(wxWindow *parent,
const wxGLContext *shared,
wxWindowID winid, const wxPoint& pos, const wxSize& size,
long style, const wxString& name,
int *attribList, const wxPalette& palette)
{
Create(parent,winid,pos,size,style,name);
}
wxGLCanvas::wxGLCanvas(wxWindow *parent,
const wxGLCanvas *shared,
wxWindowID winid, const wxPoint& pos, const wxSize& size,
long style, const wxString& name,
int *attribList, const wxPalette& palette)
{
Create(parent,winid,pos,size,style,name);
}
bool wxGLCanvas::Create(wxWindow *parent, wxWindowID winid,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
bool wxGLCanvas::Create(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name,
const int *attribList,
const wxPalette& palette)
{
wxAutoNSAutoreleasePool pool;
if(!CreateBase(parent,winid,pos,size,style,wxDefaultValidator,name))
@@ -77,14 +66,9 @@ wxGLCanvas::~wxGLCanvas()
{
}
void wxGLCanvas::SetCurrent()
{
[[(NSOpenGLView*)m_cocoaNSView openGLContext] makeCurrentContext];
}
void wxGLCanvas::SwapBuffers()
{
[[(NSOpenGLView*)m_cocoaNSView openGLContext] flushBuffer];
[[GetNSOpenGLView() openGLContext] flushBuffer];
}
#endif // wxUSE_GLCANVAS