├── .gitignore ├── example ├── Project.xcconfig ├── addons.make ├── ofApp.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── xcshareddata │ │ │ ├── emptyExample.xccheckout │ │ │ └── ofApp.xccheckout │ │ └── xcuserdata │ │ │ └── kyle.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── ofApp Debug.xcscheme │ │ │ └── ofApp Release.xcscheme │ └── xcuserdata │ │ └── kyle.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── readme.md └── src ├── ofxBlur.cpp └── ofxBlur.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.depend 2 | *.layout 3 | *.mode*v3 4 | *.pbxuser 5 | *.app* 6 | *.DS_* 7 | *.xcworkspacedata 8 | 9 | .svn/ 10 | obj/ 11 | bin/ 12 | build/ 13 | !data/ -------------------------------------------------------------------------------- /example/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_LDFLAGS = $(OF_CORE_LIBS) 17 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 18 | -------------------------------------------------------------------------------- /example/addons.make: -------------------------------------------------------------------------------- 1 | ofxBlur 2 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 27F3A2441AD6D4ED00A39919 /* ofApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27F3A2421AD6D4ED00A39919 /* ofApp.cpp */; }; 11 | 27F3A2491AD6D4F600A39919 /* ofxBlur.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27F3A2471AD6D4F600A39919 /* ofxBlur.cpp */; }; 12 | 6474CBF619BCE019003C94E2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6474CBF019BCE00B003C94E2 /* AVFoundation.framework */; }; 13 | 6474CBF719BCE019003C94E2 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6474CBF119BCE00B003C94E2 /* CoreMedia.framework */; }; 14 | 6474CBF819BCE019003C94E2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6474CBF219BCE00B003C94E2 /* QuartzCore.framework */; }; 15 | BBAB23CB13894F3D00AA2426 /* GLUT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; }; 16 | E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4328148138ABC890047C5CB /* openFrameworksDebug.a */; }; 17 | E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9710E8CC7DD009D7055 /* AGL.framework */; }; 18 | E45BE97C0E8CC7DD009D7055 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */; }; 19 | E45BE97D0E8CC7DD009D7055 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9730E8CC7DD009D7055 /* AudioToolbox.framework */; }; 20 | E45BE97F0E8CC7DD009D7055 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9750E8CC7DD009D7055 /* CoreAudio.framework */; }; 21 | E45BE9800E8CC7DD009D7055 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9760E8CC7DD009D7055 /* CoreFoundation.framework */; }; 22 | E45BE9810E8CC7DD009D7055 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9770E8CC7DD009D7055 /* CoreServices.framework */; }; 23 | E45BE9830E8CC7DD009D7055 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE9790E8CC7DD009D7055 /* OpenGL.framework */; }; 24 | E45BE9840E8CC7DD009D7055 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */; }; 25 | E4B69E200A3A1BDC003C02F2 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B69E1D0A3A1BDC003C02F2 /* main.cpp */; }; 26 | E4C2424710CC5A17004149E2 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C2424410CC5A17004149E2 /* AppKit.framework */; }; 27 | E4C2424810CC5A17004149E2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C2424510CC5A17004149E2 /* Cocoa.framework */; }; 28 | E4C2424910CC5A17004149E2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C2424610CC5A17004149E2 /* IOKit.framework */; }; 29 | E4EB6799138ADC1D00A09F29 /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBAB23BE13894E4700AA2426 /* GLUT.framework */; }; 30 | E7E077E515D3B63C0020DFD4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7E077E415D3B63C0020DFD4 /* CoreVideo.framework */; }; 31 | E7E077E815D3B6510020DFD4 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7E077E715D3B6510020DFD4 /* QTKit.framework */; }; 32 | E7F985F815E0DEA3003869B5 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7F985F515E0DE99003869B5 /* Accelerate.framework */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXContainerItemProxy section */ 36 | E4328147138ABC890047C5CB /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */; 39 | proxyType = 2; 40 | remoteGlobalIDString = E4B27C1510CBEB8E00536013; 41 | remoteInfo = openFrameworks; 42 | }; 43 | E4EEB9AB138B136A00A80321 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */; 46 | proxyType = 1; 47 | remoteGlobalIDString = E4B27C1410CBEB8E00536013; 48 | remoteInfo = openFrameworks; 49 | }; 50 | /* End PBXContainerItemProxy section */ 51 | 52 | /* Begin PBXCopyFilesBuildPhase section */ 53 | E4C2427710CC5ABF004149E2 /* CopyFiles */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = ""; 57 | dstSubfolderSpec = 10; 58 | files = ( 59 | BBAB23CB13894F3D00AA2426 /* GLUT.framework in CopyFiles */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXCopyFilesBuildPhase section */ 64 | 65 | /* Begin PBXFileReference section */ 66 | 27F3A2421AD6D4ED00A39919 /* ofApp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofApp.cpp; sourceTree = ""; }; 67 | 27F3A2431AD6D4ED00A39919 /* ofApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofApp.h; sourceTree = ""; }; 68 | 27F3A2471AD6D4F600A39919 /* ofxBlur.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ofxBlur.cpp; sourceTree = ""; }; 69 | 27F3A2481AD6D4F600A39919 /* ofxBlur.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ofxBlur.h; sourceTree = ""; }; 70 | 6474CBF019BCE00B003C94E2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 71 | 6474CBF119BCE00B003C94E2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 72 | 6474CBF219BCE00B003C94E2 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 73 | BBAB23BE13894E4700AA2426 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../libs/glut/lib/osx/GLUT.framework; sourceTree = ""; }; 74 | E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; }; 75 | E45BE9710E8CC7DD009D7055 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = ""; }; 76 | E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; 77 | E45BE9730E8CC7DD009D7055 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; 78 | E45BE9750E8CC7DD009D7055 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; 79 | E45BE9760E8CC7DD009D7055 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 80 | E45BE9770E8CC7DD009D7055 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; 81 | E45BE9790E8CC7DD009D7055 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 82 | E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = ""; }; 83 | E4B69B5B0A3A1756003C02F2 /* ofAppDebug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ofAppDebug.app; sourceTree = BUILT_PRODUCTS_DIR; }; 84 | E4B69E1D0A3A1BDC003C02F2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = src/main.cpp; sourceTree = SOURCE_ROOT; }; 85 | E4B6FCAD0C3E899E008CF71C /* openFrameworks-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = "openFrameworks-Info.plist"; sourceTree = ""; }; 86 | E4C2424410CC5A17004149E2 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 87 | E4C2424510CC5A17004149E2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 88 | E4C2424610CC5A17004149E2 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 89 | E4EB691F138AFCF100A09F29 /* CoreOF.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CoreOF.xcconfig; path = ../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig; sourceTree = SOURCE_ROOT; }; 90 | E4EB6923138AFD0F00A09F29 /* Project.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Project.xcconfig; sourceTree = ""; }; 91 | E7E077E415D3B63C0020DFD4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; 92 | E7E077E715D3B6510020DFD4 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = ""; }; 93 | E7F985F515E0DE99003869B5 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = ""; }; 94 | /* End PBXFileReference section */ 95 | 96 | /* Begin PBXFrameworksBuildPhase section */ 97 | E4B69B590A3A1756003C02F2 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | 6474CBF619BCE019003C94E2 /* AVFoundation.framework in Frameworks */, 102 | 6474CBF719BCE019003C94E2 /* CoreMedia.framework in Frameworks */, 103 | 6474CBF819BCE019003C94E2 /* QuartzCore.framework in Frameworks */, 104 | E7F985F815E0DEA3003869B5 /* Accelerate.framework in Frameworks */, 105 | E7E077E815D3B6510020DFD4 /* QTKit.framework in Frameworks */, 106 | E4EB6799138ADC1D00A09F29 /* GLUT.framework in Frameworks */, 107 | E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */, 108 | E45BE97B0E8CC7DD009D7055 /* AGL.framework in Frameworks */, 109 | E45BE97C0E8CC7DD009D7055 /* ApplicationServices.framework in Frameworks */, 110 | E45BE97D0E8CC7DD009D7055 /* AudioToolbox.framework in Frameworks */, 111 | E45BE97F0E8CC7DD009D7055 /* CoreAudio.framework in Frameworks */, 112 | E45BE9800E8CC7DD009D7055 /* CoreFoundation.framework in Frameworks */, 113 | E45BE9810E8CC7DD009D7055 /* CoreServices.framework in Frameworks */, 114 | E45BE9830E8CC7DD009D7055 /* OpenGL.framework in Frameworks */, 115 | E45BE9840E8CC7DD009D7055 /* QuickTime.framework in Frameworks */, 116 | E4C2424710CC5A17004149E2 /* AppKit.framework in Frameworks */, 117 | E4C2424810CC5A17004149E2 /* Cocoa.framework in Frameworks */, 118 | E4C2424910CC5A17004149E2 /* IOKit.framework in Frameworks */, 119 | E7E077E515D3B63C0020DFD4 /* CoreVideo.framework in Frameworks */, 120 | ); 121 | runOnlyForDeploymentPostprocessing = 0; 122 | }; 123 | /* End PBXFrameworksBuildPhase section */ 124 | 125 | /* Begin PBXGroup section */ 126 | 27F3A2451AD6D4F600A39919 /* ofxBlur */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 27F3A2461AD6D4F600A39919 /* src */, 130 | ); 131 | name = ofxBlur; 132 | sourceTree = ""; 133 | }; 134 | 27F3A2461AD6D4F600A39919 /* src */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 27F3A2471AD6D4F600A39919 /* ofxBlur.cpp */, 138 | 27F3A2481AD6D4F600A39919 /* ofxBlur.h */, 139 | ); 140 | name = src; 141 | path = ../src; 142 | sourceTree = ""; 143 | }; 144 | BB4B014C10F69532006C3DED /* addons */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 27F3A2451AD6D4F600A39919 /* ofxBlur */, 148 | ); 149 | name = addons; 150 | sourceTree = ""; 151 | }; 152 | BBAB23C913894ECA00AA2426 /* system frameworks */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 6474CBF019BCE00B003C94E2 /* AVFoundation.framework */, 156 | 6474CBF119BCE00B003C94E2 /* CoreMedia.framework */, 157 | 6474CBF219BCE00B003C94E2 /* QuartzCore.framework */, 158 | E7F985F515E0DE99003869B5 /* Accelerate.framework */, 159 | E4C2424410CC5A17004149E2 /* AppKit.framework */, 160 | E4C2424510CC5A17004149E2 /* Cocoa.framework */, 161 | E4C2424610CC5A17004149E2 /* IOKit.framework */, 162 | E45BE9710E8CC7DD009D7055 /* AGL.framework */, 163 | E45BE9720E8CC7DD009D7055 /* ApplicationServices.framework */, 164 | E45BE9730E8CC7DD009D7055 /* AudioToolbox.framework */, 165 | E45BE9750E8CC7DD009D7055 /* CoreAudio.framework */, 166 | E45BE9760E8CC7DD009D7055 /* CoreFoundation.framework */, 167 | E45BE9770E8CC7DD009D7055 /* CoreServices.framework */, 168 | E45BE9790E8CC7DD009D7055 /* OpenGL.framework */, 169 | E45BE97A0E8CC7DD009D7055 /* QuickTime.framework */, 170 | E7E077E415D3B63C0020DFD4 /* CoreVideo.framework */, 171 | E7E077E715D3B6510020DFD4 /* QTKit.framework */, 172 | ); 173 | name = "system frameworks"; 174 | sourceTree = ""; 175 | }; 176 | BBAB23CA13894EDB00AA2426 /* 3rd party frameworks */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | BBAB23BE13894E4700AA2426 /* GLUT.framework */, 180 | ); 181 | name = "3rd party frameworks"; 182 | sourceTree = ""; 183 | }; 184 | E4328144138ABC890047C5CB /* Products */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | E4328148138ABC890047C5CB /* openFrameworksDebug.a */, 188 | ); 189 | name = Products; 190 | sourceTree = ""; 191 | }; 192 | E45BE5980E8CC70C009D7055 /* frameworks */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | BBAB23CA13894EDB00AA2426 /* 3rd party frameworks */, 196 | BBAB23C913894ECA00AA2426 /* system frameworks */, 197 | ); 198 | name = frameworks; 199 | sourceTree = ""; 200 | }; 201 | E4B69B4A0A3A1720003C02F2 = { 202 | isa = PBXGroup; 203 | children = ( 204 | E4B6FCAD0C3E899E008CF71C /* openFrameworks-Info.plist */, 205 | E4EB6923138AFD0F00A09F29 /* Project.xcconfig */, 206 | E4B69E1C0A3A1BDC003C02F2 /* src */, 207 | E4EEC9E9138DF44700A80321 /* openFrameworks */, 208 | BB4B014C10F69532006C3DED /* addons */, 209 | E45BE5980E8CC70C009D7055 /* frameworks */, 210 | E4B69B5B0A3A1756003C02F2 /* ofAppDebug.app */, 211 | ); 212 | sourceTree = ""; 213 | }; 214 | E4B69E1C0A3A1BDC003C02F2 /* src */ = { 215 | isa = PBXGroup; 216 | children = ( 217 | 27F3A2421AD6D4ED00A39919 /* ofApp.cpp */, 218 | 27F3A2431AD6D4ED00A39919 /* ofApp.h */, 219 | E4B69E1D0A3A1BDC003C02F2 /* main.cpp */, 220 | ); 221 | path = src; 222 | sourceTree = SOURCE_ROOT; 223 | }; 224 | E4EEC9E9138DF44700A80321 /* openFrameworks */ = { 225 | isa = PBXGroup; 226 | children = ( 227 | E4EB691F138AFCF100A09F29 /* CoreOF.xcconfig */, 228 | E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */, 229 | ); 230 | name = openFrameworks; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXGroup section */ 234 | 235 | /* Begin PBXNativeTarget section */ 236 | E4B69B5A0A3A1756003C02F2 /* ofApp */ = { 237 | isa = PBXNativeTarget; 238 | buildConfigurationList = E4B69B5F0A3A1757003C02F2 /* Build configuration list for PBXNativeTarget "ofApp" */; 239 | buildPhases = ( 240 | E4B69B580A3A1756003C02F2 /* Sources */, 241 | E4B69B590A3A1756003C02F2 /* Frameworks */, 242 | E4B6FFFD0C3F9AB9008CF71C /* ShellScript */, 243 | E4C2427710CC5ABF004149E2 /* CopyFiles */, 244 | ); 245 | buildRules = ( 246 | ); 247 | dependencies = ( 248 | E4EEB9AC138B136A00A80321 /* PBXTargetDependency */, 249 | ); 250 | name = ofApp; 251 | productName = myOFApp; 252 | productReference = E4B69B5B0A3A1756003C02F2 /* ofAppDebug.app */; 253 | productType = "com.apple.product-type.application"; 254 | }; 255 | /* End PBXNativeTarget section */ 256 | 257 | /* Begin PBXProject section */ 258 | E4B69B4C0A3A1720003C02F2 /* Project object */ = { 259 | isa = PBXProject; 260 | attributes = { 261 | LastUpgradeCheck = 0460; 262 | }; 263 | buildConfigurationList = E4B69B4D0A3A1720003C02F2 /* Build configuration list for PBXProject "ofApp" */; 264 | compatibilityVersion = "Xcode 3.2"; 265 | developmentRegion = English; 266 | hasScannedForEncodings = 0; 267 | knownRegions = ( 268 | English, 269 | Japanese, 270 | French, 271 | German, 272 | ); 273 | mainGroup = E4B69B4A0A3A1720003C02F2; 274 | productRefGroup = E4B69B4A0A3A1720003C02F2; 275 | projectDirPath = ""; 276 | projectReferences = ( 277 | { 278 | ProductGroup = E4328144138ABC890047C5CB /* Products */; 279 | ProjectRef = E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */; 280 | }, 281 | ); 282 | projectRoot = ""; 283 | targets = ( 284 | E4B69B5A0A3A1756003C02F2 /* ofApp */, 285 | ); 286 | }; 287 | /* End PBXProject section */ 288 | 289 | /* Begin PBXReferenceProxy section */ 290 | E4328148138ABC890047C5CB /* openFrameworksDebug.a */ = { 291 | isa = PBXReferenceProxy; 292 | fileType = archive.ar; 293 | path = openFrameworksDebug.a; 294 | remoteRef = E4328147138ABC890047C5CB /* PBXContainerItemProxy */; 295 | sourceTree = BUILT_PRODUCTS_DIR; 296 | }; 297 | /* End PBXReferenceProxy section */ 298 | 299 | /* Begin PBXShellScriptBuildPhase section */ 300 | E4B6FFFD0C3F9AB9008CF71C /* ShellScript */ = { 301 | isa = PBXShellScriptBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | inputPaths = ( 306 | ); 307 | outputPaths = ( 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | shellPath = /bin/sh; 311 | shellScript = "cp -f ../../../libs/fmodex/lib/osx/libfmodex.dylib \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/libfmodex.dylib\"; install_name_tool -change ./libfmodex.dylib @executable_path/libfmodex.dylib \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME\";\nmkdir -p \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/\"\ncp -f \"$ICON_FILE\" \"$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/\"\n"; 312 | }; 313 | /* End PBXShellScriptBuildPhase section */ 314 | 315 | /* Begin PBXSourcesBuildPhase section */ 316 | E4B69B580A3A1756003C02F2 /* Sources */ = { 317 | isa = PBXSourcesBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | 27F3A2441AD6D4ED00A39919 /* ofApp.cpp in Sources */, 321 | 27F3A2491AD6D4F600A39919 /* ofxBlur.cpp in Sources */, 322 | E4B69E200A3A1BDC003C02F2 /* main.cpp in Sources */, 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | }; 326 | /* End PBXSourcesBuildPhase section */ 327 | 328 | /* Begin PBXTargetDependency section */ 329 | E4EEB9AC138B136A00A80321 /* PBXTargetDependency */ = { 330 | isa = PBXTargetDependency; 331 | name = openFrameworks; 332 | targetProxy = E4EEB9AB138B136A00A80321 /* PBXContainerItemProxy */; 333 | }; 334 | /* End PBXTargetDependency section */ 335 | 336 | /* Begin XCBuildConfiguration section */ 337 | E4B69B4E0A3A1720003C02F2 /* Debug */ = { 338 | isa = XCBuildConfiguration; 339 | baseConfigurationReference = E4EB6923138AFD0F00A09F29 /* Project.xcconfig */; 340 | buildSettings = { 341 | ARCHS = "$(NATIVE_ARCH)"; 342 | CONFIGURATION_BUILD_DIR = "$(SRCROOT)/bin/"; 343 | COPY_PHASE_STRIP = NO; 344 | DEAD_CODE_STRIPPING = YES; 345 | GCC_AUTO_VECTORIZATION = YES; 346 | GCC_ENABLE_SSE3_EXTENSIONS = YES; 347 | GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES; 348 | GCC_INLINES_ARE_PRIVATE_EXTERN = NO; 349 | GCC_OPTIMIZATION_LEVEL = 0; 350 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 351 | GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; 352 | GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO; 353 | GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO; 354 | GCC_WARN_UNINITIALIZED_AUTOS = NO; 355 | GCC_WARN_UNUSED_VALUE = NO; 356 | GCC_WARN_UNUSED_VARIABLE = NO; 357 | MACOSX_DEPLOYMENT_TARGET = 10.6; 358 | OTHER_CPLUSPLUSFLAGS = ( 359 | "-D__MACOSX_CORE__", 360 | "-lpthread", 361 | "-mtune=native", 362 | ); 363 | SDKROOT = macosx; 364 | }; 365 | name = Debug; 366 | }; 367 | E4B69B4F0A3A1720003C02F2 /* Release */ = { 368 | isa = XCBuildConfiguration; 369 | baseConfigurationReference = E4EB6923138AFD0F00A09F29 /* Project.xcconfig */; 370 | buildSettings = { 371 | ARCHS = "$(NATIVE_ARCH)"; 372 | CONFIGURATION_BUILD_DIR = "$(SRCROOT)/bin/"; 373 | COPY_PHASE_STRIP = YES; 374 | DEAD_CODE_STRIPPING = YES; 375 | GCC_AUTO_VECTORIZATION = YES; 376 | GCC_ENABLE_SSE3_EXTENSIONS = YES; 377 | GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = YES; 378 | GCC_INLINES_ARE_PRIVATE_EXTERN = NO; 379 | GCC_OPTIMIZATION_LEVEL = 3; 380 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 381 | GCC_UNROLL_LOOPS = YES; 382 | GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; 383 | GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO; 384 | GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO; 385 | GCC_WARN_UNINITIALIZED_AUTOS = NO; 386 | GCC_WARN_UNUSED_VALUE = NO; 387 | GCC_WARN_UNUSED_VARIABLE = NO; 388 | MACOSX_DEPLOYMENT_TARGET = 10.6; 389 | OTHER_CPLUSPLUSFLAGS = ( 390 | "-D__MACOSX_CORE__", 391 | "-lpthread", 392 | "-mtune=native", 393 | ); 394 | SDKROOT = macosx; 395 | }; 396 | name = Release; 397 | }; 398 | E4B69B600A3A1757003C02F2 /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 402 | COMBINE_HIDPI_IMAGES = YES; 403 | COPY_PHASE_STRIP = NO; 404 | FRAMEWORK_SEARCH_PATHS = ( 405 | "$(inherited)", 406 | "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", 407 | ); 408 | FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/glut/lib/osx\""; 409 | GCC_DYNAMIC_NO_PIC = NO; 410 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 411 | GCC_MODEL_TUNING = NONE; 412 | ICON = "$(ICON_NAME_DEBUG)"; 413 | ICON_FILE = "$(ICON_FILE_PATH)$(ICON)"; 414 | INFOPLIST_FILE = "openFrameworks-Info.plist"; 415 | INSTALL_PATH = "$(HOME)/Applications"; 416 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 417 | MACOSX_DEPLOYMENT_TARGET = ""; 418 | ONLY_ACTIVE_ARCH = NO; 419 | PRODUCT_NAME = ofAppDebug; 420 | USER_HEADER_SEARCH_PATHS = ""; 421 | WRAPPER_EXTENSION = app; 422 | }; 423 | name = Debug; 424 | }; 425 | E4B69B610A3A1757003C02F2 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 429 | COMBINE_HIDPI_IMAGES = YES; 430 | COPY_PHASE_STRIP = YES; 431 | FRAMEWORK_SEARCH_PATHS = ( 432 | "$(inherited)", 433 | "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", 434 | ); 435 | FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../libs/glut/lib/osx\""; 436 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES; 437 | GCC_MODEL_TUNING = NONE; 438 | ICON = "$(ICON_NAME_RELEASE)"; 439 | ICON_FILE = "$(ICON_FILE_PATH)$(ICON)"; 440 | INFOPLIST_FILE = "openFrameworks-Info.plist"; 441 | INSTALL_PATH = "$(HOME)/Applications"; 442 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 443 | MACOSX_DEPLOYMENT_TARGET = ""; 444 | ONLY_ACTIVE_ARCH = NO; 445 | PRODUCT_NAME = ofApp; 446 | USER_HEADER_SEARCH_PATHS = ""; 447 | WRAPPER_EXTENSION = app; 448 | }; 449 | name = Release; 450 | }; 451 | /* End XCBuildConfiguration section */ 452 | 453 | /* Begin XCConfigurationList section */ 454 | E4B69B4D0A3A1720003C02F2 /* Build configuration list for PBXProject "ofApp" */ = { 455 | isa = XCConfigurationList; 456 | buildConfigurations = ( 457 | E4B69B4E0A3A1720003C02F2 /* Debug */, 458 | E4B69B4F0A3A1720003C02F2 /* Release */, 459 | ); 460 | defaultConfigurationIsVisible = 0; 461 | defaultConfigurationName = Release; 462 | }; 463 | E4B69B5F0A3A1757003C02F2 /* Build configuration list for PBXNativeTarget "ofApp" */ = { 464 | isa = XCConfigurationList; 465 | buildConfigurations = ( 466 | E4B69B600A3A1757003C02F2 /* Debug */, 467 | E4B69B610A3A1757003C02F2 /* Release */, 468 | ); 469 | defaultConfigurationIsVisible = 0; 470 | defaultConfigurationName = Release; 471 | }; 472 | /* End XCConfigurationList section */ 473 | }; 474 | rootObject = E4B69B4C0A3A1720003C02F2 /* Project object */; 475 | } 476 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/project.xcworkspace/xcshareddata/emptyExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | ED99B3B1-4DB9-41F7-B7AA-5B9555F4E314 9 | IDESourceControlProjectName 10 | emptyExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 14 | github.com:kylemcdonald/openFrameworks.git 15 | 16 | IDESourceControlProjectPath 17 | scripts/osx/template/emptyExample.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:kylemcdonald/openFrameworks.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 36 | IDESourceControlWCCName 37 | openFrameworks 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/project.xcworkspace/xcshareddata/ofApp.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 66DFE35C-2BD3-491C-A699-E748414C392C 9 | IDESourceControlProjectName 10 | ofApp 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 14 | github.com:kylemcdonald/openFrameworks.git 15 | 8B7D3B297962C41A4A67EFE4DB1DBDE53440A0BB 16 | github.com:kylemcdonald/ofxBlur.git 17 | 18 | IDESourceControlProjectPath 19 | example/ofApp.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 23 | ../../../.. 24 | 8B7D3B297962C41A4A67EFE4DB1DBDE53440A0BB 25 | ../../.. 26 | 27 | IDESourceControlProjectURL 28 | github.com:kylemcdonald/ofxBlur.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 8B7D3B297962C41A4A67EFE4DB1DBDE53440A0BB 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | 2DE9C8846D9375EAACFABA8963120E8E7719BAF5 40 | IDESourceControlWCCName 41 | 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 8B7D3B297962C41A4A67EFE4DB1DBDE53440A0BB 48 | IDESourceControlWCCName 49 | ofxBlur 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/project.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kylemcdonald/ofxBlur/6112fee26fba30581af74206c5c09c18307d1935/example/ofApp.xcodeproj/project.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/project.xcworkspace/xcuserdata/kyle.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/xcshareddata/xcschemes/ofApp Debug.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/xcshareddata/xcschemes/ofApp Release.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /example/ofApp.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SuppressBuildableAutocreation 6 | 7 | E4B69B5A0A3A1756003C02F2 8 | 9 | primary 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /example/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | NSHighResolutionCapable 20 | 21 | CFBundleIconFile 22 | ${ICON} 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | int main() { 4 | ofGLWindowSettings settings; 5 | settings.setSize(640, 480); 6 | settings.setGLVersion(3,2); // GL3 7 | // settings.setGLVersion(2,1); // GL2 8 | ofCreateWindow(settings); 9 | ofRunApp(new ofApp()); 10 | } 11 | -------------------------------------------------------------------------------- /example/src/ofApp.cpp: -------------------------------------------------------------------------------- 1 | #include "ofApp.h" 2 | 3 | void ofApp::setup() { 4 | ofSetLogLevel(OF_LOG_VERBOSE); 5 | cam.initGrabber(640, 480); 6 | 7 | // there are a 6 ways to control what's going on with ofxBlur 8 | // 4 parameters are in the setup() function: 9 | // - radius corresponds to how many points you want to use when blurring 10 | // this usually corresponds to how big you want your blur to be 11 | // so a 10 pixel radius means you want 10 samples to have perfect blur 12 | // if you set this too high, the blur will start to get slow 13 | // - shape corresponds to the variance of the gaussian function used for 14 | // the blur kernel. a larger variance means you will have more like a 15 | // box blur, a smaller variance means it will be more "gaussian" blur 16 | // this has no effect on the speed of the blur 17 | // - passes corresponds to how many downsampling blur passes are used 18 | // setting this number higher will give more of a "fog" or "bloom" look 19 | // if you set this too high, the blur will start to get slow 20 | // - downsample (not shown here, defaults to .5) corresponds to the scale 21 | // factor when downsampling when passes is greater than 1 22 | // this has no effect on the speed of the blur 23 | blur.setup(cam.getWidth(), cam.getHeight(), 10, .2, 2); 24 | } 25 | 26 | void ofApp::update() { 27 | cam.update(); 28 | // 2 parameters can be controlled in real time after setup(): 29 | // - scale corresponds to how much you "stretch" the blur kernel 30 | // anything greater than 1 will start to look inaccurate, but it can be 31 | // a fast way of getting a bigger blur. anything smaller than 1 will 32 | // create an smaller blur, and eventually the blur will disappear 33 | // this has no effect on the speed of the blur 34 | // - rotation corresponds to the two directions the blur is calculated in 35 | // this only has a visible effect if the scale is greater than 1 36 | blur.setScale(ofMap(mouseX, 0, ofGetWidth(), 0, 10)); 37 | blur.setRotation(ofMap(mouseY, 0, ofGetHeight(), -PI, PI)); 38 | } 39 | 40 | void ofApp::draw() { 41 | ofBackground(0); 42 | 43 | blur.begin(); 44 | ofSetColor(255); 45 | cam.draw(0, 0); 46 | ofSetCircleResolution(64); 47 | ofDrawCircle(mouseX, mouseY, 32); 48 | blur.end(); 49 | 50 | blur.draw(); 51 | 52 | ofDrawBitmapString(ofToString((int) ofGetFrameRate()), 10, 20); 53 | } 54 | -------------------------------------------------------------------------------- /example/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxBlur.h" 5 | 6 | class ofApp : public ofBaseApp { 7 | public: 8 | void setup(); 9 | void update(); 10 | void draw(); 11 | 12 | ofVideoGrabber cam; 13 | ofxBlur blur; 14 | }; 15 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # ofxBlur is an addon for [openFrameworks](http://openframeworks.cc) 2 | 3 | ofxBlur uses a ping-pong technique on the graphics card to do a very fast, configurable blur. ofxBlur can also simulate bloom given the right parameters. 4 | 5 | Only call `setup()` once. You must specify the `width` and `height` so the internal FBOs can be allocated. `radius`describes the radius of the blur kernel. The larger the `radius`, the longer it takes to compute the blur. If you want a larger apparent radius at the same speed, use `setScale(x)` where `x>1`. This yields a lower-quality but faster blur. `shape` describes the circularity/squareness of the kernel. For a more circular kernel, use smaller values like `.2` and for a more square kernel use larger values like `10`. For more square kernels, rotating the kernel has an obvious visual effect. use `setRotation()` to set the rotation of the kernel in radians. Finally, using the `passes` and `downsample` arguments, you can run the blur filter multiple times at different scales and ofxBlur will combine the results for you. This can be used to create a more bloom-like or fog-like effect. 6 | 7 | ofxBlur was originally written for [Eyeshine](https://github.com/kylemcdonald/Eyeshine), a collaboration between Golan Levin and Kyle McDonald. -------------------------------------------------------------------------------- /src/ofxBlur.cpp: -------------------------------------------------------------------------------- 1 | #include "ofxBlur.h" 2 | 3 | float Gaussian(float x, float mean, float variance) { 4 | x -= mean; 5 | return (1. / sqrt(TWO_PI * variance)) * exp(-(x * x) / (2 * variance)); 6 | } 7 | 8 | void GaussianRow(int elements, vector& row, float variance = .2) { 9 | row.resize(elements); 10 | for(int i = 0; i < elements; i++) { 11 | float x = ofMap(i, 0, elements - 1, -1, 1); 12 | row[i] = Gaussian(x, 0, variance); 13 | } 14 | } 15 | 16 | // needed for programmable renderer 17 | string generatePassThruVert(){ 18 | stringstream src; 19 | 20 | src <<"#version 150\n"; 21 | src <<"uniform mat4 modelViewProjectionMatrix;\n"; 22 | src <<"in vec4 position;\n"; 23 | src <<"in vec2 texcoord;\n"; 24 | src <<"out vec2 vTexCoord;\n"; 25 | src <<"void main() {;\n"; 26 | src <<"\tvTexCoord = texcoord;\n"; 27 | src <<"\tgl_Position = modelViewProjectionMatrix * position;\n"; 28 | src <<"}\n"; 29 | 30 | return src.str(); 31 | } 32 | 33 | string generateBlurSource(int radius, float shape) { 34 | int rowSize = 2 * radius + 1; 35 | 36 | // generate row 37 | vector row; 38 | GaussianRow(rowSize, row, shape); 39 | 40 | // normalize row and coefficients 41 | vector coefficients; 42 | float sum = 0; 43 | for(int i = 0; i < row.size(); i++) { 44 | sum += row[i]; 45 | } 46 | for(int i = 0; i < row.size(); i++) { 47 | row[i] /= sum; 48 | } 49 | int center = row.size() / 2; 50 | coefficients.push_back(row[center]); 51 | for(int i = center + 1; i < row.size(); i += 2) { 52 | float weightSum = row[i] + row[i + 1]; 53 | coefficients.push_back(weightSum); 54 | } 55 | 56 | // generate offsets 57 | vector offsets; 58 | for(int i = center + 1; i < row.size(); i += 2) { 59 | int left = i - center; 60 | int right = left + 1; 61 | float leftVal = row[i]; 62 | float rightVal = row[i + 1]; 63 | float weightSum = leftVal + rightVal; 64 | float weightedAverage = (left * leftVal + right * rightVal) / weightSum; 65 | offsets.push_back(weightedAverage); 66 | } 67 | 68 | stringstream src; 69 | 70 | if ( ofIsGLProgrammableRenderer() ){ 71 | src << "#version 150\n"; 72 | src << "uniform sampler2DRect source;\n"; 73 | src << "uniform vec2 direction;\n"; 74 | src << "in vec2 vTexCoord;\n"; 75 | 76 | src << "out vec4 vFragColor;\n"; 77 | 78 | src << "void main(void) {\n"; 79 | src << "\tvec2 tc = vTexCoord;\n"; 80 | src << "\tvFragColor = " << coefficients[0] << " * texture(source, tc);\n"; 81 | for(int i = 1; i < coefficients.size(); i++) { 82 | int curOffset = i - 1; 83 | src << "\tvFragColor += " << coefficients[i] << " * \n"; 84 | src << "\t\t(texture(source, tc - (direction * " << offsets[i - 1] << ")) + \n"; 85 | src << "\t\ttexture(source, tc + (direction * " << offsets[i - 1] << "))); \n"; 86 | } 87 | src << "}\n"; 88 | } else { 89 | src << "#version 120\n"; 90 | src << "#extension GL_ARB_texture_rectangle : enable\n"; 91 | src << "uniform sampler2DRect source;\n"; 92 | src << "uniform vec2 direction;\n"; 93 | src << "void main(void) {\n"; 94 | src << "\tvec2 tc = gl_TexCoord[0].st;\n"; 95 | src << "\tgl_FragColor = " << coefficients[0] << " * texture2DRect(source, tc);\n"; 96 | for(int i = 1; i < coefficients.size(); i++) { 97 | int curOffset = i - 1; 98 | src << "\tgl_FragColor += " << coefficients[i] << " * \n"; 99 | src << "\t\t(texture2DRect(source, tc - (direction * " << offsets[i - 1] << ")) + \n"; 100 | src << "\t\ttexture2DRect(source, tc + (direction * " << offsets[i - 1] << ")));\n"; 101 | } 102 | src << "}\n"; 103 | } 104 | 105 | return src.str(); 106 | } 107 | 108 | string generateCombineSource(int passes, float downsample) { 109 | vector combineNames; 110 | for(int i = 0; i < passes; i++) { 111 | combineNames.push_back("s" + ofToString(i)); 112 | } 113 | stringstream src; 114 | if ( ofIsGLProgrammableRenderer() ){ 115 | src << "#version 150\n"; 116 | src << "uniform sampler2DRect " << ofJoinString(combineNames, ",") << ";\n"; 117 | src << "uniform float brightness;\n"; 118 | if(downsample == 1) { 119 | src << "const float scaleFactor = 1.;\n"; 120 | } else { 121 | src << "const float scaleFactor = " << downsample << ";\n"; 122 | } 123 | src << "in vec2 vTexCoord;\n"; 124 | src << "out vec4 vFragColor;\n"; 125 | 126 | src << "void main(void) {\n"; 127 | src << "\tvec2 tc = vTexCoord;\n"; 128 | for(int i = 0; i < passes; i++) { 129 | src << "\tvFragColor " << (i == 0 ? "=" : "+="); 130 | src << " texture(" << combineNames[i] << ", tc);"; 131 | src << (i + 1 != passes ? " tc *= scaleFactor;" : ""); 132 | src << "\n"; 133 | } 134 | src << "\tvFragColor *= brightness / " << passes << ".;\n"; 135 | src << "}\n"; 136 | } else { 137 | src << "#version 120\n"; 138 | src << "#extension GL_ARB_texture_rectangle : enable\n"; 139 | src << "uniform sampler2DRect " << ofJoinString(combineNames, ",") << ";\n"; 140 | src << "uniform float brightness;\n"; 141 | if(downsample == 1) { 142 | src << "const float scaleFactor = 1.;\n"; 143 | } else { 144 | src << "const float scaleFactor = " << downsample << ";\n"; 145 | } 146 | src << "void main(void) {\n"; 147 | src << "\tvec2 tc = gl_TexCoord[0].st;\n"; 148 | for(int i = 0; i < passes; i++) { 149 | src << "\tgl_FragColor " << (i == 0 ? "=" : "+="); 150 | src << " texture2DRect(" << combineNames[i] << ", tc);"; 151 | src << (i + 1 != passes ? " tc *= scaleFactor;" : ""); 152 | src << "\n"; 153 | } 154 | src << "\tgl_FragColor *= brightness / " << passes << ".;\n"; 155 | src << "}\n"; 156 | } 157 | return src.str(); 158 | } 159 | 160 | ofxBlur::ofxBlur() 161 | :scale(1) 162 | ,rotation(0) 163 | ,brightness(1) { 164 | } 165 | 166 | void ofxBlur::setup(int width, int height, int radius, float shape, int passes, float downsample) { 167 | string blurSource = generateBlurSource(radius, shape); 168 | if(ofGetLogLevel() == OF_LOG_VERBOSE) { 169 | cout << "ofxBlur is loading blur shader:" << endl << blurSource << endl; 170 | } 171 | if (ofIsGLProgrammableRenderer()){ 172 | string blurPassThru = generatePassThruVert(); 173 | if(ofGetLogLevel() == OF_LOG_VERBOSE) { 174 | cout << "ofxBlur is loading blur vertex shader:" << endl << blurPassThru << endl; 175 | } 176 | blurShader.setupShaderFromSource(GL_VERTEX_SHADER, blurPassThru); 177 | } 178 | blurShader.setupShaderFromSource(GL_FRAGMENT_SHADER, blurSource); 179 | 180 | if (ofIsGLProgrammableRenderer()){ 181 | blurShader.bindDefaults(); 182 | } 183 | blurShader.linkProgram(); 184 | 185 | if(passes > 1) { 186 | string combineSource = generateCombineSource(passes, downsample); 187 | if(ofGetLogLevel() == OF_LOG_VERBOSE) { 188 | cout << "ofxBlur is loading combine shader:" << endl << combineSource << endl; 189 | } 190 | if (ofIsGLProgrammableRenderer()){ 191 | string blurPassThru = generatePassThruVert(); 192 | if(ofGetLogLevel() == OF_LOG_VERBOSE) { 193 | cout << "ofxBlur is loading blur vertex shader:" << endl << blurPassThru << endl; 194 | } 195 | combineShader.setupShaderFromSource(GL_VERTEX_SHADER, blurPassThru); 196 | } 197 | combineShader.setupShaderFromSource(GL_FRAGMENT_SHADER, combineSource); 198 | if (ofIsGLProgrammableRenderer()){ 199 | combineShader.bindDefaults(); 200 | } 201 | combineShader.linkProgram(); 202 | } 203 | 204 | base.allocate(width, height); 205 | base.begin(); ofClear(0); base.end(); 206 | 207 | ofFbo::Settings settings; 208 | settings.useDepth = false; 209 | settings.useStencil = false; 210 | settings.numSamples = 0; 211 | ping.resize(passes); 212 | pong.resize(passes); 213 | for(int i = 0; i < passes; i++) { 214 | ofLogVerbose() << "building ping/pong " << width << "x" << height; 215 | settings.width = width; 216 | settings.height = height; 217 | ping[i].allocate(settings); 218 | ping[i].begin(); ofClear(0); ping[i].end(); 219 | pong[i].allocate(settings); 220 | pong[i].begin(); ofClear(0); pong[i].end(); 221 | // ping[i].setDefaultTextureIndex(i); 222 | // pong[i].setDefaultTextureIndex(i); 223 | width *= downsample; 224 | height *= downsample; 225 | } 226 | } 227 | 228 | void ofxBlur::setScale(float scale) { 229 | this->scale = scale; 230 | } 231 | 232 | void ofxBlur::setRotation(float rotation) { 233 | this->rotation = rotation; 234 | } 235 | 236 | void ofxBlur::setBrightness(float brightness) { 237 | this->brightness = brightness; 238 | } 239 | 240 | void ofxBlur::begin() { 241 | base.begin(); 242 | } 243 | 244 | void ofxBlur::end() { 245 | base.end(); 246 | 247 | ofPushStyle(); 248 | ofSetColor(255); 249 | 250 | ofVec2f xDirection = ofVec2f(scale, 0).getRotatedRad(rotation); 251 | ofVec2f yDirection = ofVec2f(0, scale).getRotatedRad(rotation); 252 | for(int i = 0; i < ping.size(); i++) { 253 | ofFbo& curPing = ping[i]; 254 | ofFbo& curPong = pong[i]; 255 | 256 | // resample previous result into ping 257 | curPing.begin(); 258 | int w = curPing.getWidth(); 259 | int h = curPing.getHeight(); 260 | if(i > 0) { 261 | ping[i - 1].draw(0, 0, w, h); 262 | } else { 263 | base.draw(0, 0, w, h); 264 | } 265 | curPing.end(); 266 | 267 | // horizontal blur ping into pong 268 | curPong.begin(); 269 | blurShader.begin(); 270 | blurShader.setUniformTexture("source", curPing.getTexture(), 0); 271 | blurShader.setUniform2f("direction", xDirection.x, xDirection.y); 272 | curPing.draw(0, 0); 273 | blurShader.end(); 274 | curPong.end(); 275 | 276 | // vertical blur pong into ping 277 | curPing.begin(); 278 | blurShader.begin(); 279 | blurShader.setUniformTexture("source", curPong.getTexture(), 0); 280 | blurShader.setUniform2f("direction", yDirection.x, yDirection.y); 281 | curPong.draw(0, 0); 282 | blurShader.end(); 283 | curPing.end(); 284 | } 285 | 286 | // render ping back into base 287 | if(ping.size() > 1) { 288 | int w = base.getWidth(); 289 | int h = base.getHeight(); 290 | 291 | base.begin(); 292 | combineShader.begin(); 293 | for(int i = 0; i < ping.size(); i++) { 294 | string name = "s" + ofToString(i); 295 | combineShader.setUniformTexture(name.c_str(), 296 | ping[i].getTexture(), 297 | 1 + i); 298 | } 299 | combineShader.setUniform1f("brightness", brightness); 300 | ping[0].draw(0, 0); 301 | combineShader.end(); 302 | base.end(); 303 | } else { 304 | base.begin(); 305 | ping[0].draw(0, 0); 306 | base.end(); 307 | } 308 | 309 | ofPopStyle(); 310 | } 311 | 312 | ofTexture& ofxBlur::getTexture() { 313 | return base.getTexture(); 314 | } 315 | 316 | void ofxBlur::draw() { 317 | base.draw(0, 0); 318 | } 319 | 320 | void ofxBlur::draw(ofRectangle rect) { 321 | base.draw(rect); 322 | } 323 | -------------------------------------------------------------------------------- /src/ofxBlur.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | 5 | class ofxBlur { 6 | protected: 7 | ofFbo base; 8 | vector ping, pong; 9 | 10 | ofShader blurShader, combineShader; 11 | float scale, rotation; 12 | float downsample; 13 | float brightness; 14 | 15 | public: 16 | ofxBlur(); 17 | 18 | void setup(int width, int height, int radius = 32, float shape = .2, int passes = 1, float downsample = .5); 19 | 20 | void setScale(float scale); 21 | void setRotation(float rotation); 22 | void setBrightness(float brightness); // only applies to multipass 23 | 24 | void begin(); 25 | void end(); 26 | void draw(); 27 | 28 | ofTexture& getTexture(); 29 | void draw(ofRectangle rect); 30 | }; 31 | 32 | // <3 kyle 33 | --------------------------------------------------------------------------------