strange thing with placed image

I use a mac book pro with a retina screen and a normal beamer with a resolution a bit higher then 1024x768. I have the following method:

 private void createBlurGraphics() {

        if (!didInitPasses) {
            initPasses();
        }

        blur.set("blurSize", blurSize);
        blur.set("sigma", sigma);

        blur.set("horizontalPass", 0);
        blurPass1.beginDraw();
        blurPass1.shader(blur);
        blurPass1.image(parent.getImage(), 0, 0);
        blurPass1.endDraw();

        blur.set("horizontalPass", 1);
        blurPass2.beginDraw();
        blurPass2.shader(blur);
        blurPass2.image(blurPass1, 0, 0);
        blurPass2.endDraw();

        //debug
        parent.getImage().save("output/test"+p.frameCount+".png");
        blurPass2.save("output/test"+p.frameCount+"_r.png");
    }

This is the image i get from another class with the parent.getImage(): test448

I place the image above on the PGraphics at 0,0, this is the unwanted result: test448_r

I don't understand why it is placed there, and scaled like that.

Strange thing is, when i attach a non retina monitor to my mac then the image is normall. Also when i only use the monitor of the mac then the image is normal. But with the beamer it's not.

Anyone an idea what can cause this?

(I would like to isolate the problem but i don't have the beamer at home).

Answers

  • I have another strange bug again. The result is scaled twice to big or not appearing.

    public PImage getImage() {
    
            if (blobImage == null) {
                blobImage = p.createGraphics(parent.getImage().width/2, parent.getImage().height/2, PConstants.P2D);
                blobImage.noSmooth();
            }
            //parent.getImage();
    
            blobImage.beginDraw();
            blobImage.background(255, 0, 0);
    
            blobImage.image(parent.getImage(), 0, 0, blobImage.width, blobImage.height);
    
            blobImage.endDraw();
    
            blobImage.loadPixels();
    
            return blobImage;
        }
    

    If i uncomment the commented line above the bug is gone.

    public PImage getImage() {
    
            if (thresholdPass == null) {
                thresholdPass = p.createGraphics(parent.getImage().width, parent.getImage().height, PConstants.P2D);
                thresholdPass.noSmooth();
            }
    
            if (imageCreatedOnFrame == p.frameCount) {
                PApplet.println("return by equal frameCount");
                return thresholdPass;
            }
    
            imageCreatedOnFrame = p.frameCount;
    
            thresholdPass.beginDraw();
            thresholdPass.background(0);
            thresholdPass.stroke(255);
            thresholdPass.line(0, 0, thresholdPass.width, thresholdPass.height);
            thresholdPass.endDraw();
    
            thresholdPass.loadPixels();
    
            PApplet.println("return by creation");
    
    
            return thresholdPass;
        }
    

    With the line commented it only prints: return by creation

    Else it prints both "return by equal frameCount" and "return by creation".

    :S

  • Retina displays have smaller, denser pixels than a normal screen. Use processing's retina rendering mode to fix some display issues. I'm not sure if this is still under development or if they've pretty much got it sorted out. Check it out on the processing wiki

  • The problem was drawing in another beginDraw().

Sign In or Register to comment.