I’m working on an app that’s getting intermittent crashes on startup.
It seems to crash on FBO.getTextureReference(), which calls FBO.getTextureReference(defaultTextureIndex)…
If I log out defaultTextureIndex, I can see it crashes when defaultTextureIndex is non-zero (and at times a very large positive or negative number). When it runs fine defaultTextureIndex is 0. Setting defaultTextureIndex to 0 immediately after the FBO is allocated appears to have no effect.
I’ve been oFing on and off for a couple of years now, but this is the first project where I’ve used FBOs, so I’m not sure if I’m missing something obvious.
Any ideas? or tricks to using FBOs to avoid common hiccups?
I’m using oF 0.71 (downloaded from the website) and XCode 4.3.3 on Lion.
So I’ve (fingered crossed) fixed the bug for now by forcing defaultTextureIndex to 0. It feels a bit hacky, but it should suit my needs for this project.
I’m still keen to hear if anyone has any ideas on why sometimes defaultTextureIndex would be a seemingly random number?
ofFbo::ofFbo():
isBound(0),
fbo(0),
fboTextures(0),
depthBuffer(0),
stencilBuffer(0),
savedFramebuffer(0),
defaultTextureIndex(0), // right here
bIsAllocated(false)
{
}
so unless you’re doing something tricky, it should be that by default. If it’s large positive or negative numbers then it’s probably unallocated, which is pretty odd. Are you copying multiple FBOs around somehow?
so unless you’re doing something tricky, it should be that by default.
Perhaps I am, but not intentionally!
I’m using a few FBOs (4 per frame), with each one being passed to the next in line using getTextureReference(). The second FBO in the chain is the “scene” FBO - which comes from a different scene object depending on which scene is currently selected. This is the only one that comes from a potentially different place each frame. It’s on this one that the crashes occur, and only ever on the first frame of the app. I’ve added a check to see if it’s allocated, and it always is, even when the crash occurs.
Since forcing the (0) I haven’t had crashes so I’m kinda happy for now - the project is crunching so I’ve got other things to worry about for the time being. It’s being installed Monday for a two week testing phase - after which it has to run for five years (gulp), so hopefully I see any further issues caused by this come out in the next couple of weeks.
I’ll return to this issue after it’s installed, and try and replicate it in an example project.
Anyways thanks for your reply, I’m always insanely grateful for these forums and how much they get me through my projects. I’ll post up the project in the examples forum when it’s done.
…which comes from a different scene object depending on which scene is currently selected. This is the only one that comes from a potentially different place each frame.
i just bumped into the exact same error! i have another object that contains an FBO, and try to use it elsewhere, the defaultTextureIndex ends up as a random value if the FBO comes from the other class. the rest of the frame buffer seems to work fine, however. the other strange thing is i swear i’ve used FBO’s in other objects and they’ve worked fine before…
i ended up forcing it to 0 (by making the the index public and setting it to 0 manually… hacky hacky…)
I still haven’t had time to try and replicate this behaviour in an example project.
I’m slightly relieved someone else has had the same troubles though - intermittent bugs are the worst!