"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

"EXC_BAD_ACCESS" on getFrame() of QCAR::State

The sample of "BackgroundTextureAccess" tends to be modified and it is going to acquire the input picture from a camera. However, "EXC_BAD_ACCESS" occurs in following codes and it cannot acquire information. ------ - (void)renderFrameQCAR { [self setFramebuffer]; QCAR::setFrameFormat(QCAR::RGB888, true); // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Get the state from QCAR and mark the beginning of a rendering section QCAR::State state = QCAR::Renderer::getInstance().begin(); QCAR::Frame frame = state.getFrame(); NSLog(@"image num:%d", frame.getNumImages()); //Thread 2:Program received signal:"EXC_BAD_ACCESS" //////////////////////////////////////////////////////////////////////////// // This section renders the video background with a // custom shader defined in Shaders.h QCAR::Renderer::getInstance().bindVideoBackground(0); ------ This problem occurs in iPhone4/iOs4.3.5 (8L1), and it does not occurs in iPad2/iOs4.3.3 (8J2). Since machine translation is used, there may be a mistake in English, but please forgive.

Hi nobu, It looks like this crash happens only on the first call to renderFrameQCAR. If you can wait until the second call of renderFrameQCAR onwards (using a static/class flag) the crash will be avoided. [CODE]- (void)renderFrameQCAR { ... [INDENT]static BOOL canUseFrame = NO; if (canUseFrame ==

GameDevMich

Sat, 04/21/2012 - 21:45

[QUOTE=MoSR]Hi nobu, It looks like this crash happens only on the first call to renderFrameQCAR. If you can wait until the second call of renderFrameQCAR onwards (using a static/class flag) the crash will be avoided. [/QUOTE] Hi MoSR.

GameDevMich

Wed, 04/25/2012 - 03:10

I hate to recant my earlier success post, but the issue has repeated itself even with the static bool trick. It just happened to work two times in a row, which was good enough for me to pack up and head home.

GameDevMich

Wed, 04/25/2012 - 23:00

@MoSR - So bad news. My further attempts have resulted in failure. I could not find a single trick, delay, or "skip" that will allow me to avoid this crash. I really want to use the Frame object approach since it will fit well in my existing framework.

@GameDevMich: Hi - we do have a candidate fix for this - but we need to make sure it solves the problem fully. In all your workaround attempts (thanks for pursuing BTW) have you tried skipping, say, 10 frames? In our tests, skipping just one frame was good enough - can you provide some sample cod

@GameDevMich, andersfrank, nobu: I've taken the QCAR iOS SDK 1.5.8 release, accessed QCAR::Frame.getFrame().getNumImages() to cause the crash (it failed on the third time - the cause is an unitialised variable so it is somewhat random). Then I applied the suggested workaround to skip the first fra

GameDevMich

Fri, 04/27/2012 - 00:00

@MoSR - I tried the following approaches: 1. Single boolean (as suggested in this thread) 2. An integer counter, which I tested with 3, 4, 5, 6, etc 3. A timer that would pause in certain intervals to let QCAR do whatever it needed to do in the background 4.

andersfrank

Fri, 04/27/2012 - 08:58

@GameDevMich: Note that your pastebin log indicates that the crash occurs on the main thread. The renderframeqcar is called on a background thread, and all calls to the QCAR renderer needs to be done on that specific thread (according to the docs).

@GameDevMich: As andersfrank astutely noted, this crash looks different to the original, which crashes within the Render thread. Are you trying to run some part of the rendering in a different thread - all sorts of things won't like that. You *do* have to perform any iOS/Cocoa calls on the main th