]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/glcanvas.mm
fix the definition of many static functions marked as 'const' or functions which...
[wxWidgets.git] / src / cocoa / glcanvas.mm
CommitLineData
bd2af428
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: cocoa/glcanvas.mm
3// Purpose: wxGLContext, wxGLCanvas
4// Author: David Elliott
5// Modified by:
6// Created: 2004/09/29
7// RCS-ID: $Id$
8// Copyright: (c) 2004 David Elliott
9// Licence: wxWidgets licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#if wxUSE_GLCANVAS
15
16#ifndef WX_PRECOMP
17 #include "wx/app.h"
18#endif //WX_PRECOMP
19#include "wx/glcanvas.h"
20
21#include "wx/cocoa/autorelease.h"
22
23#import <AppKit/NSOpenGL.h>
24#import <AppKit/NSOpenGLView.h>
25
dc3065a5 26wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other)
ce0c732e 27{
dc3065a5 28 // TODO
ce0c732e
VZ
29}
30
dc3065a5 31wxGLContext::~wxGLContext()
bd2af428 32{
bd2af428
DE
33}
34
dc3065a5 35void wxGLContext::SetCurrent(const wxGLCanvas& win) const
bd2af428 36{
dc3065a5 37 [[win.GetNSOpenGLView() openGLContext] makeCurrentContext];
bd2af428
DE
38}
39
dc3065a5
VZ
40IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
41// WX_IMPLEMENT_COCOA_OWNER(wxGLCanvas,NSOpenGLView,NSView,NSView)
42
43bool wxGLCanvas::Create(wxWindow *parent,
44 wxWindowID winid,
45 const wxPoint& pos,
46 const wxSize& size,
47 long style,
48 const wxString& name,
49 const int *attribList,
50 const wxPalette& palette)
bd2af428
DE
51{
52 wxAutoNSAutoreleasePool pool;
53 if(!CreateBase(parent,winid,pos,size,style,wxDefaultValidator,name))
54 return false;
55 SetNSView([[NSOpenGLView alloc] initWithFrame: MakeDefaultNSRect(size)
56 pixelFormat:[NSOpenGLView defaultPixelFormat]]);
57 [m_cocoaNSView release];
58 if(m_parent)
59 m_parent->CocoaAddChild(this);
60 SetInitialFrameRect(pos,size);
61
62 return true;
63}
64
65wxGLCanvas::~wxGLCanvas()
66{
67}
68
bd2af428
DE
69void wxGLCanvas::SwapBuffers()
70{
dc3065a5 71 [[GetNSOpenGLView() openGLContext] flushBuffer];
bd2af428
DE
72}
73
74#endif // wxUSE_GLCANVAS