NSRect OpenGLSceneViewCore::currentRect()
{
    float minX = Min(_lastPoint.x, _currentPoint.x);
	float maxX = Max(_lastPoint.x, _currentPoint.x);
	float minY = Min(_lastPoint.y, _currentPoint.y);
	float maxY = Max(_lastPoint.y, _currentPoint.y);
	
	return NSMakeRect(minX, minY, maxX - minX, maxY - minY);
}
NSRect OpenGLSceneViewCore::orthoManipulatorRect()
{
    return NSMakeRect(3.0f, 3.0f, 30.0f, 30.0f);
}
Example #3
0
}

#elif defined(WEBRTC_MAC_INTEL)
static int _screen = 0;
int WebRtcCreateWindow(CocoaRenderer*& cocoaRenderer,int winNum, int width, int height)
{
    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc]init];

    _screen = winNum = 0;

    // In Cocoa, rendering is not done directly to a window like in Windows and Linux.
    // It is rendererd to a Subclass of NSOpenGLView

    // create cocoa container window
    NSRect outWindowFrame = NSMakeRect(200, 800, width + 20, height + 20);

    NSArray* screens = [NSScreen screens];
    if(_screen >= [screens count])
    {
        // requesting screen
        return -1;
    }
    NSScreen* screen = (NSScreen*)[screens objectAtIndex:_screen];

    NSWindow* outWindow = [[NSWindow alloc] initWithContentRect:outWindowFrame styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO screen:screen];
    [outWindow orderOut:nil];
    [outWindow setTitle:@"Cocoa Renderer"];
    [outWindow setBackgroundColor:[NSColor blueColor]];
    [[outWindow contentView] setAutoresizesSubviews:YES];