Hi,
I’ve stumbled upon a weird issue on Windows I’m trying to get a workaround going.
Here’s a basic sketch to replicate the issue:
PImage texture;
void setup(){
size(1280,720,P3D);
texture = createImage(3840,2166,RGB);
for(int i = 0 ; i < texture.pixels.length; i++){
texture.pixels[i] = color(random(255),random(255),random(255),255);
}
texture.updatePixels();
}
void draw(){
background(0);
//image(texture,0,0);
int x1 = 0;
int y1 = 0;
int x2 = width;
int y2 = height;
int u1 = 0;
int v1 = 0;
int u2 = width;
int v2 = height;
beginShape(QUADS);
texture(texture);
vertex(x1, y1, u1, v1);
vertex(x1, y2, u1, v2);
vertex(x2, y2, u2, v2);
vertex(x2, y1, u2, v1);
endShape();
println(frameCount,millis());
surface.setTitle((int)frameRate+"fps");
}
The output starts printing:
1 1558
2 17342
In short, using texture() is slow the first time it’s called for large textures.
I’ve profiled the sketch and it points to JOGL’s dispatch_glTexSubImage2D1()
when called by PGraphicsOpenGL’s initCache()/addTexture() cycle.
I google a bit and it seems to be a JOGL issue related to temp folder permissions ?
Relevant threads:
http://forum.jogamp.org/Java-3D-initialization-is-super-slow-td4037070.html
https://jogamp.org/bugzilla/show_bug.cgi?id=1301
I’ve tried temporarily disabling Windows Defender and allowing C:\Windows\Temp more permissions, but it didn’t seem to fix anything. I’ve also attempted to pass -Djogamp.gluegen.UseTempJarCache=false
to processing-java in the hope the flag would make it’s way to JVM, but this didn’t seem to work.
Has anyone else experienced this issue ? Is there a quick workaround for the Processing IDE
(before drilling down to running an exported jar from command line or using eclipse ?) ?