mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
getBufferPixels() removes the buffers from the cache, fixes the #2424
This commit is contained in:
@@ -428,7 +428,7 @@ public class Capture extends PImage implements PConstants {
|
||||
|
||||
public synchronized void loadPixels() {
|
||||
super.loadPixels();
|
||||
if (useBufferSink) {
|
||||
if (useBufferSink) {
|
||||
if (natBuffer != null) {
|
||||
// This means that the OpenGL texture hasn't been created so far (the
|
||||
// video frame not drawn using image()), but the user wants to use the
|
||||
@@ -436,17 +436,17 @@ public class Capture extends PImage implements PConstants {
|
||||
IntBuffer buf = natBuffer.getByteBuffer().asIntBuffer();
|
||||
buf.rewind();
|
||||
buf.get(pixels);
|
||||
Video.convertToARGB(pixels, width, height);
|
||||
Video.convertToARGB(pixels, width, height);
|
||||
} else if (sinkGetMethod != null) {
|
||||
try {
|
||||
sinkGetMethod.invoke(bufferSink, new Object[] { pixels });
|
||||
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 overriden by the buffers coming
|
||||
// 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);
|
||||
|
||||
@@ -570,7 +570,7 @@ public class Movie extends PImage implements PConstants {
|
||||
}
|
||||
|
||||
// super.loadPixels() sets loaded to true, but in the useBufferSink mode,
|
||||
// the contents of the pixels array is overriden by the buffers coming
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user