some cleaner logic to allow for #2424, which should also work when video

buffers start accumulating in the cache on slower machines.
This commit is contained in:
codeanticode
2014-04-06 10:07:54 -04:00
parent c7c20f0183
commit 7c23d482b7
3 changed files with 20 additions and 22 deletions

View File

@@ -439,17 +439,15 @@ public class Capture extends PImage implements PConstants {
Video.convertToARGB(pixels, width, height);
} else if (sinkGetMethod != null) {
try {
// sinkGetMethod will copy the latest buffer to the pixels array,
// and the pixels will be copied to the texture when the OpenGL
// renderer needs to draw it.
sinkGetMethod.invoke(bufferSink, new Object[] { pixels });
} catch (Exception e) {
e.printStackTrace();
}
}
// super.loadPixels() sets loaded to true, but in the useBufferSink mode,
// the contents of the pixels array is overwritten by the buffers coming
// from gstreamer, so we don't want PGraphicsOpenGL replacing the OpenGL
// texture with the pixels.
setLoaded(false);
outdatedPixels = false;
}
}

View File

@@ -563,17 +563,15 @@ public class Movie extends PImage implements PConstants {
Video.convertToARGB(pixels, width, height);
} else if (sinkGetMethod != null) {
try {
// sinkGetMethod will copy the latest buffer to the pixels array,
// and the pixels will be copied to the texture when the OpenGL
// renderer needs to draw it.
sinkGetMethod.invoke(bufferSink, new Object[] { pixels });
} catch (Exception e) {
e.printStackTrace();
}
}
// super.loadPixels() sets loaded to true, but in the useBufferSink mode,
// the contents of the pixels array is overwritten by the buffers coming
// from gstreamer, so we don't want PGraphicsOpenGL replacing the OpenGL
// texture with the pixels.
setLoaded(false);
outdatedPixels = false;
}
}