From a0c3a1eff53878af07b0cdb76fbbc615dfe3bea5 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Wed, 5 Nov 2014 22:22:37 +0100 Subject: [PATCH 1/8] Add xcode project add to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ace762a..0a14e06 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,7 @@ A short wishlist for the next releases: - Added FBO source. You can create a custom openFrameworks application for piMapper by extending the FboSource class. Add/register your custom object as source in piMapper and you will be able to select it in the source editor. Source is saved and loaded from the settings as well. - Fixed issue #15 - Added -f (fullscreen) flag for the Raspberry Pi version. Use `./yourApp -f` to launch it fullscreen on start. + - Added XCode project file to example. ### Version 0.2.0 (2014-10-18): - Added logo (thanks [Irina Spicaka](http://irina.spicaka.info/)) From bd3f23a349c6d303f9035f73f903310bd28ee5d7 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Fri, 7 Nov 2014 16:02:14 +0100 Subject: [PATCH 2/8] Remove cout from QuadSurface constructor --- src/Surfaces/QuadSurface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Surfaces/QuadSurface.cpp b/src/Surfaces/QuadSurface.cpp index cffd145..fb0f794 100644 --- a/src/Surfaces/QuadSurface.cpp +++ b/src/Surfaces/QuadSurface.cpp @@ -3,7 +3,6 @@ namespace ofx { namespace piMapper { QuadSurface::QuadSurface() { - cout << "QuadSurface constructor." << endl; setup(); } From 6ca4834ffbe9381c37f968d0799a506e6b21dbd2 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Fri, 7 Nov 2014 19:42:01 +0100 Subject: [PATCH 3/8] Fix selected surface not being initialized to null in surface manager --- src/Surfaces/SurfaceManager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Surfaces/SurfaceManager.cpp b/src/Surfaces/SurfaceManager.cpp index 929fd1f..493a949 100644 --- a/src/Surfaces/SurfaceManager.cpp +++ b/src/Surfaces/SurfaceManager.cpp @@ -2,10 +2,9 @@ namespace ofx { namespace piMapper { - SurfaceManager::SurfaceManager() { - // Init variables - mediaServer = NULL; - } + SurfaceManager::SurfaceManager() : + mediaServer(NULL), + selectedSurface(NULL) {} SurfaceManager::~SurfaceManager() { clear(); } From 42f42ff31c834812e7b8c671516533ffabfdf216 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 8 Nov 2014 01:00:07 +0100 Subject: [PATCH 4/8] Fix ofxOMXPlayer opt.h directory path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a14e06..2a1fc94 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ sudo rpi-update fatal error: libavcodec/opt.h: No such file or directory ``` -To fix that, create a file `opt.h` in `addons/ofxOMXPlayer/libs/ffmpeg/libavcodec/` with the following contents: +To fix that, create a file `opt.h` in `addons/ofxOMXPlayer/libs/ffmpeg/include/libavcodec/` with the following contents: **opt.h** From 9e7d07e0c13db303978d8dd09129081be74b0ec0 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 8 Nov 2014 13:56:32 +0100 Subject: [PATCH 5/8] Add fbo source protection against not allocating in derived classes --- src/Sources/FboSource.cpp | 9 ++++++++- src/Sources/FboSource.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Sources/FboSource.cpp b/src/Sources/FboSource.cpp index f64236b..a866366 100644 --- a/src/Sources/FboSource.cpp +++ b/src/Sources/FboSource.cpp @@ -3,7 +3,7 @@ namespace ofx { namespace piMapper { FboSource::FboSource() : fbo(NULL) { - name = PIMAPPER_DEF_FBO_SOURCE_NAME; + name = PIMAPPER_FBO_SOURCE_DEF_NAME; loadable = false; loaded = false; type = SourceType::SOURCE_TYPE_FBO; @@ -32,6 +32,13 @@ namespace ofx { void FboSource::onAppSetup(ofEventArgs &args) { ofRemoveListener(ofEvents().setup, this, &FboSource::onAppSetup, OF_EVENT_ORDER_BEFORE_APP); setup(); + + // Check if FBO was allocated in user defined setup + // If not, show warning and alocate to avoid panic + if (!fbo->isAllocated()) { + ofLogWarning("FboSource::onAppSetup") << "FBO not allocated, allocating with default values"; + allocate(PIMAPPER_FBO_SOURCE_DEF_WIDTH, PIMAPPER_FBO_SOURCE_DEF_HEIGHT); + } } void FboSource::onAppUpdate(ofEventArgs &args) { diff --git a/src/Sources/FboSource.h b/src/Sources/FboSource.h index 2a27ded..3e3a3a5 100644 --- a/src/Sources/FboSource.h +++ b/src/Sources/FboSource.h @@ -10,7 +10,9 @@ class YourGenerativeSource : public FboSource { #include "ofMain.h" #include "BaseSource.h" -#define PIMAPPER_DEF_FBO_SOURCE_NAME "FBO Source" +#define PIMAPPER_FBO_SOURCE_DEF_NAME "FBO Source" +#define PIMAPPER_FBO_SOURCE_DEF_WIDTH 500 +#define PIMAPPER_FBO_SOURCE_DEF_HEIGHT 500 namespace ofx { namespace piMapper { @@ -38,12 +40,15 @@ namespace ofx { virtual void draw() {}; // But this is the only place where you shoud do drawing virtual void exit() {}; - // Use these to set up FBo itself - void allocate(int width, int height); - void clear(); // The only method from BaseSource to be overriden + // The only method from BaseSource to be overriden + void clear(); protected: ofFbo* fbo; + + // Use this instead fbo->allocate as it sets other source related settings + // It is protected to force the user to create derived FBO sources from this + void allocate(int width, int height); }; } // namespace piMapper } // namespace ofx \ No newline at end of file From 8a920b087e0bb7d537512b45de6814dfb15bc2d9 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 8 Nov 2014 14:05:16 +0100 Subject: [PATCH 6/8] Fix [issue 24] fbo source not highlighted as active in sources editor when the selected surface has it assigned --- src/UserInterface/SourcesEditor.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/UserInterface/SourcesEditor.cpp b/src/UserInterface/SourcesEditor.cpp index 622fef7..7cca943 100644 --- a/src/UserInterface/SourcesEditor.cpp +++ b/src/UserInterface/SourcesEditor.cpp @@ -133,7 +133,14 @@ namespace piMapper { fboSelector->enable(); } BaseSource* source = surfaceManager->getSelectedSurface()->getSource(); - selectSourceRadioButton(source->getPath()); + + // TODO: getPath should be replaced with something like getId() as now we + // use paths for loadable sources and names for FBOs + if (source->getType() == SourceType::SOURCE_TYPE_FBO) { + selectSourceRadioButton(source->getName()); + } else { + selectSourceRadioButton(source->getPath()); + } } void SourcesEditor::setSurfaceManager(SurfaceManager* newSurfaceManager) { From 655b7dbac394e299cb01eeb7e76065f4f107fd43 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Mon, 17 Nov 2014 16:41:22 +0200 Subject: [PATCH 7/8] Remove quad surface perspective warping as it was buggy. Next logincal steps: - Add mesh warping (multiple cols and rows) - Then add perspective warping as a wrapper of the mesh warp --- src/Surfaces/QuadSurface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Surfaces/QuadSurface.cpp b/src/Surfaces/QuadSurface.cpp index fb0f794..896f2f1 100644 --- a/src/Surfaces/QuadSurface.cpp +++ b/src/Surfaces/QuadSurface.cpp @@ -75,6 +75,7 @@ void QuadSurface::draw() { /*if(mesh.haveVertsChanged() || mesh.haveTexCoordsChanged()){ calculate4dTextureCoords(); }*/ + /* glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(4, GL_FLOAT, 0, quadTexCoordinates); glVertexPointer(3, GL_FLOAT, 0, quadVertices); @@ -82,6 +83,11 @@ void QuadSurface::draw() { source->getTexture()->bind(); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, quadIndices); source->getTexture()->unbind(); + */ + + source->getTexture()->bind(); + mesh.draw(); + source->getTexture()->unbind(); } void QuadSurface::setVertex(int index, ofVec2f p) { From 423d88d318b8bfdbd2dd561334b64ba52602cdf5 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Mon, 17 Nov 2014 16:49:28 +0200 Subject: [PATCH 8/8] Update readme for version 0.2.2 --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a1fc94..84f0fd0 100644 --- a/README.md +++ b/README.md @@ -165,8 +165,13 @@ A short wishlist for the next releases: - Syphon source for Mac - Spout source for Win - Streaming source for RPi (fb sharing, network streams...) - - Even better structure - + - Even better code structure + +### Version 0.2.2 (2014-11-17): + - Remove perspective warping in favour of doing mesh warping first and then adding proper perspective warping as a wrapper of the mesh warp + - Fixed issue 24 (selected surface FBO source not checked in the sources editor view) + - Fix OMX player workaround instructions + ### Version 0.2.1 (2014-11-05): - Added single instance feature. Now you can use ofxPiMapper as single object for your project. - Added FBO source. You can create a custom openFrameworks application for piMapper by extending the FboSource class. Add/register your custom object as source in piMapper and you will be able to select it in the source editor. Source is saved and loaded from the settings as well.