Meshes, Matrices, and Recording

I have some (complicated, but what did you expect?) code in which I do a bit of matrix manipulation and have some meshes rendering with textures. I wanted to take a recording of this, but when I did then the mesh didn’t render in the recording part. What was stranger still was that none of the other parts of that particular drawing rendered either (the object consisted of a couple of meshes and a bog-standard rectangle) which makes me think that it might be the matrix rather than the mesh that is causing the problem. They are “transitory” elements in that they appear when the user wants them and disappear afterwards. They are rendered when the recording is not happening, and if I invoke one during the recording and then stop the recording, they magically appear.

I can send the codea file, but I warn you it’s big. I’ll try to figure out a smaller example as well in the meantime. I’m posting now in case there’s something obvious.

Please give us the files! I’ll post it in my website if you want to save space on your server. Looking forward to it!

Here’s an example of the behaviour, sort of. I believe that this is related to what I see in my complicated code but the manifestation is slightly different.

function setup()

function draw()
    background(0, 0, 0, 255)
    if toggleRec then
        if isRecording() then
    toggleRec = false
    stroke(255, 0, 0, 255)

function touched(touch)
    if touch.state == ENDED then
        toggleRec = true

The key appears to be having the camera call and to having the recording functions in the draw function.


  1. When I tap the screen, the recording starts (as it should). There is no “Made with Codea” slogan and the rectangle flickers nastily. If I start the recording with the onscreen buttons then the MwC slogan is still absent[1], but there is no flicker.
  2. If the recording functions are invoked in the touched routine then there is no flicker.
  3. The location of the camera call does not appear to matter.

[1] This makes me wonder if the slogan is put over the top without checking that the matrices are reset - thus a different issue.

Just tried this with the latest beta and this example now works (modulo the “Made with Codea” message). However, the problem still shows in my original code. I’ll have another go at paring it down, but I may have to just send you the entire code.

Thanks for the code sample, Andrew. I think you might be right in that this is a matrix bug. I will look at your smaller sample first to see if I can re-create it. It shouldn’t have changed much between beta releases.

I’ve just emailed you the Big Code.