diff --git a/src/ofxComposer.cpp b/src/ofxComposer.cpp index 9cbd095..22abd2a 100644 --- a/src/ofxComposer.cpp +++ b/src/ofxComposer.cpp @@ -23,8 +23,8 @@ string helpScreen = "\n \ - r: reset mask path\n \ \n \ - F4: Reset surface coorners\n \ - - F5: Add ofxGLEditor (temporal!!!)\n \ - - F6: Add ofVideoGrabber (temporal!!!)\n \ + - F5: Add ofxGLEditor (temporal!!!) and if have it add ofVideoGrabber (temporal!!!)\n \ + - F6: Add ofShader (temporal!!!)\n \ - F7: Turn ON/OFF the fullscreen-mode\n \ \n \ Mouse and Coorners: \n \ @@ -332,9 +332,15 @@ void ofxComposer::_keyPressed(ofKeyEventArgs &e){ // Special keys reserved for Patch Events // } else if (e.key == OF_KEY_F5 ){ - bGLEditorPatch = addPatchWithOutFile("ofxGLEditor", ofPoint(ofGetMouseX(),ofGetMouseY())); + + if ( bGLEditorPatch ) + addPatchWithOutFile("ofVideoGrabber", ofPoint(ofGetMouseX(),ofGetMouseY())); + else + bGLEditorPatch = addPatchWithOutFile("ofxGLEditor", ofPoint(ofGetMouseX(),ofGetMouseY())); + } else if ( e.key == OF_KEY_F6 ){ - addPatchWithOutFile("ofVideoGrabber", ofPoint(ofGetMouseX(),ofGetMouseY())); + addPatchWithOutFile("ofShader", ofPoint(ofGetMouseX(),ofGetMouseY())); + } else if (e.key == OF_KEY_F7){ ofToggleFullscreen(); diff --git a/src/ofxComposer.h b/src/ofxComposer.h index 31dc229..cf52ae9 100644 --- a/src/ofxComposer.h +++ b/src/ofxComposer.h @@ -51,7 +51,6 @@ class ofxComposer { ofColor editorFgColor; #endif - map patches; string configFile; diff --git a/src/ofxPatch.cpp b/src/ofxPatch.cpp index ff58e57..e5191ad 100644 --- a/src/ofxPatch.cpp +++ b/src/ofxPatch.cpp @@ -1099,7 +1099,32 @@ bool ofxPatch::loadType(string _type, string _configFile){ width = videoGrabber->getWidth(); height = videoGrabber->getHeight(); } - } + } else if (_type == "ofShader"){ + type = _type; + + if ( shader != NULL ) + delete shader; + + shader = new ofxShaderObj(); + shader->allocate(width,height); + loaded = shader->setFragmentShader("uniform sampler2DRect tex0;\n\ +uniform sampler2DRect backbuffer;\n\ +uniform vec2 resolution;\n\ +uniform vec2 mouse;\n\ +uniform float time;\n\ +\n\ +void main(){\n\ + vec2 st = gl_FragCoord.xy;\n\ + vec4 color = texture2DRect(tex0, st);\n\ + gl_FragColor = vec4(color.rgb,1.0);\n\ +}"); + + inPut.clear(); + for ( int i = 0; i < shader->getNumberOfTextures(); i++){ + LinkDot p; + inPut.push_back(p); + } + } if ( loaded ){