openscenegraph
GraphicsHandleCocoa
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGVIEWER_GRAPHICSHANDLECOCOA
15#define OSGVIEWER_GRAPHICSHANDLECOCOA 1
16
17#include <osgViewer/Export>
18
19
20#ifdef __OBJC__
21@class NSOpenGLContext;
22#else
23class NSOpenGLContext;
24#endif
25
26namespace osgViewer
27{
28
29/** Class to encapsulate platform-specific OpenGL context handle variables.
30 * Derived osg::GraphicsContext classes can inherit from this class to
31 * share OpenGL resources.*/
32
33class OSGVIEWER_EXPORT GraphicsHandleCocoa
34{
35 public:
36
37 GraphicsHandleCocoa():
38 _context(0) {}
39
40 /** Set native AGL graphics context.*/
41 inline void setNSOpenGLContext(NSOpenGLContext* context) { _context = context; }
42
43 /** Get native AGL graphics context.*/
44 inline NSOpenGLContext* getNSOpenGLContext() const { return _context; }
45
46 protected:
47
48 NSOpenGLContext* _context;
49};
50
51}
52
53#endif