Texture compression under android in OPENGL mode.
in
Android Processing
•
5 months ago
Hi.
I have a sketch which loads images into PImage.
I would like to use P3D mode to use blending shaders.
My problem is:
in P3D, the screen freezes while the loading thread is running.
It works fine without P3D…
How could I avoid this problem ? Is that something to do with the OPENGL thread ?
here's the code to demonstrate the problem:
I have a sketch which loads images into PImage.
I would like to use P3D mode to use blending shaders.
My problem is:
in P3D, the screen freezes while the loading thread is running.
It works fine without P3D…
How could I avoid this problem ? Is that something to do with the OPENGL thread ?
here's the code to demonstrate the problem:
- PImage images[] = new PImage[9];
- final int loadedI = 3;//number of images to load
- final int IMAGE_WIDTH= 1280; //width of loaded images
- final int IMAGE_HEIGHT= 800; //height of loaded images
- int h;
- void setup()
- {
- size(1280, 800, P3D); //SWITCH P3D ON AND OFF TO SEE THE OPENGL BLOCKS THE LOADING THREAD
- background(0);
- for (int i = 0; i < images.length; i++)
- {
- images[i] = new PImage(IMAGE_WIDTH, IMAGE_HEIGHT, RGB);
- }
- }
- void draw()
- {
- background(0);
- println(frameRate);
- for (int t = 0; t <loadedI; t++)
- {
- image(images[t], t*width/loadedI, height/2, width/loadedI, width/loadedI);
- }
- ellipse();//TO VISUALISE THE "INTERRUPTION OF THE SCREEN"
- }
- void ellipse()
- {
- h++;
- if (h>height) h=0;
- fill(255);
- ellipse(width/2, h, 50, 50);
- }
- void mousePressed()
- {
- for (int i= 0; i<loadedI; i++) {
- (new ImageLoaderThread(this, i, i )).start();
- }
- }
- class ImageLoaderThread extends Thread
{
private PApplet pa;
private String fileName;
private int gridIndex;
public ImageLoaderThread(PApplet pa, int imageIndex, int gridIndex)
{
this.pa = pa;
fileName = imageIndex+".jpg";
this.gridIndex = gridIndex;
}
public void run()
{
images[gridIndex] = loadImage(fileName);
images[gridIndex].updatePixels();
images[gridIndex].pixels = null;
}
}
1