Skip to content

Commit

Permalink
Added a multiview test for the Mac. For now, locking focus on views t…
Browse files Browse the repository at this point in the history
…o prevent glitches with multiple NSOpenGLViews on the Mac.
  • Loading branch information
BradLarson committed Apr 28, 2013
1 parent 58e680e commit 7eaf5d3
Show file tree
Hide file tree
Showing 22 changed files with 4,131 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
BCB00A4C172B17F400DB804C /* GPUImage.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BCF8678F17263F3500912E34 /* GPUImage.framework */; };
BCF8676E17263EAC00912E34 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF8676D17263EAC00912E34 /* Cocoa.framework */; };
BCF8677817263EAC00912E34 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = BCF8677617263EAC00912E34 /* InfoPlist.strings */; };
BCF8677A17263EAC00912E34 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BCF8677917263EAC00912E34 /* main.m */; };
Expand Down Expand Up @@ -39,6 +40,19 @@
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
BCB00A4B172B17E900DB804C /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
BCB00A4C172B17F400DB804C /* GPUImage.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
BCF8676A17263EAC00912E34 /* FilterShowcase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FilterShowcase.app; sourceTree = BUILT_PRODUCTS_DIR; };
BCF8676D17263EAC00912E34 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -161,6 +175,7 @@
buildConfigurationList = BCF8678717263EAD00912E34 /* Build configuration list for PBXNativeTarget "FilterShowcase" */;
buildPhases = (
BCF8676617263EAC00912E34 /* Sources */,
BCB00A4B172B17E900DB804C /* CopyFiles */,
BCF8676717263EAC00912E34 /* Frameworks */,
BCF8676817263EAC00912E34 /* Resources */,
);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.sunsetlakesoftware.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013 Sunset Lake Software LLC. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'MultiViewFilterExample' target in the 'MultiViewFilterExample' project
//

#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import <Cocoa/Cocoa.h>
#import "SLSMultiViewWindowController.h"

@interface SLSAppDelegate : NSObject <NSApplicationDelegate>
{
SLSMultiViewWindowController *multiViewWindowController;
}

@property (assign) IBOutlet NSWindow *window;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import "SLSAppDelegate.h"

@implementation SLSAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
multiViewWindowController = [[SLSMultiViewWindowController alloc] initWithWindowNibName:@"SLSMultiViewWindowController"];
[multiViewWindowController showWindow:self];
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import <Cocoa/Cocoa.h>
#import <GPUImage/GPUImage.h>

@interface SLSMultiViewWindowController : NSWindowController
{
GPUImageFilter *filter1, *filter2, *filter3;
GPUImageAVCamera *videoCamera;
}

@property(readwrite) IBOutlet GPUImageView *upperLeftView, *upperRightView, *lowerLeftView, *lowerRightView;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#import "SLSMultiViewWindowController.h"

@interface SLSMultiViewWindowController ()

@end

@implementation SLSMultiViewWindowController

@synthesize upperLeftView = _upperLeftView, upperRightView = _upperRightView, lowerLeftView = _lowerLeftView, lowerRightView = _lowerRightView;

- (id)initWithWindow:(NSWindow *)window
{
self = [super initWithWindow:window];
if (self) {
// Initialization code here.
}

return self;
}

- (void)windowDidLoad
{
[super windowDidLoad];

videoCamera = [[GPUImageAVCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionUnspecified];

filter1 = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"Shader1"];
filter2 = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"Shader2"];
filter3 = [[GPUImageSepiaFilter alloc] init];
[filter1 forceProcessingAtSizeRespectingAspectRatio:self.upperRightView.sizeInPixels];
[filter2 forceProcessingAtSizeRespectingAspectRatio:self.lowerLeftView.sizeInPixels];
[filter3 forceProcessingAtSizeRespectingAspectRatio:self.upperRightView.sizeInPixels];

[videoCamera addTarget:self.upperLeftView];
[videoCamera addTarget:filter1];
[filter1 addTarget:self.upperRightView];
[videoCamera addTarget:filter2];
[filter2 addTarget:self.lowerLeftView];
[videoCamera addTarget:filter3];
[filter3 addTarget:self.lowerRightView];

[videoCamera startCameraCapture];
}

@end
Loading

0 comments on commit 7eaf5d3

Please sign in to comment.