mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
Use loaded flag to upate texture object, and image format when setting
pixels. Fixes #1830
This commit is contained in:
@@ -524,21 +524,21 @@ public class Texture implements PConstants {
|
||||
* Copies the contents of the texture to the pixels array.
|
||||
* @param pixels
|
||||
*/
|
||||
public void loadPixels(int[] pixels) {
|
||||
if (hasBuffers()) {
|
||||
// Updates the texture AND the pixels array of the image at the same time,
|
||||
// getting the pixels directly from the buffer data (and thus avoiding
|
||||
// expensive transfer between video and main memory).
|
||||
bufferUpdate(pixels);
|
||||
}
|
||||
|
||||
if (isModified()) {
|
||||
// Regular pixel copy from texture.
|
||||
get(pixels);
|
||||
}
|
||||
|
||||
setModified(false);
|
||||
}
|
||||
// public void loadPixels(int[] pixels) {
|
||||
// if (hasBuffers()) {
|
||||
// // Updates the texture AND the pixels array of the image at the same time,
|
||||
// // getting the pixels directly from the buffer data (and thus avoiding
|
||||
// // expensive transfer between video and main memory).
|
||||
// bufferUpdate(pixels);
|
||||
// }
|
||||
//
|
||||
// if (isModified()) {
|
||||
// // Regular pixel copy from texture.
|
||||
// get(pixels);
|
||||
// }
|
||||
//
|
||||
// setModified(false);
|
||||
// }
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user