Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Artifacts on phone version

edited April 25 in General Posts: 186

Hi all,

1st of all, excellent work on the phone version!

Very happy with it overall, but there are some artifacts in one of my projects where I draw a scaled and/or rotated img of the screen back onto itself.

I added a couple of pics, the 1st 2 pics are from the phone version, where you can see these purple artifacts, even if I draw nothing, the last pic is from the ipad, how it is supposed to look.

I only get the artifacts when the screen is being rotated and/or scaled, the strength of which is determined by how you hold the device. I included the relevant bit of code below, there is another setcontext() before I draw the final img to the screen.

    setContext(screenImg)
    pushMatrix()
    translate(WIDTH/2,HEIGHT/2)
    zooml = 1-(Gravity.y+.8) / 20--1-((Gravity.y+1)*2/10)
    rotate(-Gravity.x*3)
    sprite(screenImg, 0,0, screenImg.width*zooml,screenImg.height*zooml)
    popMatrix()
Tagged:

Comments

  • SimeonSimeon Admin Mod
    Posts: 5,694

    Thanks for the detailed report. What iPhone model are you using?

    Do you have a very short example that reproduces the problem?

  • edited April 26 Posts: 186

    Im using a 12 mini, sample code below, thanks! =)

    You can scale up or down by ‘tilting’ and rotate by ‘rolling’ the device.
    You can draw something on the screen by touching, but the artifacts show up regardless.

    -- Artifact Xmple
    
    function setup()
        rnd = math.random
        img = image(WIDTH, HEIGHT)
    
        noStroke()
        setContext(img)
            fill(55+rnd(200), 55+rnd(200), 55+rnd(200))
            rect(WIDTH/2-150,HEIGHT/2-150, 300, 300)
        setContext()
    end
    
    function draw()
        background(0, 0, 0, 255)
    
        -- draw scaled & rotated img onto itself
        zoom = 1-(Gravity.y+.8) / 20
        setContext(img)
            pushMatrix()
            translate(WIDTH/2, HEIGHT/2)
            rotate(-Gravity.x*6)
            sprite(img, 0,0, img.width*zoom, img.height*zoom)
            popMatrix()
    
            -- fade to black
            fill(0,2)
            rect(0,0,WIDTH, HEIGHT)   
        setContext()
    
        -- draw img to screen
        sprite(img, img.width/2, img.height/2)
    
        fill(255)
        text(1//DeltaTime, WIDTH/2,HEIGHT-20)
    end
    
    function touched(t)
        setContext(img)
            ellipse(t.x,t.y, 50)
        setContext()
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,694

    Thank you! Will use it for debugging. I wonder if it's due to the 3x scale factor of iPhone screens and some assumption in the Codea rendering code

Sign In or Register to comment.