Fixed typo.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14680 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
1debc21bb2
commit
bb637e73f3
@ -76,7 +76,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced
|
|||||||
const osg::GraphicsContext* getGraphicsContext() const { return getCurrentEventState()->getGraphicsContext(); }
|
const osg::GraphicsContext* getGraphicsContext() const { return getCurrentEventState()->getGraphicsContext(); }
|
||||||
|
|
||||||
/** Read the window record dimensions from the graphics context. */
|
/** Read the window record dimensions from the graphics context. */
|
||||||
void syncWindowRectangleWithGraphcisContext();
|
void syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
|
|
||||||
/** Set the mouse input range.*/
|
/** Set the mouse input range.*/
|
||||||
|
@ -132,7 +132,7 @@ bool EventQueue::copyEvents(Events& events) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventQueue::syncWindowRectangleWithGraphcisContext()
|
void EventQueue::syncWindowRectangleWithGraphicsContext()
|
||||||
{
|
{
|
||||||
const osg::GraphicsContext::Traits* traits = (getGraphicsContext()!=0) ? getGraphicsContext()->getTraits() : 0;
|
const osg::GraphicsContext::Traits* traits = (getGraphicsContext()!=0) ? getGraphicsContext()->getTraits() : 0;
|
||||||
if (traits) _accumulateEventState->setWindowRectangle(traits->x, traits->y, traits->width, traits->height, !_useFixedMouseInputRange);
|
if (traits) _accumulateEventState->setWindowRectangle(traits->x, traits->y, traits->width, traits->height, !_useFixedMouseInputRange);
|
||||||
|
@ -565,7 +565,7 @@ bool GraphicsWindowQt::init( QWidget* parent, const QGLWidget* shareWidget, Qt::
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -783,7 +783,7 @@ bool GraphicsWindowQt::realizeImplementation()
|
|||||||
_realized = true;
|
_realized = true;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
// make this window's context not current
|
// make this window's context not current
|
||||||
// note: this must be done as we will probably make the context current from another thread
|
// note: this must be done as we will probably make the context current from another thread
|
||||||
|
@ -251,9 +251,9 @@ void GraphicsWindowCarbon::init()
|
|||||||
}
|
}
|
||||||
_valid = (_pixelFormat != NULL);
|
_valid = (_pixelFormat != NULL);
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphicsWindowCarbon::setWindowDecorationImplementation(bool flag)
|
bool GraphicsWindowCarbon::setWindowDecorationImplementation(bool flag)
|
||||||
@ -457,8 +457,8 @@ bool GraphicsWindowCarbon::realizeImplementation()
|
|||||||
_realized = true;
|
_realized = true;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
return _realized;
|
return _realized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
|
|
||||||
NSMutableDictionary* _touchPoints;
|
NSMutableDictionary* _touchPoints;
|
||||||
unsigned int _lastTouchPointId;
|
unsigned int _lastTouchPointId;
|
||||||
|
|
||||||
}
|
}
|
||||||
- (void)setGraphicsWindowCocoa: (osgViewer::GraphicsWindowCocoa*) win;
|
- (void)setGraphicsWindowCocoa: (osgViewer::GraphicsWindowCocoa*) win;
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
// if multitouch is enabled, disable standard event handling
|
// if multitouch is enabled, disable standard event handling
|
||||||
if ([self useMultiTouchOnly: theEvent])
|
if ([self useMultiTouchOnly: theEvent])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSPoint converted_point = [self getLocalPoint: theEvent];
|
NSPoint converted_point = [self getLocalPoint: theEvent];
|
||||||
DEBUG_OUT("Mouse moved" << converted_point.x << "/" << converted_point.y);
|
DEBUG_OUT("Mouse moved" << converted_point.x << "/" << converted_point.y);
|
||||||
_win->getEventQueue()->mouseMotion(converted_point.x, converted_point.y);
|
_win->getEventQueue()->mouseMotion(converted_point.x, converted_point.y);
|
||||||
@ -453,7 +453,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
// if multitouch is enabled, disable standard event handling
|
// if multitouch is enabled, disable standard event handling
|
||||||
if ([self useMultiTouchOnly: theEvent])
|
if ([self useMultiTouchOnly: theEvent])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DEBUG_OUT("Mouse down");
|
DEBUG_OUT("Mouse down");
|
||||||
// Because many Mac users have only a 1-button mouse, we should provide ways
|
// Because many Mac users have only a 1-button mouse, we should provide ways
|
||||||
// to access the button 2 and 3 actions of osgViewer.
|
// to access the button 2 and 3 actions of osgViewer.
|
||||||
@ -486,7 +486,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
// if multitouch is enabled, disable standard event handling
|
// if multitouch is enabled, disable standard event handling
|
||||||
if ([self useMultiTouchOnly: theEvent])
|
if ([self useMultiTouchOnly: theEvent])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_win) return;
|
if (!_win) return;
|
||||||
|
|
||||||
NSPoint converted_point = [self getLocalPoint: theEvent];
|
NSPoint converted_point = [self getLocalPoint: theEvent];
|
||||||
@ -502,7 +502,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
// if multitouch is enabled, disable standard event handling
|
// if multitouch is enabled, disable standard event handling
|
||||||
if ([self useMultiTouchOnly: theEvent])
|
if ([self useMultiTouchOnly: theEvent])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Because many Mac users have only a 1-button mouse, we should provide ways
|
// Because many Mac users have only a 1-button mouse, we should provide ways
|
||||||
// to access the button 2 and 3 actions of osgViewer.
|
// to access the button 2 and 3 actions of osgViewer.
|
||||||
// I will use the Ctrl modifer to represent right-clicking
|
// I will use the Ctrl modifer to represent right-clicking
|
||||||
@ -787,10 +787,10 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
|
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
|
||||||
|
|
||||||
- (osgGA::GUIEventAdapter::TouchPhase) convertTouchPhase: (NSTouchPhase) phase
|
- (osgGA::GUIEventAdapter::TouchPhase) convertTouchPhase: (NSTouchPhase) phase
|
||||||
{
|
{
|
||||||
switch(phase) {
|
switch(phase) {
|
||||||
|
|
||||||
case NSTouchPhaseBegan:
|
case NSTouchPhaseBegan:
|
||||||
return osgGA::GUIEventAdapter::TOUCH_BEGAN;
|
return osgGA::GUIEventAdapter::TOUCH_BEGAN;
|
||||||
break;
|
break;
|
||||||
@ -807,7 +807,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -816,24 +816,24 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
- (unsigned int)computeTouchId: (NSTouch*) touch mayCleanup: (BOOL) may_cleanup
|
- (unsigned int)computeTouchId: (NSTouch*) touch mayCleanup: (BOOL) may_cleanup
|
||||||
{
|
{
|
||||||
unsigned int result(0);
|
unsigned int result(0);
|
||||||
|
|
||||||
if(!_touchPoints) {
|
if(!_touchPoints) {
|
||||||
_touchPoints = [[NSMutableDictionary alloc] init];
|
_touchPoints = [[NSMutableDictionary alloc] init];
|
||||||
_lastTouchPointId = 0;
|
_lastTouchPointId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch([touch phase])
|
switch([touch phase])
|
||||||
{
|
{
|
||||||
|
|
||||||
case NSTouchPhaseBegan:
|
case NSTouchPhaseBegan:
|
||||||
if ([_touchPoints objectForKey: [touch identity]] == nil)
|
if ([_touchPoints objectForKey: [touch identity]] == nil)
|
||||||
{
|
{
|
||||||
[_touchPoints setObject: [NSNumber numberWithInt: _lastTouchPointId] forKey: [touch identity]];
|
[_touchPoints setObject: [NSNumber numberWithInt: _lastTouchPointId] forKey: [touch identity]];
|
||||||
result = _lastTouchPointId++;
|
result = _lastTouchPointId++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// missing "break" by intention!
|
// missing "break" by intention!
|
||||||
|
|
||||||
case NSTouchPhaseMoved:
|
case NSTouchPhaseMoved:
|
||||||
case NSTouchPhaseStationary:
|
case NSTouchPhaseStationary:
|
||||||
{
|
{
|
||||||
@ -841,7 +841,7 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
result = [n intValue];
|
result = [n intValue];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSTouchPhaseEnded:
|
case NSTouchPhaseEnded:
|
||||||
case NSTouchPhaseCancelled:
|
case NSTouchPhaseCancelled:
|
||||||
{
|
{
|
||||||
@ -854,11 +854,11 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,13 +867,13 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
- (void)touchesBeganWithEvent:(NSEvent *)event
|
- (void)touchesBeganWithEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
NSSet *allTouches = [event touchesMatchingPhase: NSTouchPhaseAny inView: self];
|
NSSet *allTouches = [event touchesMatchingPhase: NSTouchPhaseAny inView: self];
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
||||||
for(unsigned int i=0; i<[allTouches count]; i++)
|
for(unsigned int i=0; i<[allTouches count]; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
||||||
NSPoint pos = [touch normalizedPosition];
|
NSPoint pos = [touch normalizedPosition];
|
||||||
pos.x *= bounds.size.width;
|
pos.x *= bounds.size.width;
|
||||||
@ -895,10 +895,10 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
- (void)touchesMovedWithEvent:(NSEvent *)event
|
- (void)touchesMovedWithEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
NSSet *allTouches = [event touchesMatchingPhase: NSTouchPhaseAny inView: self];
|
NSSet *allTouches = [event touchesMatchingPhase: NSTouchPhaseAny inView: self];
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
||||||
for(unsigned int i=0; i<[allTouches count]; i++)
|
for(unsigned int i=0; i<[allTouches count]; i++)
|
||||||
{
|
{
|
||||||
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
||||||
@ -923,11 +923,11 @@ static NSRect convertToQuartzCoordinates(const NSRect& rect)
|
|||||||
- (void)touchesEndedWithEvent:(NSEvent *)event
|
- (void)touchesEndedWithEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
NSSet *allTouches = [event touchesMatchingPhase: NSTouchPhaseAny inView: self];
|
NSSet *allTouches = [event touchesMatchingPhase: NSTouchPhaseAny inView: self];
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
||||||
NSRect bounds = [self bounds];
|
NSRect bounds = [self bounds];
|
||||||
|
|
||||||
|
|
||||||
for(unsigned int i=0; i<[allTouches count]; i++)
|
for(unsigned int i=0; i<[allTouches count]; i++)
|
||||||
{
|
{
|
||||||
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
NSTouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
||||||
@ -1094,9 +1094,9 @@ void GraphicsWindowCocoa::init()
|
|||||||
|
|
||||||
_updateContext = false;
|
_updateContext = false;
|
||||||
_valid = _initialized = true;
|
_valid = _initialized = true;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1226,25 +1226,25 @@ bool GraphicsWindowCocoa::realizeImplementation()
|
|||||||
// set graphics handle for shared usage
|
// set graphics handle for shared usage
|
||||||
setNSOpenGLContext(_context);
|
setNSOpenGLContext(_context);
|
||||||
|
|
||||||
|
|
||||||
_view = [[ GraphicsWindowCocoaGLView alloc ] initWithFrame:[ _window frame ] ];
|
_view = [[ GraphicsWindowCocoaGLView alloc ] initWithFrame:[ _window frame ] ];
|
||||||
[_view setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable) ];
|
[_view setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable) ];
|
||||||
[_view setGraphicsWindowCocoa: this];
|
[_view setGraphicsWindowCocoa: this];
|
||||||
[_view setOpenGLContext:_context];
|
[_view setOpenGLContext:_context];
|
||||||
|
|
||||||
// enable multitouch
|
// enable multitouch
|
||||||
if (_multiTouchEnabled || (windowData && windowData->isMultiTouchEnabled()))
|
if (_multiTouchEnabled || (windowData && windowData->isMultiTouchEnabled()))
|
||||||
{
|
{
|
||||||
setMultiTouchEnabled(true);
|
setMultiTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSG_DEBUG << "GraphicsWindowCocoa::realizeImplementation / view: " << _view << std::endl;
|
OSG_DEBUG << "GraphicsWindowCocoa::realizeImplementation / view: " << _view << std::endl;
|
||||||
|
|
||||||
if (_ownsWindow) {
|
if (_ownsWindow) {
|
||||||
[_window setContentView: _view];
|
[_window setContentView: _view];
|
||||||
setupNSWindow(_window);
|
setupNSWindow(_window);
|
||||||
[_view release];
|
[_view release];
|
||||||
|
|
||||||
MenubarController::instance()->attachWindow( new CocoaWindowAdapter(this) );
|
MenubarController::instance()->attachWindow( new CocoaWindowAdapter(this) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1265,7 +1265,7 @@ bool GraphicsWindowCocoa::realizeImplementation()
|
|||||||
getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
_valid = _initialized = _realized = true;
|
_valid = _initialized = _realized = true;
|
||||||
return _valid;
|
return _valid;
|
||||||
@ -1382,7 +1382,7 @@ bool GraphicsWindowCocoa::checkEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
return !(getEventQueue()->empty());
|
return !(getEventQueue()->empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,29 +1546,29 @@ void GraphicsWindowCocoa::setWindowName (const std::string & name)
|
|||||||
// requestWarpPointer
|
// requestWarpPointer
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
void GraphicsWindowCocoa::requestWarpPointer(float x,float y)
|
void GraphicsWindowCocoa::requestWarpPointer(float x,float y)
|
||||||
{
|
{
|
||||||
CGPoint point;
|
CGPoint point;
|
||||||
point.x = x + _traits->x;
|
point.x = x + _traits->x;
|
||||||
point.y = y + _traits->y;
|
point.y = y + _traits->y;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
CGEventRef warpEvent = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, point, kCGMouseButtonLeft);
|
CGEventRef warpEvent = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, point, kCGMouseButtonLeft);
|
||||||
CGEventPost(kCGHIDEventTap, warpEvent);
|
CGEventPost(kCGHIDEventTap, warpEvent);
|
||||||
CFRelease(warpEvent);
|
CFRelease(warpEvent);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
|
DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
|
||||||
|
|
||||||
if (wsi == NULL) {
|
if (wsi == NULL) {
|
||||||
osg::notify(osg::WARN) << "GraphicsWindowCocoa::useCursor :: could not get OSXCocoaWindowingSystemInterface" << std::endl;
|
osg::notify(osg::WARN) << "GraphicsWindowCocoa::useCursor :: could not get OSXCocoaWindowingSystemInterface" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGDirectDisplayID displayId = wsi->getDisplayID((*_traits));
|
CGDirectDisplayID displayId = wsi->getDisplayID((*_traits));
|
||||||
CGSetLocalEventsSuppressionInterval(0);
|
CGSetLocalEventsSuppressionInterval(0);
|
||||||
CGDisplayMoveCursorToPoint(displayId, point);
|
CGDisplayMoveCursorToPoint(displayId, point);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
getEventQueue()->mouseWarped(x,y);
|
getEventQueue()->mouseWarped(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1666,7 +1666,7 @@ bool GraphicsWindowCocoa::isMultiTouchEnabled()
|
|||||||
void GraphicsWindowCocoa::setMultiTouchEnabled(bool b)
|
void GraphicsWindowCocoa::setMultiTouchEnabled(bool b)
|
||||||
{
|
{
|
||||||
_multiTouchEnabled = b;
|
_multiTouchEnabled = b;
|
||||||
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
|
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
|
||||||
if (_view) [_view setAcceptsTouchEvents: b];
|
if (_view) [_view setAcceptsTouchEvents: b];
|
||||||
#else
|
#else
|
||||||
@ -1748,7 +1748,7 @@ struct CocoaWindowingSystemInterface : public DarwinWindowingSystemInterface
|
|||||||
|
|
||||||
return createGraphicsContextImplementation<PixelBufferCocoa, GraphicsWindowCocoa>(traits);
|
return createGraphicsContextImplementation<PixelBufferCocoa, GraphicsWindowCocoa>(traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual ~CocoaWindowingSystemInterface()
|
virtual ~CocoaWindowingSystemInterface()
|
||||||
{
|
{
|
||||||
|
@ -10,31 +10,31 @@
|
|||||||
#import <OpenGLES/ES1/glext.h>
|
#import <OpenGLES/ES1/glext.h>
|
||||||
#else
|
#else
|
||||||
#import <OpenGLES/ES2/glext.h>
|
#import <OpenGLES/ES2/glext.h>
|
||||||
// in GLES2, the OES suffix if dropped from function names (from rti)
|
// in GLES2, the OES suffix if dropped from function names (from rti)
|
||||||
#define glGenFramebuffersOES glGenFramebuffers
|
#define glGenFramebuffersOES glGenFramebuffers
|
||||||
#define glGenRenderbuffersOES glGenRenderbuffers
|
#define glGenRenderbuffersOES glGenRenderbuffers
|
||||||
#define glBindFramebufferOES glBindFramebuffer
|
#define glBindFramebufferOES glBindFramebuffer
|
||||||
#define glBindRenderbufferOES glBindRenderbuffer
|
#define glBindRenderbufferOES glBindRenderbuffer
|
||||||
#define glFramebufferRenderbufferOES glFramebufferRenderbuffer
|
#define glFramebufferRenderbufferOES glFramebufferRenderbuffer
|
||||||
#define glGetRenderbufferParameterivOES glGetRenderbufferParameteriv
|
#define glGetRenderbufferParameterivOES glGetRenderbufferParameteriv
|
||||||
#define glRenderbufferStorageOES glRenderbufferStorage
|
#define glRenderbufferStorageOES glRenderbufferStorage
|
||||||
#define glDeleteRenderbuffersOES glDeleteRenderbuffers
|
#define glDeleteRenderbuffersOES glDeleteRenderbuffers
|
||||||
#define glDeleteFramebuffersOES glDeleteFramebuffers
|
#define glDeleteFramebuffersOES glDeleteFramebuffers
|
||||||
#define glCheckFramebufferStatusOES glCheckFramebufferStatus
|
#define glCheckFramebufferStatusOES glCheckFramebufferStatus
|
||||||
|
|
||||||
#define GL_FRAMEBUFFER_OES GL_FRAMEBUFFER
|
#define GL_FRAMEBUFFER_OES GL_FRAMEBUFFER
|
||||||
#define GL_RENDERBUFFER_OES GL_RENDERBUFFER
|
#define GL_RENDERBUFFER_OES GL_RENDERBUFFER
|
||||||
#define GL_RENDERBUFFER_WIDTH_OES GL_RENDERBUFFER_WIDTH
|
#define GL_RENDERBUFFER_WIDTH_OES GL_RENDERBUFFER_WIDTH
|
||||||
#define GL_RENDERBUFFER_HEIGHT_OES GL_RENDERBUFFER_HEIGHT
|
#define GL_RENDERBUFFER_HEIGHT_OES GL_RENDERBUFFER_HEIGHT
|
||||||
#define GL_COLOR_ATTACHMENT0_OES GL_COLOR_ATTACHMENT0
|
#define GL_COLOR_ATTACHMENT0_OES GL_COLOR_ATTACHMENT0
|
||||||
#define GL_DEPTH_ATTACHMENT_OES GL_DEPTH_ATTACHMENT
|
#define GL_DEPTH_ATTACHMENT_OES GL_DEPTH_ATTACHMENT
|
||||||
#define GL_DEPTH_COMPONENT16_OES GL_DEPTH_COMPONENT16
|
#define GL_DEPTH_COMPONENT16_OES GL_DEPTH_COMPONENT16
|
||||||
#define GL_STENCIL_INDEX8_OES GL_STENCIL_INDEX8
|
#define GL_STENCIL_INDEX8_OES GL_STENCIL_INDEX8
|
||||||
#define GL_FRAMEBUFFER_COMPLETE_OES GL_FRAMEBUFFER_COMPLETE
|
#define GL_FRAMEBUFFER_COMPLETE_OES GL_FRAMEBUFFER_COMPLETE
|
||||||
#define GL_STENCIL_ATTACHMENT_OES GL_STENCIL_ATTACHMENT
|
#define GL_STENCIL_ATTACHMENT_OES GL_STENCIL_ATTACHMENT
|
||||||
|
|
||||||
#define GL_RGB5_A1_OES GL_RGB5_A1
|
#define GL_RGB5_A1_OES GL_RGB5_A1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "IOSUtils.h"
|
#include "IOSUtils.h"
|
||||||
|
|
||||||
@ -59,7 +59,7 @@
|
|||||||
@implementation GraphicsWindowIOSWindow
|
@implementation GraphicsWindowIOSWindow
|
||||||
|
|
||||||
//
|
//
|
||||||
//Implement dealloc
|
//Implement dealloc
|
||||||
//
|
//
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
@ -92,29 +92,29 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
@private
|
@private
|
||||||
osgViewer::GraphicsWindowIOS* _win;
|
osgViewer::GraphicsWindowIOS* _win;
|
||||||
EAGLContext* _context;
|
EAGLContext* _context;
|
||||||
|
|
||||||
/* The pixel dimensions of the backbuffer */
|
/* The pixel dimensions of the backbuffer */
|
||||||
GLint _backingWidth;
|
GLint _backingWidth;
|
||||||
GLint _backingHeight;
|
GLint _backingHeight;
|
||||||
|
|
||||||
//the pixel buffers for the video
|
//the pixel buffers for the video
|
||||||
/* OpenGL names for the renderbuffer and framebuffers used to render to this view */
|
/* OpenGL names for the renderbuffer and framebuffers used to render to this view */
|
||||||
GLuint _viewRenderbuffer, _viewFramebuffer;
|
GLuint _viewRenderbuffer, _viewFramebuffer;
|
||||||
|
|
||||||
/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
|
/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
|
||||||
GLuint _depthRenderbuffer;
|
GLuint _depthRenderbuffer;
|
||||||
|
|
||||||
/* OpenGL name for the stencil buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
|
/* OpenGL name for the stencil buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
|
||||||
GLuint _stencilBuffer;
|
GLuint _stencilBuffer;
|
||||||
|
|
||||||
// for multisampled antialiased rendering
|
// for multisampled antialiased rendering
|
||||||
GLuint _msaaFramebuffer, _msaaRenderBuffer, _msaaDepthBuffer;
|
GLuint _msaaFramebuffer, _msaaRenderBuffer, _msaaDepthBuffer;
|
||||||
|
|
||||||
TouchPointsIdMapping* _touchPointsIdMapping;
|
TouchPointsIdMapping* _touchPointsIdMapping;
|
||||||
unsigned int _lastTouchPointId;
|
unsigned int _lastTouchPointId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setGraphicsWindow: (osgViewer::GraphicsWindowIOS*) win;
|
- (void)setGraphicsWindow: (osgViewer::GraphicsWindowIOS*) win;
|
||||||
@ -135,12 +135,12 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
- (void) dealloc;
|
- (void) dealloc;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GraphicsWindowIOSGLView
|
@implementation GraphicsWindowIOSGLView
|
||||||
|
|
||||||
- (osgGA::GUIEventAdapter::TouchPhase) convertTouchPhase: (UITouchPhase) phase
|
- (osgGA::GUIEventAdapter::TouchPhase) convertTouchPhase: (UITouchPhase) phase
|
||||||
{
|
{
|
||||||
switch(phase) {
|
switch(phase) {
|
||||||
|
|
||||||
case UITouchPhaseBegan:
|
case UITouchPhaseBegan:
|
||||||
return osgGA::GUIEventAdapter::TOUCH_BEGAN;
|
return osgGA::GUIEventAdapter::TOUCH_BEGAN;
|
||||||
break;
|
break;
|
||||||
@ -157,7 +157,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
return osgGA::GUIEventAdapter::TOUCH_ENDED;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -166,37 +166,37 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
- (unsigned int)computeTouchId: (UITouch*) touch mayCleanup: (bool)may_cleanup
|
- (unsigned int)computeTouchId: (UITouch*) touch mayCleanup: (bool)may_cleanup
|
||||||
{
|
{
|
||||||
unsigned int result(0);
|
unsigned int result(0);
|
||||||
|
|
||||||
if (!_touchPointsIdMapping) {
|
if (!_touchPointsIdMapping) {
|
||||||
_lastTouchPointId = 0;
|
_lastTouchPointId = 0;
|
||||||
_touchPointsIdMapping = new TouchPointsIdMapping();
|
_touchPointsIdMapping = new TouchPointsIdMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch([touch phase])
|
switch([touch phase])
|
||||||
{
|
{
|
||||||
|
|
||||||
case UITouchPhaseBegan:
|
case UITouchPhaseBegan:
|
||||||
{
|
{
|
||||||
TouchPointsIdMapping::iterator itr = _touchPointsIdMapping->find(touch);
|
TouchPointsIdMapping::iterator itr = _touchPointsIdMapping->find(touch);
|
||||||
// std::cout << "new: " << touch << " num: " << _touchPointsIdMapping->size() << " found: " << (itr != _touchPointsIdMapping->end()) << std::endl;
|
// std::cout << "new: " << touch << " num: " << _touchPointsIdMapping->size() << " found: " << (itr != _touchPointsIdMapping->end()) << std::endl;
|
||||||
|
|
||||||
if (itr == _touchPointsIdMapping->end())
|
if (itr == _touchPointsIdMapping->end())
|
||||||
{
|
{
|
||||||
(*_touchPointsIdMapping)[touch] = result = _lastTouchPointId;
|
(*_touchPointsIdMapping)[touch] = result = _lastTouchPointId;
|
||||||
_lastTouchPointId++;
|
_lastTouchPointId++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// missing "break" by intention!
|
// missing "break" by intention!
|
||||||
|
|
||||||
case UITouchPhaseMoved:
|
case UITouchPhaseMoved:
|
||||||
case UITouchPhaseStationary:
|
case UITouchPhaseStationary:
|
||||||
{
|
{
|
||||||
result = (*_touchPointsIdMapping)[touch];
|
result = (*_touchPointsIdMapping)[touch];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UITouchPhaseEnded:
|
case UITouchPhaseEnded:
|
||||||
case UITouchPhaseCancelled:
|
case UITouchPhaseCancelled:
|
||||||
{
|
{
|
||||||
@ -213,11 +213,11 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
// std::cout<< "remove: " << touch << " num: " << _touchPointsIdMapping->size() << std::endl;
|
// std::cout<< "remove: " << touch << " num: " << _touchPointsIdMapping->size() << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,12 +226,12 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
{
|
{
|
||||||
//get the views contentscale factor and multiply the point by it
|
//get the views contentscale factor and multiply the point by it
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
||||||
scale = self.contentScaleFactor;
|
scale = self.contentScaleFactor;
|
||||||
#endif
|
#endif
|
||||||
return osg::Vec2(point.x()*scale, point.y()*scale);
|
return osg::Vec2(point.x()*scale, point.y()*scale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) setGraphicsWindow: (osgViewer::GraphicsWindowIOS*) win
|
-(void) setGraphicsWindow: (osgViewer::GraphicsWindowIOS*) win
|
||||||
@ -260,17 +260,17 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
//Called when the view is created using a frame for dimensions
|
//Called when the view is created using a frame for dimensions
|
||||||
//
|
//
|
||||||
- (id)initWithFrame:(CGRect)frame : (osgViewer::GraphicsWindowIOS*)win{
|
- (id)initWithFrame:(CGRect)frame : (osgViewer::GraphicsWindowIOS*)win{
|
||||||
|
|
||||||
_win = win;
|
_win = win;
|
||||||
|
|
||||||
if ((self = [super initWithFrame:frame])) {
|
if ((self = [super initWithFrame:frame])) {
|
||||||
// Get the layer
|
// Get the layer
|
||||||
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
|
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
|
||||||
|
|
||||||
osgViewer::GraphicsWindowIOS::WindowData* win_data(NULL);
|
osgViewer::GraphicsWindowIOS::WindowData* win_data(NULL);
|
||||||
if (_win->getTraits()->inheritedWindowData.valid())
|
if (_win->getTraits()->inheritedWindowData.valid())
|
||||||
win_data = dynamic_cast<osgViewer::GraphicsWindowIOS::WindowData*>(_win->getTraits()->inheritedWindowData.get());
|
win_data = dynamic_cast<osgViewer::GraphicsWindowIOS::WindowData*>(_win->getTraits()->inheritedWindowData.get());
|
||||||
|
|
||||||
eaglLayer.opaque = win_data ? !win_data->getCreateTransparentView() : YES;
|
eaglLayer.opaque = win_data ? !win_data->getCreateTransparentView() : YES;
|
||||||
bool retained_backing = win_data ? win_data->getUseRetainedBacking() : NO;
|
bool retained_backing = win_data ? win_data->getUseRetainedBacking() : NO;
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.multipleTouchEnabled = YES;
|
self.multipleTouchEnabled = YES;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
OSG_INFO << "GraphicsWindowIOSGLView::dealloc" << std::endl;
|
OSG_INFO << "GraphicsWindowIOSGLView::dealloc" << std::endl;
|
||||||
if(_touchPointsIdMapping)
|
if(_touchPointsIdMapping)
|
||||||
delete _touchPointsIdMapping;
|
delete _touchPointsIdMapping;
|
||||||
_touchPointsIdMapping = NULL;
|
_touchPointsIdMapping = NULL;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
@ -325,10 +325,10 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
osg::Vec2 pointSize = osg::Vec2(frame.size.width,frame.size.height);
|
osg::Vec2 pointSize = osg::Vec2(frame.size.width,frame.size.height);
|
||||||
osg::Vec2 pixelOrigin = [(GraphicsWindowIOSGLView*)(self) convertPointToPixel:pointOrigin];
|
osg::Vec2 pixelOrigin = [(GraphicsWindowIOSGLView*)(self) convertPointToPixel:pointOrigin];
|
||||||
osg::Vec2 pixelSize = [(GraphicsWindowIOSGLView*)(self) convertPointToPixel:pointSize];
|
osg::Vec2 pixelSize = [(GraphicsWindowIOSGLView*)(self) convertPointToPixel:pointSize];
|
||||||
|
|
||||||
OSG_INFO << "updateDimensions, resize to "
|
OSG_INFO << "updateDimensions, resize to "
|
||||||
<< pixelOrigin.x() << " " << pixelOrigin.y() << " "
|
<< pixelOrigin.x() << " " << pixelOrigin.y() << " "
|
||||||
<< pixelSize.x() << " " << pixelSize.y()
|
<< pixelSize.x() << " " << pixelSize.y()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
_win->resized(pixelOrigin.x(), pixelOrigin.y(), pixelSize.x(), pixelSize.y());
|
_win->resized(pixelOrigin.x(), pixelOrigin.y(), pixelSize.x(), pixelSize.y());
|
||||||
}
|
}
|
||||||
@ -337,21 +337,21 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
- (BOOL)createFramebuffer {
|
- (BOOL)createFramebuffer {
|
||||||
|
|
||||||
_msaaFramebuffer = _msaaRenderBuffer = 0;
|
_msaaFramebuffer = _msaaRenderBuffer = 0;
|
||||||
|
|
||||||
glGenFramebuffersOES(1, &_viewFramebuffer);
|
glGenFramebuffersOES(1, &_viewFramebuffer);
|
||||||
glGenRenderbuffersOES(1, &_viewRenderbuffer);
|
glGenRenderbuffersOES(1, &_viewRenderbuffer);
|
||||||
|
|
||||||
// set the default id for osg to switch back after using fbos.
|
// set the default id for osg to switch back after using fbos.
|
||||||
_win->setDefaultFboId(_viewFramebuffer);
|
_win->setDefaultFboId(_viewFramebuffer);
|
||||||
|
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
||||||
[_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
|
[_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
||||||
|
|
||||||
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_backingWidth);
|
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &_backingWidth);
|
||||||
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_backingHeight);
|
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &_backingHeight);
|
||||||
|
|
||||||
osg::notify(osg::DEBUG_INFO) << "GraphicsWindowIOS::createFramebuffer INFO: Created GL RenderBuffer of size " << _backingWidth << ", " << _backingHeight << " ." << std::endl;
|
osg::notify(osg::DEBUG_INFO) << "GraphicsWindowIOS::createFramebuffer INFO: Created GL RenderBuffer of size " << _backingWidth << ", " << _backingHeight << " ." << std::endl;
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000
|
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000
|
||||||
@ -362,9 +362,9 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
// Create a packed depth stencil buffer.
|
// Create a packed depth stencil buffer.
|
||||||
glGenRenderbuffersOES(1, &_depthRenderbuffer);
|
glGenRenderbuffersOES(1, &_depthRenderbuffer);
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
||||||
|
|
||||||
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, _backingWidth, _backingHeight);
|
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, _backingWidth, _backingHeight);
|
||||||
|
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES,
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES,
|
||||||
GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES,
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES,
|
||||||
@ -383,7 +383,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//add depth if requested
|
//add depth if requested
|
||||||
if(_win->getTraits()->depth > 0) {
|
if(_win->getTraits()->depth > 0) {
|
||||||
@ -404,61 +404,61 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
|
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _depthRenderbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//add stencil if requested
|
//add stencil if requested
|
||||||
if(_win->getTraits()->stencil > 0) {
|
if(_win->getTraits()->stencil > 0) {
|
||||||
glGenRenderbuffersOES(1, &_stencilBuffer);
|
glGenRenderbuffersOES(1, &_stencilBuffer);
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _stencilBuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _stencilBuffer);
|
||||||
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_STENCIL_INDEX8_OES, _backingWidth, _backingHeight);
|
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_STENCIL_INDEX8_OES, _backingWidth, _backingHeight);
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _stencilBuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _stencilBuffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//MSAA only available for >= 4.0 sdk
|
//MSAA only available for >= 4.0 sdk
|
||||||
|
|
||||||
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
||||||
|
|
||||||
if(_win->getTraits()->sampleBuffers > 0)
|
if(_win->getTraits()->sampleBuffers > 0)
|
||||||
{
|
{
|
||||||
glGenFramebuffersOES(1, &_msaaFramebuffer);
|
glGenFramebuffersOES(1, &_msaaFramebuffer);
|
||||||
glGenRenderbuffersOES(1, &_msaaRenderBuffer);
|
glGenRenderbuffersOES(1, &_msaaRenderBuffer);
|
||||||
|
|
||||||
_win->setDefaultFboId(_msaaFramebuffer);
|
_win->setDefaultFboId(_msaaFramebuffer);
|
||||||
|
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _msaaFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _msaaFramebuffer);
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _msaaRenderBuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _msaaRenderBuffer);
|
||||||
|
|
||||||
// Samples is the amount of pixels the MSAA buffer uses to make one pixel on the render // buffer. Use a small number like 2 for the 3G and below and 4 or more for newer models
|
// Samples is the amount of pixels the MSAA buffer uses to make one pixel on the render // buffer. Use a small number like 2 for the 3G and below and 4 or more for newer models
|
||||||
|
|
||||||
glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER_OES, _win->getTraits()->samples, GL_RGB5_A1_OES, _backingWidth, _backingHeight);
|
glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER_OES, _win->getTraits()->samples, GL_RGB5_A1_OES, _backingWidth, _backingHeight);
|
||||||
|
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _msaaRenderBuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, _msaaRenderBuffer);
|
||||||
glGenRenderbuffersOES(1, &_msaaDepthBuffer);
|
glGenRenderbuffersOES(1, &_msaaDepthBuffer);
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _msaaDepthBuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _msaaDepthBuffer);
|
||||||
|
|
||||||
GLuint attachmentType = (_win->getTraits()->stencil > 0) ? GL_DEPTH24_STENCIL8_OES : ((_win->getTraits()->depth == 16) ? GL_DEPTH_COMPONENT16_OES : GL_DEPTH_COMPONENT24_OES);
|
GLuint attachmentType = (_win->getTraits()->stencil > 0) ? GL_DEPTH24_STENCIL8_OES : ((_win->getTraits()->depth == 16) ? GL_DEPTH_COMPONENT16_OES : GL_DEPTH_COMPONENT24_OES);
|
||||||
glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER_OES, _win->getTraits()->samples, attachmentType, _backingWidth , _backingHeight);
|
glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER_OES, _win->getTraits()->samples, attachmentType, _backingWidth , _backingHeight);
|
||||||
|
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _msaaDepthBuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _msaaDepthBuffer);
|
||||||
if (_win->getTraits()->stencil > 0)
|
if (_win->getTraits()->stencil > 0)
|
||||||
{
|
{
|
||||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _msaaDepthBuffer);
|
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, _msaaDepthBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
|
if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
|
||||||
OSG_FATAL << "GraphicsWindowIOS::createFramebuffer ERROR: Failed to create a GL RenderBuffer, glCheckFramebufferStatusOES returned '"
|
OSG_FATAL << "GraphicsWindowIOS::createFramebuffer ERROR: Failed to create a GL RenderBuffer, glCheckFramebufferStatusOES returned '"
|
||||||
<< glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) << "'." << std::endl;
|
<< glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) << "'." << std::endl;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)destroyFramebuffer {
|
- (void)destroyFramebuffer {
|
||||||
|
|
||||||
if(_viewFramebuffer)
|
if(_viewFramebuffer)
|
||||||
{
|
{
|
||||||
glDeleteFramebuffersOES(1, &_viewFramebuffer);
|
glDeleteFramebuffersOES(1, &_viewFramebuffer);
|
||||||
@ -469,22 +469,22 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
glDeleteRenderbuffersOES(1, &_viewRenderbuffer);
|
glDeleteRenderbuffersOES(1, &_viewRenderbuffer);
|
||||||
_viewRenderbuffer = 0;
|
_viewRenderbuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_depthRenderbuffer) {
|
if(_depthRenderbuffer) {
|
||||||
glDeleteRenderbuffersOES(1, &_depthRenderbuffer);
|
glDeleteRenderbuffersOES(1, &_depthRenderbuffer);
|
||||||
_depthRenderbuffer = 0;
|
_depthRenderbuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_stencilBuffer) {
|
if(_stencilBuffer) {
|
||||||
glDeleteRenderbuffersOES(1, &_stencilBuffer);
|
glDeleteRenderbuffersOES(1, &_stencilBuffer);
|
||||||
_stencilBuffer = 0;
|
_stencilBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_msaaRenderBuffer) {
|
if(_msaaRenderBuffer) {
|
||||||
glDeleteRenderbuffersOES(1, &_msaaRenderBuffer);
|
glDeleteRenderbuffersOES(1, &_msaaRenderBuffer);
|
||||||
_msaaRenderBuffer = 0;
|
_msaaRenderBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_msaaDepthBuffer) {
|
if(_msaaDepthBuffer) {
|
||||||
glDeleteRenderbuffersOES(1, &_msaaDepthBuffer);
|
glDeleteRenderbuffersOES(1, &_msaaDepthBuffer);
|
||||||
_msaaDepthBuffer = 0;
|
_msaaDepthBuffer = 0;
|
||||||
@ -502,17 +502,17 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
- (void)swapBuffers {
|
- (void)swapBuffers {
|
||||||
|
|
||||||
|
|
||||||
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
||||||
if(_msaaFramebuffer)
|
if(_msaaFramebuffer)
|
||||||
{
|
{
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _msaaFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _msaaFramebuffer);
|
||||||
|
|
||||||
glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, _msaaFramebuffer);
|
glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, _msaaFramebuffer);
|
||||||
glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, _viewFramebuffer);
|
glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, _viewFramebuffer);
|
||||||
|
|
||||||
glResolveMultisampleFramebufferAPPLE();
|
glResolveMultisampleFramebufferAPPLE();
|
||||||
|
|
||||||
GLenum attachments[] = {GL_DEPTH_ATTACHMENT_OES, GL_COLOR_ATTACHMENT0_OES};
|
GLenum attachments[] = {GL_DEPTH_ATTACHMENT_OES, GL_COLOR_ATTACHMENT0_OES};
|
||||||
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, attachments);
|
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, attachments);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -520,13 +520,13 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
|
|
||||||
//swap buffers (sort of i think?)
|
//swap buffers (sort of i think?)
|
||||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer);
|
||||||
|
|
||||||
//display render in context
|
//display render in context
|
||||||
[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
|
[_context presentRenderbuffer:GL_RENDERBUFFER_OES];
|
||||||
|
|
||||||
//re bind the frame buffer for next frames renders
|
//re bind the frame buffer for next frames renders
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
|
||||||
|
|
||||||
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
||||||
if (_msaaFramebuffer)
|
if (_msaaFramebuffer)
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _msaaFramebuffer);;
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _msaaFramebuffer);;
|
||||||
@ -540,7 +540,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
|
|
||||||
//bind the frame buffer
|
//bind the frame buffer
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, _viewFramebuffer);
|
||||||
|
|
||||||
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
||||||
if (_msaaFramebuffer)
|
if (_msaaFramebuffer)
|
||||||
glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, _msaaFramebuffer);
|
glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, _msaaFramebuffer);
|
||||||
@ -567,19 +567,19 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
//Touch input callbacks
|
//Touch input callbacks
|
||||||
//
|
//
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
|
|
||||||
NSSet *allTouches = [event allTouches];
|
NSSet *allTouches = [event allTouches];
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
||||||
|
|
||||||
for(int i=0; i<[allTouches count]; i++)
|
for(int i=0; i<[allTouches count]; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
||||||
CGPoint pos = [touch locationInView:self];
|
CGPoint pos = [touch locationInView:self];
|
||||||
osg::Vec2 pixelPos = [self convertPointToPixel: osg::Vec2(pos.x,pos.y)];
|
osg::Vec2 pixelPos = [self convertPointToPixel: osg::Vec2(pos.x,pos.y)];
|
||||||
unsigned int touch_id = [self computeTouchId: touch mayCleanup: FALSE];
|
unsigned int touch_id = [self computeTouchId: touch mayCleanup: FALSE];
|
||||||
|
|
||||||
if (!osg_event)
|
if (!osg_event)
|
||||||
{
|
{
|
||||||
osg_event = _win->getEventQueue()->touchBegan(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
|
osg_event = _win->getEventQueue()->touchBegan(touch_id, [self convertTouchPhase: [touch phase]], pixelPos.x(), pixelPos.y());
|
||||||
@ -592,14 +592,14 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[super touchesBegan:touches withEvent:event];
|
[super touchesBegan:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
|
|
||||||
NSSet *allTouches = [event allTouches];
|
NSSet *allTouches = [event allTouches];
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
||||||
|
|
||||||
for(int i=0; i<[allTouches count]; i++)
|
for(int i=0; i<[allTouches count]; i++)
|
||||||
@ -621,17 +621,17 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[super touchesMoved:touches withEvent:event];
|
[super touchesMoved:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
||||||
|
|
||||||
{
|
{
|
||||||
NSSet *allTouches = [event allTouches];
|
NSSet *allTouches = [event allTouches];
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
|
||||||
|
|
||||||
for(int i=0; i<[allTouches count]; i++)
|
for(int i=0; i<[allTouches count]; i++)
|
||||||
{
|
{
|
||||||
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
UITouch *touch = [[allTouches allObjects] objectAtIndex:i];
|
||||||
@ -650,11 +650,11 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[super touchesEnded:touches withEvent:event];
|
[super touchesEnded:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
[self touchesEnded: touches withEvent:event];
|
[self touchesEnded: touches withEvent:event];
|
||||||
}
|
}
|
||||||
@ -679,12 +679,12 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
{
|
{
|
||||||
osgViewer::GraphicsWindowIOS* win = [(GraphicsWindowIOSGLView*)(self.view) getGraphicsWindow];
|
osgViewer::GraphicsWindowIOS* win = [(GraphicsWindowIOSGLView*)(self.view) getGraphicsWindow];
|
||||||
if(!win){return NO;}
|
if(!win){return NO;}
|
||||||
|
|
||||||
osgViewer::GraphicsWindowIOS::WindowData::DeviceOrientationFlags flags = win->getDeviceOrientationFlags();
|
osgViewer::GraphicsWindowIOS::WindowData::DeviceOrientationFlags flags = win->getDeviceOrientationFlags();
|
||||||
|
|
||||||
|
|
||||||
BOOL result(NO);
|
BOOL result(NO);
|
||||||
|
|
||||||
switch (interfaceOrientation) {
|
switch (interfaceOrientation) {
|
||||||
case UIDeviceOrientationPortrait:
|
case UIDeviceOrientationPortrait:
|
||||||
if(flags & osgViewer::GraphicsWindowIOS::WindowData::PORTRAIT_ORIENTATION){
|
if(flags & osgViewer::GraphicsWindowIOS::WindowData::PORTRAIT_ORIENTATION){
|
||||||
@ -714,7 +714,7 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
|
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
|
||||||
{
|
{
|
||||||
[(GraphicsWindowIOSGLView*)(self.view) updateDimensions];
|
[(GraphicsWindowIOSGLView*)(self.view) updateDimensions];
|
||||||
}
|
}
|
||||||
@ -725,11 +725,11 @@ typedef std::map<void*, unsigned int> TouchPointsIdMapping;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
using namespace osgIOS;
|
using namespace osgIOS;
|
||||||
namespace osgViewer {
|
namespace osgViewer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark GraphicsWindowIOS
|
#pragma mark GraphicsWindowIOS
|
||||||
|
|
||||||
|
|
||||||
@ -747,14 +747,14 @@ void GraphicsWindowIOS::init()
|
|||||||
_window = NULL;
|
_window = NULL;
|
||||||
_view = NULL;
|
_view = NULL;
|
||||||
_viewController = NULL;
|
_viewController = NULL;
|
||||||
|
|
||||||
_updateContext = true;
|
_updateContext = true;
|
||||||
//if -1.0 we use the screens scale factor
|
//if -1.0 we use the screens scale factor
|
||||||
_viewContentScaleFactor = -1.0f;
|
_viewContentScaleFactor = -1.0f;
|
||||||
_valid = _initialized = true;
|
_valid = _initialized = true;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -765,9 +765,9 @@ void GraphicsWindowIOS::init()
|
|||||||
bool GraphicsWindowIOS::realizeImplementation()
|
bool GraphicsWindowIOS::realizeImplementation()
|
||||||
{
|
{
|
||||||
if (_realized) return true;
|
if (_realized) return true;
|
||||||
|
|
||||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
BOOL bar_hidden = (_traits->windowDecoration) ? NO: YES;
|
BOOL bar_hidden = (_traits->windowDecoration) ? NO: YES;
|
||||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED > 30100
|
#if __IPHONE_OS_VERSION_MIN_REQUIRED > 30100
|
||||||
@ -776,7 +776,7 @@ bool GraphicsWindowIOS::realizeImplementation()
|
|||||||
[[UIApplication sharedApplication] setStatusBarHidden: bar_hidden animated:NO];
|
[[UIApplication sharedApplication] setStatusBarHidden: bar_hidden animated:NO];
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Get info about the requested screen
|
//Get info about the requested screen
|
||||||
IOSWindowingSystemInterface* wsi = dynamic_cast<IOSWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
|
IOSWindowingSystemInterface* wsi = dynamic_cast<IOSWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface());
|
||||||
osg::Vec2 screenSizePoints;
|
osg::Vec2 screenSizePoints;
|
||||||
@ -786,7 +786,7 @@ bool GraphicsWindowIOS::realizeImplementation()
|
|||||||
osg::GraphicsContext::ScreenSettings screenSettings;
|
osg::GraphicsContext::ScreenSettings screenSettings;
|
||||||
if (wsi) {
|
if (wsi) {
|
||||||
wsi->getScreenContentScaleFactor((*_traits), screenScaleFactor);
|
wsi->getScreenContentScaleFactor((*_traits), screenScaleFactor);
|
||||||
wsi->getScreenSizeInPoints((*_traits), screenSizePoints);
|
wsi->getScreenSizeInPoints((*_traits), screenSizePoints);
|
||||||
screenSizePixels = osg::Vec2(screenSettings.width, screenSettings.height);
|
screenSizePixels = osg::Vec2(screenSettings.width, screenSettings.height);
|
||||||
wsi->getScreenSettings((*_traits), screenSettings);
|
wsi->getScreenSettings((*_traits), screenSettings);
|
||||||
screen = wsi->getUIScreen((*_traits));
|
screen = wsi->getUIScreen((*_traits));
|
||||||
@ -794,32 +794,32 @@ bool GraphicsWindowIOS::realizeImplementation()
|
|||||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create IOS windowing system, OSG will be unable to create a vaild gl context and will not be able to render." << std::endl;
|
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create IOS windowing system, OSG will be unable to create a vaild gl context and will not be able to render." << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ownsWindow = true;
|
_ownsWindow = true;
|
||||||
|
|
||||||
// see if an existing inherited window was passed in
|
// see if an existing inherited window was passed in
|
||||||
WindowData* windowData = _traits->inheritedWindowData ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : NULL;
|
WindowData* windowData = _traits->inheritedWindowData ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : NULL;
|
||||||
if (windowData)
|
if (windowData)
|
||||||
{
|
{
|
||||||
if (windowData->getWindowOrParentView())
|
if (windowData->getWindowOrParentView())
|
||||||
{
|
{
|
||||||
_ownsWindow = false;
|
_ownsWindow = false;
|
||||||
_window = windowData->getWindowOrParentView();
|
_window = windowData->getWindowOrParentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
_deviceOrientationFlags = windowData->_deviceOrientationFlags;
|
_deviceOrientationFlags = windowData->_deviceOrientationFlags;
|
||||||
_viewContentScaleFactor = windowData->_viewContentScaleFactor;
|
_viewContentScaleFactor = windowData->_viewContentScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the user hasn't specified a viewScaleFactor we will use the screens scale factor
|
//if the user hasn't specified a viewScaleFactor we will use the screens scale factor
|
||||||
//so we get a full res buffer
|
//so we get a full res buffer
|
||||||
if(_viewContentScaleFactor < 0.0f)
|
if(_viewContentScaleFactor < 0.0f)
|
||||||
{_viewContentScaleFactor = screenScaleFactor;}
|
{_viewContentScaleFactor = screenScaleFactor;}
|
||||||
|
|
||||||
|
|
||||||
OSG_DEBUG << "GraphicsWindowIOS::realizeImplementation / ownsWindow: " << _ownsWindow << std::endl;
|
OSG_DEBUG << "GraphicsWindowIOS::realizeImplementation / ownsWindow: " << _ownsWindow << std::endl;
|
||||||
|
|
||||||
|
|
||||||
//Here's the confusing bit, the default traits use the screen res which is in pixels and the user will want to use pixels also
|
//Here's the confusing bit, the default traits use the screen res which is in pixels and the user will want to use pixels also
|
||||||
//but we need to create our views and windows in points. By default we create a full res buffer across all devices. This
|
//but we need to create our views and windows in points. By default we create a full res buffer across all devices. This
|
||||||
//means that for backward compatibility you need to set the windowData _viewContentScaleFactor to 1.0f and set the screen res to the
|
//means that for backward compatibility you need to set the windowData _viewContentScaleFactor to 1.0f and set the screen res to the
|
||||||
@ -828,25 +828,25 @@ bool GraphicsWindowIOS::realizeImplementation()
|
|||||||
osg::Vec2 pointsOrigin = this->pixelToPoint(osg::Vec2(_traits->x, _traits->y));
|
osg::Vec2 pointsOrigin = this->pixelToPoint(osg::Vec2(_traits->x, _traits->y));
|
||||||
osg::Vec2 pointsSize = this->pixelToPoint(osg::Vec2(_traits->width, _traits->height));
|
osg::Vec2 pointsSize = this->pixelToPoint(osg::Vec2(_traits->width, _traits->height));
|
||||||
|
|
||||||
window_bounds.origin.x = pointsOrigin.x();
|
window_bounds.origin.x = pointsOrigin.x();
|
||||||
window_bounds.origin.y = pointsOrigin.y();
|
window_bounds.origin.y = pointsOrigin.y();
|
||||||
window_bounds.size.width = pointsSize.x();
|
window_bounds.size.width = pointsSize.x();
|
||||||
window_bounds.size.height = pointsSize.y();
|
window_bounds.size.height = pointsSize.y();
|
||||||
|
|
||||||
|
|
||||||
//if we own the window we need to create one
|
//if we own the window we need to create one
|
||||||
if (_ownsWindow)
|
if (_ownsWindow)
|
||||||
{
|
{
|
||||||
//create the IOS window object using the viewbounds (in points) required for our context size
|
//create the IOS window object using the viewbounds (in points) required for our context size
|
||||||
_window = [[GraphicsWindowIOSWindow alloc] initWithFrame: window_bounds];// styleMask: style backing: NSBackingStoreBuffered defer: NO];
|
_window = [[GraphicsWindowIOSWindow alloc] initWithFrame: window_bounds];// styleMask: style backing: NSBackingStoreBuffered defer: NO];
|
||||||
|
|
||||||
if (!_window) {
|
if (!_window) {
|
||||||
OSG_WARN << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create GraphicsWindowIOSWindow can not display gl view" << std::endl;
|
OSG_WARN << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create GraphicsWindowIOSWindow can not display gl view" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSG_DEBUG << "GraphicsWindowIOS::realizeImplementation: INFO: Created UIWindow with bounds '" << window_bounds.size.width << ", " << window_bounds.size.height << "' (points)." << std::endl;
|
OSG_DEBUG << "GraphicsWindowIOS::realizeImplementation: INFO: Created UIWindow with bounds '" << window_bounds.size.width << ", " << window_bounds.size.height << "' (points)." << std::endl;
|
||||||
|
|
||||||
//if the user has requested a differnet screenNum from default 0 get the UIScreen object and
|
//if the user has requested a differnet screenNum from default 0 get the UIScreen object and
|
||||||
//apply to our window (this is for IPad external screens, I don't have one, so I've no idea if it works)
|
//apply to our window (this is for IPad external screens, I don't have one, so I've no idea if it works)
|
||||||
//I'm also not sure if we should apply this to external windows also?
|
//I'm also not sure if we should apply this to external windows also?
|
||||||
@ -854,17 +854,17 @@ bool GraphicsWindowIOS::realizeImplementation()
|
|||||||
{
|
{
|
||||||
_window.screen = screen;
|
_window.screen = screen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//create the desired OpenGLES context type
|
//create the desired OpenGLES context type
|
||||||
#if OSG_GLES1_FEATURES
|
#if OSG_GLES1_FEATURES
|
||||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
|
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
|
||||||
#elif OSG_GLES2_FEATURES
|
#elif OSG_GLES2_FEATURES
|
||||||
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_context || ![EAGLContext setCurrentContext:_context]) {
|
if (!_context || ![EAGLContext setCurrentContext:_context]) {
|
||||||
|
|
||||||
#if OSG_GLES1_FEATURES
|
#if OSG_GLES1_FEATURES
|
||||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES1 context" << std::endl;
|
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create a valid OpenGLES1 context" << std::endl;
|
||||||
#elif OSG_GLES2_FEATURES
|
#elif OSG_GLES2_FEATURES
|
||||||
@ -881,48 +881,48 @@ bool GraphicsWindowIOS::realizeImplementation()
|
|||||||
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create GraphicsWindowIOSGLView, can not create frame buffers." << std::endl;
|
OSG_FATAL << "GraphicsWindowIOS::realizeImplementation: ERROR: Failed to create GraphicsWindowIOSGLView, can not create frame buffers." << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[theView setAutoresizingMask: ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) ];
|
[theView setAutoresizingMask: ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) ];
|
||||||
|
|
||||||
//Apply our content scale factor to our view, this is what converts the views points
|
//Apply our content scale factor to our view, this is what converts the views points
|
||||||
//size to our desired context size.
|
//size to our desired context size.
|
||||||
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
#if defined(__IPHONE_4_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0)
|
||||||
theView.contentScaleFactor = _viewContentScaleFactor;
|
theView.contentScaleFactor = _viewContentScaleFactor;
|
||||||
#endif
|
#endif
|
||||||
[theView setGraphicsWindow: this];
|
[theView setGraphicsWindow: this];
|
||||||
[theView setOpenGLContext:_context];
|
[theView setOpenGLContext:_context];
|
||||||
_view = theView;
|
_view = theView;
|
||||||
|
|
||||||
OSG_DEBUG << "GraphicsWindowIOS::realizeImplementation / view: " << theView << std::endl;
|
OSG_DEBUG << "GraphicsWindowIOS::realizeImplementation / view: " << theView << std::endl;
|
||||||
|
|
||||||
if (getDeviceOrientationFlags() != WindowData::IGNORE_ORIENTATION)
|
if (getDeviceOrientationFlags() != WindowData::IGNORE_ORIENTATION)
|
||||||
{
|
{
|
||||||
_viewController = [[GraphicsWindowIOSGLViewController alloc] init];
|
_viewController = [[GraphicsWindowIOSGLViewController alloc] init];
|
||||||
_viewController.view = _view;
|
_viewController.view = _view;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach view to window
|
// Attach view to window
|
||||||
[_window addSubview: _view];
|
[_window addSubview: _view];
|
||||||
if ([_window isKindOfClass:[UIWindow class]])
|
if ([_window isKindOfClass:[UIWindow class]])
|
||||||
_window.rootViewController = _viewController;
|
_window.rootViewController = _viewController;
|
||||||
[theView release];
|
[theView release];
|
||||||
|
|
||||||
//if we own the window also make it visible
|
//if we own the window also make it visible
|
||||||
if (_ownsWindow)
|
if (_ownsWindow)
|
||||||
{
|
{
|
||||||
|
|
||||||
//show window
|
//show window
|
||||||
[_window makeKeyAndVisible];
|
[_window makeKeyAndVisible];
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
// IOSs origin is top/left:
|
// IOSs origin is top/left:
|
||||||
getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
|
getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
_valid = _initialized = _realized = true;
|
_valid = _initialized = _realized = true;
|
||||||
return _valid;
|
return _valid;
|
||||||
}
|
}
|
||||||
@ -938,32 +938,32 @@ void GraphicsWindowIOS::closeImplementation()
|
|||||||
OSG_INFO << "close IOS window" << std::endl;
|
OSG_INFO << "close IOS window" << std::endl;
|
||||||
_valid = false;
|
_valid = false;
|
||||||
_realized = false;
|
_realized = false;
|
||||||
|
|
||||||
|
|
||||||
if (_view)
|
if (_view)
|
||||||
{
|
{
|
||||||
[_view setOpenGLContext: NULL];
|
[_view setOpenGLContext: NULL];
|
||||||
[_context release];
|
[_context release];
|
||||||
[_view removeFromSuperview];
|
[_view removeFromSuperview];
|
||||||
[_view setGraphicsWindow: NULL];
|
[_view setGraphicsWindow: NULL];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_viewController)
|
if (_viewController)
|
||||||
{
|
{
|
||||||
[_viewController release];
|
[_viewController release];
|
||||||
_viewController = NULL;
|
_viewController = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_window && _ownsWindow)
|
if (_window && _ownsWindow)
|
||||||
{
|
{
|
||||||
[_window release];
|
[_window release];
|
||||||
//[glView release];
|
//[glView release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_window = NULL;
|
_window = NULL;
|
||||||
_view = NULL;
|
_view = NULL;
|
||||||
_context = NULL;
|
_context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -973,17 +973,17 @@ void GraphicsWindowIOS::closeImplementation()
|
|||||||
|
|
||||||
bool GraphicsWindowIOS:: makeCurrentImplementation()
|
bool GraphicsWindowIOS:: makeCurrentImplementation()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//bind the context
|
//bind the context
|
||||||
[EAGLContext setCurrentContext:_context];
|
[EAGLContext setCurrentContext:_context];
|
||||||
|
|
||||||
if (_updateContext)
|
if (_updateContext)
|
||||||
{
|
{
|
||||||
[_view destroyFramebuffer];
|
[_view destroyFramebuffer];
|
||||||
[_view createFramebuffer];
|
[_view createFramebuffer];
|
||||||
|
|
||||||
_updateContext = false;
|
_updateContext = false;
|
||||||
}
|
}
|
||||||
//i think we also want to bind the frame buffer here
|
//i think we also want to bind the frame buffer here
|
||||||
//[_view bindFrameBuffer];
|
//[_view bindFrameBuffer];
|
||||||
@ -1035,7 +1035,7 @@ bool GraphicsWindowIOS::setWindowDecorationImplementation(bool flag)
|
|||||||
[[UIApplication sharedApplication] setStatusBarHidden: bar_hidden animated:NO];
|
[[UIApplication sharedApplication] setStatusBarHidden: bar_hidden animated:NO];
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,7 +1045,7 @@ bool GraphicsWindowIOS::setWindowDecorationImplementation(bool flag)
|
|||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
void GraphicsWindowIOS::grabFocus()
|
void GraphicsWindowIOS::grabFocus()
|
||||||
{
|
{
|
||||||
//i think make key is the equivalent of focus on iphone
|
//i think make key is the equivalent of focus on iphone
|
||||||
[_window makeKeyWindow];
|
[_window makeKeyWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,9 +1074,9 @@ void GraphicsWindowIOS::raiseWindow()
|
|||||||
void GraphicsWindowIOS::resizedImplementation(int x, int y, int width, int height)
|
void GraphicsWindowIOS::resizedImplementation(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
GraphicsContext::resizedImplementation(x, y, width, height);
|
GraphicsContext::resizedImplementation(x, y, width, height);
|
||||||
|
|
||||||
_updateContext = true;
|
_updateContext = true;
|
||||||
|
|
||||||
getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime());
|
getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1091,11 +1091,11 @@ bool GraphicsWindowIOS::setWindowRectangleImplementation(int x, int y, int width
|
|||||||
OSG_INFO << "GraphicsWindowIOS :: setWindowRectangleImplementation not implemented yet " << std::endl;
|
OSG_INFO << "GraphicsWindowIOS :: setWindowRectangleImplementation not implemented yet " << std::endl;
|
||||||
if (!_ownsWindow)
|
if (!_ownsWindow)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GraphicsWindowIOS::checkEvents()
|
bool GraphicsWindowIOS::checkEvents()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1138,12 +1138,12 @@ void GraphicsWindowIOS::setCursor(MouseCursor mouseCursor)
|
|||||||
// setVSync, no vsync on IOS
|
// setVSync, no vsync on IOS
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void GraphicsWindowIOS::setVSync(bool f)
|
void GraphicsWindowIOS::setVSync(bool f)
|
||||||
{
|
{
|
||||||
OSG_INFO << "GraphicsWindowIOS :: setVSync not implemented yet " << std::endl;
|
OSG_INFO << "GraphicsWindowIOS :: setVSync not implemented yet " << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
// helper funcs for converting points to pixels taking into account the views contents scale factor
|
// helper funcs for converting points to pixels taking into account the views contents scale factor
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
@ -1152,7 +1152,7 @@ osg::Vec2 GraphicsWindowIOS::pointToPixel(const osg::Vec2& point)
|
|||||||
{
|
{
|
||||||
return point * _viewContentScaleFactor;
|
return point * _viewContentScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec2 GraphicsWindowIOS::pixelToPoint(const osg::Vec2& pixel)
|
osg::Vec2 GraphicsWindowIOS::pixelToPoint(const osg::Vec2& pixel)
|
||||||
{
|
{
|
||||||
float scaler = 1.0f / _viewContentScaleFactor;
|
float scaler = 1.0f / _viewContentScaleFactor;
|
||||||
@ -1164,7 +1164,7 @@ osg::Vec2 GraphicsWindowIOS::pixelToPoint(const osg::Vec2& pixel)
|
|||||||
// d'tor
|
// d'tor
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
GraphicsWindowIOS::~GraphicsWindowIOS()
|
GraphicsWindowIOS::~GraphicsWindowIOS()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@ -1177,8 +1177,8 @@ public:
|
|||||||
: IOSWindowingSystemInterface()
|
: IOSWindowingSystemInterface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits)
|
virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits)
|
||||||
{
|
{
|
||||||
if (traits->pbuffer)
|
if (traits->pbuffer)
|
||||||
{
|
{
|
||||||
|
@ -1186,9 +1186,9 @@ void GraphicsWindowWin32::init()
|
|||||||
|
|
||||||
_initialized = _ownsWindow ? createWindow() : setWindow(windowHandle);
|
_initialized = _ownsWindow ? createWindow() : setWindow(windowHandle);
|
||||||
_valid = _initialized;
|
_valid = _initialized;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
// 2008/10/03
|
// 2008/10/03
|
||||||
// Few days ago NVidia released WHQL certified drivers ver 178.13.
|
// Few days ago NVidia released WHQL certified drivers ver 178.13.
|
||||||
@ -1992,7 +1992,7 @@ bool GraphicsWindowWin32::realizeImplementation()
|
|||||||
_realized = true;
|
_realized = true;
|
||||||
|
|
||||||
// make sure the event queue has the correct window rectangle size and input range
|
// make sure the event queue has the correct window rectangle size and input range
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2078,7 +2078,7 @@ bool GraphicsWindowWin32::checkEvents()
|
|||||||
_destroyWindow = false;
|
_destroyWindow = false;
|
||||||
destroyWindow(false);
|
destroyWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !(getEventQueue()->empty());
|
return !(getEventQueue()->empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ void GraphicsWindowX11::init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphicsWindowX11::createWindow()
|
bool GraphicsWindowX11::createWindow()
|
||||||
@ -1055,7 +1055,7 @@ bool GraphicsWindowX11::realizeImplementation()
|
|||||||
|
|
||||||
XMapWindow( _display, _window );
|
XMapWindow( _display, _window );
|
||||||
|
|
||||||
getEventQueue()->syncWindowRectangleWithGraphcisContext();
|
getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||||
|
|
||||||
// Window temp = _window;
|
// Window temp = _window;
|
||||||
// XSetWMColormapWindows( _display, _window, &temp, 1);
|
// XSetWMColormapWindows( _display, _window, &temp, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user