From Stephan Huber, "attached you'll find the missing GraphicsHandleCocoa-implementation."
This commit is contained in:
53
include/osgViewer/api/Cocoa/GraphicsHandleCocoa
Normal file
53
include/osgViewer/api/Cocoa/GraphicsHandleCocoa
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGVIEWER_GRAPHICSHANDLECOCOA
|
||||
#define OSGVIEWER_GRAPHICSHANDLECOCOA 1
|
||||
|
||||
#include <osgViewer/Export>
|
||||
|
||||
|
||||
#ifdef __OBJC__
|
||||
@class NSOpenGLContext;
|
||||
#else
|
||||
class NSOpenGLContext;
|
||||
#endif
|
||||
|
||||
namespace osgViewer
|
||||
{
|
||||
|
||||
/** Class to encapsulate platform-specific OpenGL context handle variables.
|
||||
* Derived osg::GraphicsContext classes can inherit from this class to
|
||||
* share OpenGL resources.*/
|
||||
|
||||
class OSGVIEWER_EXPORT GraphicsHandleCocoa
|
||||
{
|
||||
public:
|
||||
|
||||
GraphicsHandleCocoa():
|
||||
_context(0) {}
|
||||
|
||||
/** Set native AGL graphics context.*/
|
||||
inline void setNSOpenGLContext(NSOpenGLContext* context) { _context = context; }
|
||||
|
||||
/** Get native AGL graphics context.*/
|
||||
inline NSOpenGLContext* getNSOpenGLContext() const { return _context; }
|
||||
|
||||
protected:
|
||||
|
||||
NSOpenGLContext* _context;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -36,18 +36,21 @@ class NSView;
|
||||
#endif
|
||||
|
||||
#include <osgViewer/GraphicsWindow>
|
||||
#include <osgViewer/api/Cocoa/GraphicsHandleCocoa>
|
||||
|
||||
// we may not include any cocoa-header here, because this will pollute the name-sapce and tend to compile-errors
|
||||
|
||||
namespace osgViewer
|
||||
{
|
||||
|
||||
class GraphicsWindowCocoa : public osgViewer::GraphicsWindow
|
||||
class GraphicsWindowCocoa : public osgViewer::GraphicsWindow, public osgViewer::GraphicsHandleCocoa
|
||||
{
|
||||
public:
|
||||
class Implementation;
|
||||
|
||||
GraphicsWindowCocoa(osg::GraphicsContext::Traits* traits):
|
||||
osgViewer::GraphicsWindow(),
|
||||
osgViewer::GraphicsHandleCocoa(),
|
||||
_valid(false),
|
||||
_initialized(false),
|
||||
_realized(false),
|
||||
@@ -55,8 +58,7 @@ class GraphicsWindowCocoa : public osgViewer::GraphicsWindow
|
||||
_checkForEvents(true),
|
||||
_ownsWindow(true),
|
||||
_currentCursor(RightArrowCursor),
|
||||
_window(NULL),
|
||||
_context(NULL)
|
||||
_window(NULL)
|
||||
{
|
||||
_traits = traits;
|
||||
|
||||
|
||||
@@ -20,23 +20,19 @@
|
||||
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osgViewer/Export>
|
||||
|
||||
|
||||
#ifdef __OBJC__
|
||||
@class NSOpenGLContext;
|
||||
#else
|
||||
class NSOpenGLContext;
|
||||
#endif
|
||||
#include <osgViewer/api/Cocoa/GraphicsHandleCocoa>
|
||||
|
||||
namespace osgViewer
|
||||
{
|
||||
|
||||
class OSGVIEWER_EXPORT PixelBufferCocoa : public osg::GraphicsContext
|
||||
class OSGVIEWER_EXPORT PixelBufferCocoa : public osg::GraphicsContext, public osgViewer::GraphicsHandleCocoa
|
||||
{
|
||||
public:
|
||||
struct Implementation;
|
||||
|
||||
PixelBufferCocoa(osg::GraphicsContext::Traits* traits):
|
||||
osg::GraphicsContext(),
|
||||
osgViewer::GraphicsHandleCocoa(),
|
||||
_valid(false),
|
||||
_initialized(false),
|
||||
_realized(false),
|
||||
|
||||
Reference in New Issue
Block a user