Files
wxWidgets/src/cocoa/glcanvas.mm
Dimitri Schoolwerth 80fdcdb90e No changes, synchronised source names that appear commented at the top of files with the actual path to the files.
Fixed commented names (path, filename, and extension) of files in include/ and src/. Prepended the names in src/ with "src/" everywhere, while starting those in include/wx/ with "wx/".

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-20 00:14:35 +00:00

75 lines
1.8 KiB
Plaintext

/////////////////////////////////////////////////////////////////////////////
// Name: src/cocoa/glcanvas.mm
// Purpose: wxGLContext, wxGLCanvas
// Author: David Elliott
// Modified by:
// Created: 2004/09/29
// RCS-ID: $Id$
// Copyright: (c) 2004 David Elliott
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#if wxUSE_GLCANVAS
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif //WX_PRECOMP
#include "wx/glcanvas.h"
#include "wx/cocoa/autorelease.h"
#import <AppKit/NSOpenGL.h>
#import <AppKit/NSOpenGLView.h>
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)
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))
return false;
SetNSView([[NSOpenGLView alloc] initWithFrame: MakeDefaultNSRect(size)
pixelFormat:[NSOpenGLView defaultPixelFormat]]);
[m_cocoaNSView release];
if(m_parent)
m_parent->CocoaAddChild(this);
SetInitialFrameRect(pos,size);
return true;
}
wxGLCanvas::~wxGLCanvas()
{
}
void wxGLCanvas::SwapBuffers()
{
[[GetNSOpenGLView() openGLContext] flushBuffer];
}
#endif // wxUSE_GLCANVAS