Permalink
Browse files

fixed some project files. modified maskblur shader to not fail on int…

…erpolated edges
  • Loading branch information...
1 parent 76f550f commit b576a452b16f8d3f70aad28ce6566ce208645505 @kylemcdonald kylemcdonald committed Oct 16, 2011

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -58,8 +58,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 27884FB51447157100A18668 /* Clone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Clone.cpp; path = ../../../../../../../Users/kyle/Documents/openFrameworks/apps/FaceSubstitution/CloningWrapper/src/Clone.cpp; sourceTree = SOURCE_ROOT; };
- 27884FB61447157100A18668 /* Clone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Clone.h; path = ../../../../../../../Users/kyle/Documents/openFrameworks/apps/FaceSubstitution/CloningWrapper/src/Clone.h; sourceTree = SOURCE_ROOT; };
+ 27884FB51447157100A18668 /* Clone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Clone.cpp; path = ../../../apps/FaceSubstitution/CloningWrapper/src/Clone.cpp; sourceTree = SOURCE_ROOT; };
+ 27884FB61447157100A18668 /* Clone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Clone.h; path = ../../../apps/FaceSubstitution/CloningWrapper/src/Clone.h; sourceTree = SOURCE_ROOT; };
BBAB23BE13894E4700AA2426 /* GLUT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLUT.framework; path = ../../../libs/glut/lib/osx/GLUT.framework; sourceTree = "<group>"; };
E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; };
E45BE9710E8CC7DD009D7055 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
@@ -12,7 +12,7 @@ void main() {\
vec2 curOffset = float(i) * direction;\
vec4 leftMask = texture2DRect(mask, pos - curOffset);\
vec4 rightMask = texture2DRect(mask, pos + curOffset);\
- bool valid = leftMask.r > 0. && rightMask.r > 0.;\
+ bool valid = leftMask.r == 1. && rightMask.r == 1.;\
if(valid) {\
sum +=\
texture2DRect(tex, pos + curOffset) +\
@@ -17,6 +17,7 @@ void testApp::update() {
ofSetColor(255);
src.begin();
+ ofClear(0, 255);
dst.draw(x - w / 2, y - h / 2);
src.end();
@@ -2,9 +2,9 @@ uniform sampler2DRect tex, mask;
uniform vec2 direction;
uniform int k;
-#define LOW_RES
+//#define LOW_RES
//#define USE_HARDWARE_INTERPOLATION
-//#define STANDARD
+#define STANDARD
void main() {
vec2 pos = gl_TexCoord[0].st;
@@ -17,7 +17,7 @@ void main() {
vec2 offset = float(i) * direction;
vec4 leftMask = texture2DRect(mask, pos - offset);
vec4 rightMask = texture2DRect(mask, pos + offset);
- bool valid = leftMask.r > 0. && rightMask.r > 0.; // ignore black pixels
+ bool valid = leftMask.r == 1. && rightMask.r == 1.; // ignore black pixels
if(valid) {
sum +=
texture2DRect(tex, pos + offset) +
@@ -35,7 +35,7 @@ void main() {
vec2 maskOffset = float(i) * direction;
vec4 leftMask = texture2DRect(mask, pos - maskOffset);
vec4 rightMask = texture2DRect(mask, pos + maskOffset);
- bool valid = leftMask.r > 0. && rightMask.r > 0.; // ignore black pixels
+ bool valid = leftMask.r == 1. && rightMask.r == 1.; // ignore black pixels
if(valid) {
vec2 sampleOffset = (float(i) - .5) * direction;
sum +=
@@ -50,20 +50,21 @@ void main() {
// 140 fps
#ifdef STANDARD
+ int samples = 1;
for(i = 1; i < k; i++) {
vec2 curOffset = float(i) * direction;
vec4 leftMask = texture2DRect(mask, pos - curOffset);
vec4 rightMask = texture2DRect(mask, pos + curOffset);
- bool valid = leftMask.r > 0. && rightMask.r > 0.; // ignore black pixels
+ bool valid = leftMask.r == 1. && rightMask.r == 1.; // ignore black pixels
if(valid) {
sum +=
texture2DRect(tex, pos + curOffset) +
texture2DRect(tex, pos - curOffset);
+ samples += 2;
} else {
break;
}
}
- int samples = 1 + (i - 1) * 2;
#endif
gl_FragColor = sum / float(samples);
@@ -3,7 +3,7 @@
void testApp::setup() {
//ofSetVerticalSync(true);
- src.loadImage("src.jpg");
+ src.loadImage("src.png");
src.setImageType(OF_IMAGE_COLOR);
dst.loadImage("dst.jpg");
dst.setImageType(OF_IMAGE_COLOR);

0 comments on commit b576a45

Please sign in to comment.