Can't mix FULLSCREEN with RETAINED backingMode

If I put these lines in my setup function:


displayMode(FULLSCREEN)
backingMode(RETAINED)

and try to draw an ellipse at CurrentTouch.x, CurrentTouch.y in the draw function, the ellipse doesn’t stay where I drew it. Instead, it moves left with each successive redraw.

This is happening on an iPad 3, if that matters.

Try tossing them into the code just above the setup function.

I get the same results. Here’s the code:

firstTime = true
frameCount = 0
oldX = -1
oldY = -1
    displayMode(FULLSCREEN)
    backingMode(RETAINED)

function setup()
end

function draw()
    if firstTime then
        background(40, 40, 50)
        if (frameCount>1) then
            firstTime = false
        end
    end
    stroke(255,255,255,255)
    strokeWidth(5)
    if frameCount > 0 and oldX ~= -1 then
        drawLines(oldOldX, oldOldY, oldX, oldY)
    else
        if CurrentTouch.state == MOVING then
            if oldX == -1 then
                oldX = CurrentTouch.x
                oldY = CurrentTouch.y
            end
            drawLines(oldX,oldY,CurrentTouch.x,CurrentTouch.y)
            oldOldX = oldX
            oldOldY = oldY
            oldX = CurrentTouch.x
            oldY = CurrentTouch.y
        elseif CurrentTouch.state == ENDED then
            oldX = -1
            oldY = -1
        end
    end
    frameCount = frameCount + 1
    if frameCount > 2 then
        frameCount = 0
    end
end

function drawLines(x1, y1, x2, y2)
    line(x1, y1, x2, y2)
    line(WIDTH-x1, y1, WIDTH-x2, y2)
    line(x1, HEIGHT-y1, x2, HEIGHT-y2)
    line(WIDTH-x1, HEIGHT-y1, WIDTH-x2, HEIGHT-y2)
end

Comment out the “displayMode(FULLSCREEN)” line and you’ll see how it is supposed to behave.

Hi @Memebag,

This seemed to work OK for me. Produced lines where I drew them which were duplicated in each of the four quadrants of the screen as reflections.

Bri_G

:slight_smile:

Which iPad are you running it on? It might have something to do with the iPad 3…

More info:

When I click the “camera” icon, the bizarre behavior stops. The saved video looks correct. The bizarre behavior resumes after I quit recording.

Works fine on an iPad2. Try putting the displaymode outside setup and backingmode inside.

Hi @Memebag,

I have pad (2) iOS(5) and Codea(1.41).
Always best to quote these when you’ve got a problem - it will help Simeon and the Codea team to identify your problem and, more importantly, how to resolve it.

Bri_G

:slight_smile:

I’m seeing the problem on an iPad 3, running iOS 5.1.1(9B206), and Codea 1.4.1.

Moving displayMode outside setup() and backingMode inside setup() has no effect.

It sounds like this may be an iPad 3 issue, since it works on 2 iPad 2s.

I can verify that on a new iPad (retina) it is very wonky, but if you record it, it looks correct. During the recording, the screen is really wonky.

I also discovered that FULLSCREEN is in orange (as it should be) while RETAINED is not. I realize it has nothing to do with this issue, but it is still a minor bug.

Has anyone developing Codea been able to reproduce this problem? Any suggestions for a work around?

Yes, a project I’ve been working on for the last few days presented me with this. They way I worked around it was by creating a boolean variable that controls the background() function, causing it to draw only once when the application first runs. Which is similar to what you did in your code, but by counting frames, so I don’t know why yours doesn’t work…

function setup()
displayMode(FULLSCREEN)
backingMode(RETAINED)

setBackground = true

end

function draw()

if setBackground == true then
background(255)
setBackground = false
end

end

Hope this helps. Any better ideas of how to do this are welcome.

The problem isn’t controlling when the background is cleared. The problem is that nothing stays where it was drawn. Each update seems to be scaling everything down in the x axis, which moves it to the left.

I just upgraded Codea and the problem is still present on my iPad 3.

I’ve been struggling with this too. It has made me regret upgrading to an iPad 3, since I bought it specifically to work on a Codea project that is now on hold because of this bug.

Here’s another thread on this:
http://twolivesleft.com/Codea/Talk/discussion/1061/strange-effects-with-fullscreen-and-backingmode-retained-on-new-ipad
(hope I did that right)

And here’s a quick example of the effect – swap between the two displayMode settings in setup() on an iPad 3, and with FULLSCREEN you’ll get the “things fly leftward” problem:

function setup()
   displayMode(FULLSCREEN)
   -- displayMode(STANDARD)

   backingMode(RETAINED)
   fill(0,255,0,255)
end

function draw()
   if (CurrentTouch.state==BEGAN or CurrentTouch.state==MOVING) then
      ellipse(CurrentTouch.x, CurrentTouch.y, 100)
   end
end

Simeon, have you been able to check in with Apple about this one?